Class: Lyft::Client::Api::Base
- Inherits:
-
Object
- Object
- Lyft::Client::Api::Base
- Includes:
- HTTParty
- Defined in:
- lib/lyft/client/api/base.rb
Direct Known Subclasses
Constant Summary collapse
- API_VERSION =
ENV['LYFT_API_VERSION'] || 'v1'
- ENDPOINTS =
{}
- DEFAULT_VALIDATES =
[:access_token]
Class Method Summary collapse
-
.path_for(key, args = {}) ⇒ String
Constructs path for endpoint.
Instance Method Summary collapse
-
#initialize(configuration) ⇒ Base
constructor
A new instance of Base.
-
#path_for(key, args = {}) ⇒ String
Resolve path for ENDPOINTS.
- #set_debug_output ⇒ Object
Constructor Details
#initialize(configuration) ⇒ Base
Returns a new instance of Base.
56 57 58 59 |
# File 'lib/lyft/client/api/base.rb', line 56 def initialize(configuration) @configuration = configuration set_debug_output end |
Class Method Details
.path_for(key, args = {}) ⇒ String
Constructs path for endpoint.
29 30 31 32 33 34 35 36 37 38 |
# File 'lib/lyft/client/api/base.rb', line 29 def self.path_for(key, args = {}) # Must call dup because gsub! works with the reference # and will change the constant ENDPOINTS which is bad. path = self::ENDPOINTS.fetch(key.to_sym).dup args.each do |arg_key, value| path.gsub!("{{#{arg_key}}}", value.to_s) end path end |
Instance Method Details
#path_for(key, args = {}) ⇒ String
Resolve path for ENDPOINTS
52 53 54 |
# File 'lib/lyft/client/api/base.rb', line 52 def path_for(key, args = {}) self.class.path_for(key, args) end |
#set_debug_output ⇒ Object
61 62 63 |
# File 'lib/lyft/client/api/base.rb', line 61 def set_debug_output self.class.[:debug_output] = @configuration.debug_output end |