Module: YahooContentAnalysis::Configuration
- Included in:
- YahooContentAnalysis
- Defined in:
- lib/yahoo_content_analysis/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :api_key, :api_secret, :adapter, :endpoint, :user_agent, :format, :max, :related_entities, :show_metadata, :enable_categorizer, :unique ].freeze
- VALID_PARAMS =
[ :format, :max, :related_entities, :show_metadata, :enable_categorizer, :unique ]
- DEFAULT_API_KEY =
this you need to get from yahoo - go register an app!
nil
- DEFAULT_API_SECRET =
nil
- DEFAULT_ADAPTER =
Adapters are whatever Faraday supports - I like excon alot, so I’m defaulting it
:excon
- DEFAULT_ENDPOINT =
The api endpoint for YQL
'http://query.yahooapis.com/v1/public/yql'.freeze
- DEFAULT_USER_AGENT =
The value sent in the http header for ‘User-Agent’ if none is set
"YahooContentAnalysis Ruby Gem #{YahooContentAnalysis::VERSION}".freeze
- DEFAULT_FORMAT =
:json
- DEFAULT_MAX =
50
- DEFAULT_RELATED_ENTITIES =
'true'
- DEFAULT_SHOW_METADATA =
'true'
- DEFAULT_ENABLE_CATEGORIZER =
'true'
- DEFAULT_UNIQUE =
'true'
Class Method Summary collapse
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow for global setting of configuration options.
- #options ⇒ Object
-
#reset! ⇒ Object
Reset configuration options to their defaults.
Class Method Details
.extended(base) ⇒ Object
70 71 72 |
# File 'lib/yahoo_content_analysis/configuration.rb', line 70 def self.extended(base) base.reset! end |
.keys ⇒ Object
75 76 77 |
# File 'lib/yahoo_content_analysis/configuration.rb', line 75 def keys VALID_OPTIONS_KEYS end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow for global setting of configuration options
66 67 68 |
# File 'lib/yahoo_content_analysis/configuration.rb', line 66 def configure yield self end |
#options ⇒ Object
80 81 82 83 84 |
# File 'lib/yahoo_content_analysis/configuration.rb', line 80 def = {} VALID_OPTIONS_KEYS.each { |k| [k] = send(k) } end |
#reset! ⇒ Object
Reset configuration options to their defaults
87 88 89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/yahoo_content_analysis/configuration.rb', line 87 def reset! self.api_key = DEFAULT_API_KEY self.api_secret = DEFAULT_API_SECRET self.adapter = DEFAULT_ADAPTER self.endpoint = DEFAULT_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self.format = DEFAULT_FORMAT self.max = DEFAULT_MAX self. = DEFAULT_RELATED_ENTITIES self. = DEFAULT_SHOW_METADATA self.enable_categorizer = DEFAULT_ENABLE_CATEGORIZER self.unique = DEFAULT_UNIQUE self end |