Class: TripSpark::Connection::HTTPartyAdapter

Inherits:
Object
  • Object
show all
Includes:
HTTParty
Defined in:
lib/tripspark_api/connection_adapters/httparty_adapter.rb

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ HTTPartyAdapter

Returns a new instance of HTTPartyAdapter.



10
11
12
13
14
# File 'lib/tripspark_api/connection_adapters/httparty_adapter.rb', line 10

def initialize config
  self.class.base_uri config.base_uri
  # Write debug information to the configured output stream
  self.class.debug_output config.debug_output
end

Instance Method Details

#get(endpoint, opts = {}, &block) ⇒ Object



16
17
18
# File 'lib/tripspark_api/connection_adapters/httparty_adapter.rb', line 16

def get endpoint, opts={}, &block
  JSON.parse(self.class.get(endpoint, opts, &block))
end

#post(endpoint, opts = {}, &block) ⇒ Object



20
21
22
# File 'lib/tripspark_api/connection_adapters/httparty_adapter.rb', line 20

def post endpoint, opts={}, &block
  JSON.parse(self.class.post(endpoint, opts, &block))
end