Module: Busibe::Configuration
- Included in:
- Jusibe
- Defined in:
- lib/busibe/configuration.rb
Constant Summary collapse
- VALID_CONNECTION_KEYS =
[:endpoint, :user_agent, :request_method].freeze
- VALID_OPTIONS_KEYS =
[:public_key, :access_token, :format].freeze
- VALID_CONFIG_KEYS =
VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS
- DEFAULT_ENDPOINT =
"https://jusibe.com".freeze
- DEFAULT_REQUEST_METHOD =
:get
- DEFAULT_USER_AGENT =
"Busibe API Ruby Gem #{Busibe::VERSION}".freeze
- DEFAULT_PUBLIC_KEY =
nil
- DEFAULT_ACCESS_TOKEN =
nil
- DEFAULT_FORMAT =
:json
Class Method Summary collapse
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
- #options ⇒ Object
-
#reset ⇒ Object
reset config settings.
Class Method Details
.extended(base) ⇒ Object
17 18 19 |
# File 'lib/busibe/configuration.rb', line 17 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
32 33 34 |
# File 'lib/busibe/configuration.rb', line 32 def configure yield self end |
#options ⇒ Object
36 37 38 |
# File 'lib/busibe/configuration.rb', line 36 def Hash[*VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten] end |
#reset ⇒ Object
reset config settings
22 23 24 25 26 27 28 29 30 |
# File 'lib/busibe/configuration.rb', line 22 def reset self.endpoint = DEFAULT_ENDPOINT self.request_method = DEFAULT_REQUEST_METHOD self.user_agent = DEFAULT_USER_AGENT self.public_key = DEFAULT_PUBLIC_KEY self.access_token = DEFAULT_ACCESS_TOKEN self.format = DEFAULT_FORMAT end |