class NetObserver::Base

Base Class ==

Basic object for observing network communication. It is singleton, as it doesn’t make sense to have more then one object which observe network. Object is observable, so anyone could attach own object which contain update method for all network objects.

Parameters for update command in observers:

@param(Symbol) type of request, can be :request or :response

@param(Net::HttpRequest) request send or received from network

@param(String) body body used/received in request

@param(Net::HTTP,Net::HTTPS) connection connection on which is called method

@see NetObserver::Logger for example usage

Public Instance Methods

request_data(connection, request,body) click to toggle source

@private internal method for network hook

# File lib/net_observer/base.rb, line 29
def request_data(connection, request,body)
        changed
        notify_observers(:request,request,body, connection)
end
response_data(connection, response) click to toggle source

@private internal method for network hook

# File lib/net_observer/base.rb, line 35
def response_data(connection, response)
        changed
        body = response.respond_to?(:body) ? response.body : ""
        notify_observers(:response,response,body, connection)
end