Module: Shopkit::Configuration
- Included in:
- Shopkit
- Defined in:
- lib/shopkit/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :adapter, :api_version, :url, :access_token, :login, :password, :user_agent, :auto_traversal, :per_page].freeze
- DEFAULT_ADAPTER =
Faraday.default_adapter
- DEFAULT_API_VERSION =
1
- DEFAULT_USER_AGENT =
"Shopkit Ruby Gem #{Shopkit::VERSION}".freeze
- DEFAULT_AUTO_TRAVERSAL =
false
- DEFAULT_PER_PAGE =
30
Class Method Summary collapse
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
25 26 27 |
# File 'lib/shopkit/configuration.rb', line 25 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
29 30 31 |
# File 'lib/shopkit/configuration.rb', line 29 def configure yield self end |
#options ⇒ Object
33 34 35 |
# File 'lib/shopkit/configuration.rb', line 33 def VALID_OPTIONS_KEYS.inject({}){|o,k| o.merge!(k => send(k)) } end |
#reset ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'lib/shopkit/configuration.rb', line 37 def reset self.adapter = DEFAULT_ADAPTER self.api_version = DEFAULT_API_VERSION self.access_token = nil self.login = nil self.password = nil self.user_agent = DEFAULT_USER_AGENT self.auto_traversal = DEFAULT_AUTO_TRAVERSAL self.per_page = DEFAULT_PER_PAGE end |