module TweetStream::Configuration
Defines constants and methods related to configuration
Constants
- DEFAULT_AUTH_METHOD
The default authentication method
- DEFAULT_CONSUMER_KEY
By default, don't set an application key
- DEFAULT_CONSUMER_SECRET
By default, don't set an application secret
- DEFAULT_OAUTH_TOKEN
By default, don't set a user oauth token
- DEFAULT_OAUTH_TOKEN_SECRET
By default, don't set a user oauth secret
- DEFAULT_PASSWORD
By default, don't set a password
- DEFAULT_PROXY
- DEFAULT_USERNAME
By default, don't set a username
- DEFAULT_USER_AGENT
The user agent that will be sent to the API endpoint if none is set
- OAUTH_OPTIONS_KEYS
- VALID_FORMATS
- VALID_OPTIONS_KEYS
An array of valid keys in the options hash when configuring
TweetStream
.
Public Class Methods
extended(base)
click to toggle source
When this module is extended, set all configuration options to their default values
# File lib/tweetstream/configuration.rb, line 59 def self.extended(base) base.reset end
Public Instance Methods
configure() { |self| ... }
click to toggle source
Convenience method to allow configuration options to be set in a block
# File lib/tweetstream/configuration.rb, line 64 def configure yield self end
oauth_options()
click to toggle source
Create a hash of options and their values
# File lib/tweetstream/configuration.rb, line 74 def oauth_options Hash[*OAUTH_OPTIONS_KEYS.collect { |key| [key, send(key)] }.flatten] end
options()
click to toggle source
Create a hash of options and their values
# File lib/tweetstream/configuration.rb, line 69 def options Hash[*VALID_OPTIONS_KEYS.collect { |key| [key, send(key)] }.flatten] end
reset()
click to toggle source
Reset all configuration options to defaults
# File lib/tweetstream/configuration.rb, line 79 def reset self.username = DEFAULT_USERNAME self.password = DEFAULT_PASSWORD self.user_agent = DEFAULT_USER_AGENT self.auth_method = DEFAULT_AUTH_METHOD self.proxy = DEFAULT_PROXY self.consumer_key = DEFAULT_CONSUMER_KEY self.consumer_secret = DEFAULT_CONSUMER_SECRET self.oauth_token = DEFAULT_OAUTH_TOKEN self.oauth_token_secret = DEFAULT_OAUTH_TOKEN_SECRET self end