1 # config.rb contains classes, methods and extends existing Twitter4R classes
2 # to provide easy configuration facilities.
5 # Represents global configuration for Twitter::Client.
6 # Can override the following configuration options:
7 # * <tt>protocol</tt> - <tt>:http</tt>, <tt>:https</tt> or <tt>:ssl</tt> supported. <tt>:ssl</tt> is an alias for <tt>:https</tt>. Defaults to <tt>:ssl</tt>
8 # * <tt>host</tt> - hostname to connect to for the Twitter service. Defaults to <tt>'twitter.com'</tt>.
9 # * <tt>port</tt> - port to connect to for the Twitter service. Defaults to <tt>443</tt>.
10 # * <tt>proxy_host</tt> - proxy host to use. Defaults to nil.
11 # * <tt>proxy_port</tt> - proxy host to use. Defaults to nil.
12 # * <tt>proxy_user</tt> - proxy username to use. Defaults to nil.
13 # * <tt>proxy_pass</tt> - proxy password to use. Defaults to nil.
14 # * <tt>user_agent</tt> - user agent string to use for each request of the HTTP header.
15 # * <tt>application_name</tt> - name of your client application. Defaults to 'Twitter4R'
16 # * <tt>application_version</tt> - version of your client application. Defaults to current <tt>Twitter::Version.to_version</tt>.
17 # * <tt>application_url</tt> - URL of your client application. Defaults to http://twitter4r.rubyforge.org.
18 # * <tt>source</tt> - 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.
20 include ClassUtilMixin
38 attr_accessor *@@ATTRIBUTES
40 # Override of Object#eql? to ensure RSpec specifications run
41 # correctly. Also done to follow Ruby best practices.
43 return true if self == other
44 @@ATTRIBUTES.each do |att|
45 return false unless self.send(att).eql?(other.send(att))
52 @@defaults = { :host => 'twitter.com',
55 :search_host => 'search.twitter.com',
57 :search_protocol => :http,
60 :user_agent => "default",
61 :application_name => 'Twitter4R',
62 :application_version => Twitter::Version.to_version,
63 :application_url => 'http://twitter4r.rubyforge.org',
64 :source => 'twitter4r',
66 @@config = Twitter::Config.new(@@defaults)
68 # Twitter::Client class methods
70 # Yields to given <tt>block</tt> to configure the Twitter4R API.
72 raise ArgumentError, "Block must be provided to configure" unless block_given?