Module: OpenCalais::Configuration
- Included in:
- OpenCalais
- Defined in:
- lib/open_calais/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :api_key, :adapter, :endpoint, :user_agent ].freeze
- DEFAULT_API_KEY =
this you need to get from open calais - go register!
nil- DEFAULT_ADAPTER =
Adapters are whatever Faraday supports - I like excon alot, so I’m defaulting it
:excon- DEFAULT_ENDPOINT =
The api endpoint to get REST info from opencalais
'https://api-eit.refinitiv.com/permid/calais'.freeze
- DEFAULT_USER_AGENT =
The value sent in the http header for ‘User-Agent’ if none is set
"OpenCalais Ruby Gem #{OpenCalais::VERSION}".freeze
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
32 33 34 |
# File 'lib/open_calais/configuration.rb', line 32 def self.extended(base) base.reset! end |
.keys ⇒ Object
37 38 39 |
# File 'lib/open_calais/configuration.rb', line 37 def keys VALID_OPTIONS_KEYS end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow for global setting of configuration options
28 29 30 |
# File 'lib/open_calais/configuration.rb', line 28 def configure yield self end |
#options ⇒ Object
42 43 44 45 46 |
# File 'lib/open_calais/configuration.rb', line 42 def = {} VALID_OPTIONS_KEYS.each { |k| [k] = send(k) } end |
#reset! ⇒ Object
Reset configuration options to their defaults
49 50 51 52 53 54 55 |
# File 'lib/open_calais/configuration.rb', line 49 def reset! self.api_key = DEFAULT_API_KEY self.adapter = DEFAULT_ADAPTER self.endpoint = DEFAULT_ENDPOINT self.user_agent = DEFAULT_USER_AGENT self end |