Module: Postmates::Configuration
- Included in:
- Postmates
- Defined in:
- lib/Postmates/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :customer_id, :api_key, :adapter, :endpoint, :api_version ].freeze
- DEFAULT_CUSTOMER_ID =
nil
- DEFAULT_API_KEY =
nil
- DEFAULT_ADAPTER =
Faraday.default_adapter
- DEFAULT_ENDPOINT =
'https://api.postmates.com/v1/'.freeze
- DEFAULT_API_VERSION =
'20150117'.freeze
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
22 23 24 |
# File 'lib/Postmates/configuration.rb', line 22 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
26 27 28 |
# File 'lib/Postmates/configuration.rb', line 26 def configure yield self end |
#options ⇒ Object
30 31 32 33 34 |
# File 'lib/Postmates/configuration.rb', line 30 def VALID_OPTIONS_KEYS.inject({}) do |option, key| option.merge!(key => send(key)) end end |
#reset ⇒ Object
36 37 38 39 40 41 42 |
# File 'lib/Postmates/configuration.rb', line 36 def reset self.customer_id = DEFAULT_CUSTOMER_ID self.api_key = DEFAULT_API_KEY self.adapter = DEFAULT_ADAPTER self.endpoint = DEFAULT_ENDPOINT self.api_version = DEFAULT_API_VERSION end |