Class: TripSpark::Connection::HTTPartyAdapter
- Inherits:
-
Object
- Object
- TripSpark::Connection::HTTPartyAdapter
- Includes:
- HTTParty
- Defined in:
- lib/tripspark_api/connection_adapters/httparty_adapter.rb
Instance Method Summary collapse
- #get(endpoint, opts = {}, &block) ⇒ Object
-
#initialize(config) ⇒ HTTPartyAdapter
constructor
A new instance of HTTPartyAdapter.
- #post(endpoint, opts = {}, &block) ⇒ Object
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 |