Class: GetResponseApi::Connection

Inherits:
Object
  • Object
show all
Defined in:
lib/get_response_api/connection.rb

Constant Summary collapse

API_ENDPOINT =
'https://api.getresponse.com/v3'.freeze
TIMEOUT =
7

Instance Method Summary collapse

Constructor Details

#initialize(api_key) ⇒ Connection

Returns a new instance of Connection.



8
9
10
# File 'lib/get_response_api/connection.rb', line 8

def initialize(api_key)
  @api_key = api_key
end

Instance Method Details

#request(method, path) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/get_response_api/connection.rb', line 12

def request(method, path)
  response = http_request(method, path).parsed_response

  if error?(response) && response['message']
    return response['message']
  end
  response
end