Module: ContextIO::Config
- Included in:
- ContextIO
- Defined in:
- lib/context-io/config.rb
Overview
Defines constants and methods related to configuration
You shouldn't interact with this module directly, as it's included in the ContextIO module. Mostly you'll use the #configure method on ContextIO, see the example on #configure.
Constant Summary
- DEFAULT_ADAPTER =
The HTTP connection adapter that will be used to connect if none is set
:net_http- DEFAULT_CONNECTION_OPTIONS =
The Faraday connection options if none is set
{}
- DEFAULT_CONSUMER_KEY =
The consumer key if none is set
nil- DEFAULT_CONSUMER_SECRET =
The consumer secret if none is set
nil- DEFAULT_PROXY =
The proxy server if none is set
nil- DEFAULT_USER_AGENT =
The value of sent in the 'User-Agent' header if none is set
"context-io ruby gem #{ContextIO::VERSION}"- VALID_OPTIONS_KEYS =
The configuration options that are settable.
[ :adapter, :connection_options, :consumer_key, :consumer_secret, :proxy, :user_agent ]
Instance Attribute Summary (collapse)
-
- (Symbol) adapter
The HTTP connection adapter.
-
- (Hash) connection_options
Connection options passed to the Faraday connection object.
-
- (String) consumer_key
The OAuth consumer key received from Context.IO.
-
- (String) consumer_secret
The OAuth consumer secret received from Context.IO.
-
- (String, URI) proxy
The URI to the HTTP proxy to use.
-
- (String) user_agent
The value to be sent in the User-Agent header.
Class Method Summary (collapse)
-
+ (Object) extended(base)
private
Makes sure the default values are always set.
Instance Method Summary (collapse)
-
- (self) configure {|_self| ... }
Configure with a block.
-
- (void) reset
Reset the configuration to the default values.
Instance Attribute Details
- (Symbol) adapter
The HTTP connection adapter. Check the Faraday documentation for possible adapters.
42 43 44 |
# File 'lib/context-io/config.rb', line 42 def adapter @adapter end |
- (Hash) connection_options
Connection options passed to the Faraday connection object.
45 46 47 |
# File 'lib/context-io/config.rb', line 45 def @connection_options end |
- (String) consumer_key
The OAuth consumer key received from Context.IO.
48 49 50 |
# File 'lib/context-io/config.rb', line 48 def consumer_key @consumer_key end |
- (String) consumer_secret
The OAuth consumer secret received from Context.IO.
51 52 53 |
# File 'lib/context-io/config.rb', line 51 def consumer_secret @consumer_secret end |
- (String, URI) proxy
The URI to the HTTP proxy to use.
54 55 56 |
# File 'lib/context-io/config.rb', line 54 def proxy @proxy end |
- (String) user_agent
The value to be sent in the User-Agent header. Probably doesn't need to be changed unless you're writing a big app, or another library based on this one.
59 60 61 |
# File 'lib/context-io/config.rb', line 59 def user_agent @user_agent end |
Class Method Details
+ (Object) extended(base)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Makes sure the default values are always set
64 65 66 |
# File 'lib/context-io/config.rb', line 64 def self.extended(base) base.reset end |
Instance Method Details
- (self) configure {|_self| ... }
Configure with a block
79 80 81 82 |
# File 'lib/context-io/config.rb', line 79 def configure yield self self end |
- (void) reset
This method returns an undefined value.
Reset the configuration to the default values
94 95 96 97 98 99 100 101 |
# File 'lib/context-io/config.rb', line 94 def reset self.adapter = DEFAULT_ADAPTER self. = DEFAULT_CONNECTION_OPTIONS self.consumer_key = DEFAULT_CONSUMER_KEY self.consumer_secret = DEFAULT_CONSUMER_SECRET self.proxy = DEFAULT_PROXY self.user_agent = DEFAULT_USER_AGENT end |