Class: Touringplans::Client
- Inherits:
-
Object
- Object
- Touringplans::Client
- Defined in:
- lib/touringplans.rb
Overview
deals solely with how to manage the connection, the key of “lock & key”
Instance Method Summary collapse
-
#initialize(connection:, routes:) ⇒ Client
constructor
A new instance of Client.
- #method_missing(method, *request_arguments) ⇒ Object
Constructor Details
#initialize(connection:, routes:) ⇒ Client
Returns a new instance of Client.
127 128 129 130 |
# File 'lib/touringplans.rb', line 127 def initialize(connection:, routes:) @connection = connection @routes = routes end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *request_arguments) ⇒ Object
132 133 134 135 136 137 138 |
# File 'lib/touringplans.rb', line 132 def method_missing(method, *request_arguments) # retrieve the route map route_map = routes.fetch(method) # make request via the connection response_from_route(route_map, request_arguments) end |