lib/dogapi/common.rb
# Prepares the request and handles the response
#
# +method+ is an implementation of Net::HTTP::Request (e.g. Net::HTTP::Post)
#
# +params+ is a Hash that will be converted to request parameters
Prepares the request and handles the response
+method+ is an implementation of Net::HTTP::Request

+params+ is a Hash that will be converted to request parameters
Prepares the request and handles the response + method + is an implementation of Net :: HTTP :: Request + params + is a Hash that will be converted to request parameters
def request(method, url, extra_params, body, send_json, with_app_key=true)
      resp = nil
      connect do |conn|
        begin
          params = prepare_params(extra_params, url, with_app_key)
          req = prepare_request(method, url, params, body, send_json, with_app_key)
          resp = conn.request(req)
          if resp.code.to_i / 100 == 3
            resp = handle_redirect(conn, req, resp)
          end
          return handle_response(resp)
        rescue Exception => e
          suppress_error_if_silent e
        end
      end
    end
def request ( method , url , extra_params , body , send_json , with_app_key = true ) resp = nil connect do | conn | begin params = prepare_params ( extra_params , url , with_app_key ) req = prepare_request ( method , url , params , body , send_json , with_app_key ) resp = conn . request ( req ) if resp . code . to_i / 100 == 3 resp = handle_redirect ( conn , req , resp ) end return handle_response ( resp ) rescue Exception => e suppress_error_if_silent e end end end
Prepares the request and handles the response
+method+ is an implementation of Net::HTTP::Request (e.g.
Prepares the request and handles the response + method + is an implementation of Net :: HTTP :: Request ( e . g .
method
<not_specific>
url
<not_specific>
extra_params
<not_specific>
body
<not_specific>
send_json
<not_specific>
with_app_key
<not_specific>