Module: UserStream::Configuration

### Home Classes Methods

### In Files

- lib/user_stream/configuration.rb

### Methods

- ::extended
- #configure
- #options
- #reset

### Class/Module Index

Quicksearch

- UserStream
- UserStream::API
- UserStream::Client
- UserStream::Configuration
- UserStream::Error
- UserStream::Forbidden
- UserStream::NotAcceptable
- UserStream::RangeUnacceptable
- UserStream::RateLimited
- UserStream::ServerInternalError
- UserStream::ServiceOverloaded
- UserStream::TooLong
- UserStream::Unauhtorized
- UserStream::Unknown

No matching classes.

# UserStream::Configuration

Defines constants and methods related to configuration

### Constants

DEFAULT_CONSUMER_KEY

  By default, don't set a consumer key

DEFAULT_CONSUMER_SECRET

  By default, don't set a consumer secret

DEFAULT_ENDPOINT

  The endpoint that will be used to connect if none is set

  @note Specify a different API version, or use a Twitter-compatible endpoint. @see dev.twitter.com/docs/streaming-api/user-streams

DEFAULT_OAUTH_TOKEN

  By default, don't set an oauth token

DEFAULT_OAUTH_TOKEN_SECRET

  By default, don't set an oauth token secret

DEFAULT_TIMEOUT

  The timeout that will be to used to connect if none is set

  @see dev.twitter.com/docs/streaming-apis/connecting#Stalls

DEFAULT_USER_AGENT

  The user agent that will be sent to the API endpoint if none is set

OPTIONS_KEYS

  An array of keys in the options hash when configuring a {UserStream::API}

### Public Class Methods

extended(base) click to toggle source

When this module is extended, set all configuration options to their default values

    # File lib/user_stream/configuration.rb, line 46
    def self.extended(base)
      base.reset
    end

### Public Instance Methods

configure() click to toggle source

Convenience method to allow configuration options to be set in a block

    # File lib/user_stream/configuration.rb, line 51
    def configure
      yield self
      self
    end

options() click to toggle source

Create a hash of options and their values

    # File lib/user_stream/configuration.rb, line 57
    def options
      OPTIONS_KEYS.inject({}) do |options, key|
        options.merge!(key => send(key))
      end
    end

reset() click to toggle source

Reset all configuration options to defaults

    # File lib/user_stream/configuration.rb, line 64
    def reset
      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.endpoint           = DEFAULT_ENDPOINT
      self.user_agent         = DEFAULT_USER_AGENT
      self.timeout            = DEFAULT_TIMEOUT
      self
    end

[Validate]

Generated with the Darkfish Rdoc Generator 2.