Module: CheckMobi::Configuration
- Included in:
- CheckMobi
- Defined in:
- lib/check_mobi/configuration.rb
Constant Summary collapse
- VALID_CONNECTION_KEYS =
[:endpoint, :user_agent, :method, :content_type, :accept_type].freeze
- VALID_OPTIONS_KEYS =
[:api_key, :format].freeze
- VALID_CONFIG_KEYS =
(VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS).freeze
- DEFAULT_ENDPOINT =
'https://api.checkmobi.com/v1'.freeze
- DEFAULT_METHOD =
:get.freeze
- DEFAULT_USER_AGENT =
"CheckMobi API Ruby Gem".freeze
- DEFAULT_API_KEY =
nil.freeze
- DEFAULT_FORMAT =
:json.freeze
- DEFAULT_CONTENT_TYPE =
"application/json".freeze
- DEFAULT_ACCEPT_TYPE =
"application/json".freeze
- DEFAULT_PLATFORM =
'web'
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
20 21 22 |
# File 'lib/check_mobi/configuration.rb', line 20 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
34 35 36 |
# File 'lib/check_mobi/configuration.rb', line 34 def configure yield self end |
#options ⇒ Object
38 39 40 |
# File 'lib/check_mobi/configuration.rb', line 38 def Hash[*VALID_CONFIG_KEYS.map{|key| [key, send(key)]}.flatten] end |
#reset ⇒ Object
24 25 26 27 28 29 30 31 32 |
# File 'lib/check_mobi/configuration.rb', line 24 def reset self.endpoint = DEFAULT_ENDPOINT self.method = DEFAULT_METHOD self.user_agent = DEFAULT_USER_AGENT self.api_key = DEFAULT_API_KEY self.format = DEFAULT_FORMAT self.content_type = DEFAULT_CONTENT_TYPE self.accept_type = DEFAULT_ACCEPT_TYPE end |