Module: TripSpark::Connection
- Extended by:
- Connection
- Included in:
- API, Connection
- Defined in:
- lib/tripspark_api/connection.rb,
lib/tripspark_api/connection_adapters/httparty_adapter.rb
Defined Under Namespace
Classes: HTTPartyAdapter
Instance Method Summary collapse
-
#adapter ⇒ Object
Return the class of the adapter to use for the connection.
-
#connection ⇒ Object
Return the connection adapter instance.
-
#register_adapter(name, klass) ⇒ Object
Register a new class that can be used as a connection adapter.
Instance Method Details
#adapter ⇒ Object
Return the class of the adapter to use for the connection
11 12 13 |
# File 'lib/tripspark_api/connection.rb', line 11 def adapter @@adapters[TripSpark.configuration.adapter] end |
#connection ⇒ Object
Return the connection adapter instance
6 7 8 |
# File 'lib/tripspark_api/connection.rb', line 6 def connection @connection ||= adapter.new(TripSpark.configuration) end |
#register_adapter(name, klass) ⇒ Object
Register a new class that can be used as a connection adapter
16 17 18 |
# File 'lib/tripspark_api/connection.rb', line 16 def register_adapter name, klass (@@adapters ||= {})[name] = klass end |