Class: Twitter::Config

Inherits:
Object
  • Object
show all
Includes:
ClassUtilMixin
Defined in:
lib/twitter/config.rb

Overview

Represents global configuration for Twitter::Client. Can override the following configuration options:

  • protocol - :http, :https or :ssl supported. :ssl is an alias for :https. Defaults to :ssl
  • host - hostname to connect to for the Twitter service. Defaults to 'twitter.com'.
  • port - port to connect to for the Twitter service. Defaults to 443.
  • path_prefix - path to prefix URIs of REST API calls. Defaults to "".
  • search_protocol - :http, :https or :ssl supported. :ssl is an alias for :https. Defaults to :ssl
  • search_host - hostname to connect to for the Twitter Search service. Defaults to 'twitter.com'.
  • search_port - port to connect to for the Twitter Search service. Defaults to 443.
  • search_path_prefix - path to prefix URIs of Search API calls. Defaults to "".
  • proxy_protocol - proxy protocol to use. Defaults to http.
  • proxy_host - proxy host to use. Defaults to nil.
  • proxy_port - proxy host to use. Defaults to 8080.
  • proxy_user - proxy username to use. Defaults to nil.
  • proxy_pass - proxy password to use. Defaults to nil.
  • user_agent - user agent string to use for each request of the HTTP header.
  • application_name - name of your client application. Defaults to 'Twitter4R'.
  • application_version - version of your client application. Defaults to current Twitter::Version.to_version.
  • application_url - URL of your client application. Defaults to http://twitter4r.rubyforge.org.
  • source - the source id given to you by Twitter to identify your application in their web interface. Note: you must contact Twitter.com developer directly so they can configure their servers appropriately.
  • timeout - the timeout in second for HTTP requests.
  • oauth_consumer_token - the OAuth consumer token for your application
  • oauth_consumer_secret - the OAuth consumer secret for your application
  • oauth_request_token_path - the URI path for Twitter API's OAuth request token call. Not usually necessary to override.
  • oauth_access_token_path - the URI path for Twitter API's OAuth access token call. Not usually necessary to override.
  • oauth_authorize_path - the URI path for Twitter API's OAuth authorize call. Not usually necessary to override.

Constant Summary collapse

@@ATTRIBUTES =
[
  :protocol, 
  :host, 
  :port, 
  :path_prefix,
  :search_protocol,
  :search_host,
  :search_port,
  :search_path_prefix,
  :proxy_protocol,
  :proxy_host, 
  :proxy_port, 
  :proxy_user, 
  :proxy_pass, 
  :user_agent,
  :application_name,
  :application_version,
  :application_url,
  :source,
  :timeout,
  :oauth_consumer_token,
  :oauth_consumer_secret,
  :oauth_request_token_path,
  :oauth_access_token_path,
  :oauth_authorize_path,
  :exception_registry,
]

Instance Method Summary collapse

Methods included from ClassUtilMixin

included

Instance Method Details

#eql?(other) ⇒ Boolean

Override of Object#eql? to ensure RSpec specifications run correctly. Also done to follow Ruby best practices.

Returns:

  • (Boolean)


65
66
67
68
69
70
71
# File 'lib/twitter/config.rb', line 65

def eql?(other)
  return true if self == other
  @@ATTRIBUTES.each do |att|
    return false unless self.send(att).eql?(other.send(att))
  end
  true
end