module Gems::Configuration
Constants
- DEFAULT_HOST
-
Set the default API endpoint
- DEFAULT_KEY
-
Set the default credentials
- DEFAULT_USER_AGENT
-
Set the default ‘User-Agent’ HTTP header
- VALID_OPTIONS_KEYS
-
An array of valid keys in the options hash when configuring a {Gems::Client}
Public Class Methods
When this module is extended, set all configuration options to their default values
# File lib/gems/configuration.rb, line 28 def self.extended(base) base.reset end
Public Instance Methods
Convenience method to allow configuration options to be set in a block
# File lib/gems/configuration.rb, line 33 def configure yield self end
Create a hash of options and their values
# File lib/gems/configuration.rb, line 38 def options options = {} VALID_OPTIONS_KEYS.each { |k| options[k] = send(k) } options end
Reset all configuration options to defaults
# File lib/gems/configuration.rb, line 45 def reset self.username = nil self.password = nil self.host = DEFAULT_HOST self.key = DEFAULT_KEY self.user_agent = DEFAULT_USER_AGENT self end