Module: Imagga::Categorization::Configuration
- Included in:
- Imagga::Categorization
- Defined in:
- lib/imagga/categorization/configuration.rb
Constant Summary collapse
- VALID_CONNECTION_KEYS =
[:endpoint, :user_agent].freeze
- VALID_OPTIONS_KEYS =
[:api_key].freeze
- VALID_CONFIG_KEYS =
VALID_CONNECTION_KEYS + VALID_OPTIONS_KEYS
- DEFAULT_ENDPOINT =
'http://api.imagga.com/'
- DEFAULT_USER_AGENT =
"Imagga Categorization API ruby Gem #{Categorization::VERSION}".freeze
- DEFAULT_APP_KEY =
nil
Class Method Summary collapse
-
.extended(base) ⇒ Object
Make sure we have the default values set when we get ‘extended’.
Instance Method Summary collapse
Class Method Details
.extended(base) ⇒ Object
Make sure we have the default values set when we get ‘extended’
16 17 18 |
# File 'lib/imagga/categorization/configuration.rb', line 16 def self.extended(base) base.reset end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
27 28 29 |
# File 'lib/imagga/categorization/configuration.rb', line 27 def configure yield self end |
#options ⇒ Object
31 32 33 |
# File 'lib/imagga/categorization/configuration.rb', line 31 def Hash[ * VALID_CONFIG_KEYS.map { |key| [key, send(key)] }.flatten ] end |
#reset ⇒ Object
20 21 22 23 24 25 |
# File 'lib/imagga/categorization/configuration.rb', line 20 def reset self.endpoint = DEFAULT_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self.api_key = DEFAULT_APP_KEY end |