lib/powertrack/streaming/stream.rb
# Makes a rules-related request with a specific HTTP verb and a few options.
# Returns the response if successful or an exception if the request failed.
Makes a rules-related request with a specific HTTP verb and a few options.
Returns the response if successful or an exception if the request failed.
Makes a rules - related request with a specific HTTP verb and a few options . Returns the response if successful or an exception if the request failed .
def make_rules_request(verb, options=nil)
      options = DEFAULT_RULES_REQUEST_OPTIONS.merge(options || {})
      resp_status = nil
      resp_error = nil
      resp_body = nil
      EM.run do
        con = connect('api', 'rules')
        http = con.setup_request(verb,
                 head: rules_req_headers.merge(options[:headers]),
                 query: options[:query],
                 body: options[:body])
        http.errback do
          resp_error = http.error
          EM.stop
        end
        http.callback do
          resp_status = http.response_header.status
          resp_error = http.error
          resp_body = http.response
          EM.stop
        end
      end
      handle_api_response(resp_status, resp_error, resp_body, options[:ok])
    end
def make_rules_request ( verb , options = nil ) options = DEFAULT_RULES_REQUEST_OPTIONS . merge ( options || { } ) resp_status = nil resp_error = nil resp_body = nil EM . run do con = connect ( 'api' , 'rules' ) http = con . setup_request ( verb , head : rules_req_headers . merge ( options [ :headers ] ) , query : options [ :query ] , body : options [ :body ] ) http . errback do resp_error = http . error EM . stop end http . callback do resp_status = http . response_header . status resp_error = http . error resp_body = http . response EM . stop end end handle_api_response ( resp_status , resp_error , resp_body , options [ :ok ] ) end
Makes a rules-related request with a specific HTTP verb and a few options.
Makes a rules - related request with a specific HTTP verb and a few options .
verb
options