lib/twitter/config.rb in twitter4r-0.5.0 vs lib/twitter/config.rb in twitter4r-0.5.1
- old
+ new
@@ -10,12 +10,13 @@
# * <tt>path_prefix</tt> - path to prefix URIs of REST API calls. Defaults to <tt>""</tt>.
# * <tt>search_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>
# * <tt>search_host</tt> - hostname to connect to for the Twitter Search service. Defaults to <tt>'twitter.com'</tt>.
# * <tt>search_port</tt> - port to connect to for the Twitter Search service. Defaults to <tt>443</tt>.
# * <tt>search_path_prefix</tt> - path to prefix URIs of Search API calls. Defaults to <tt>""</tt>.
+ # * <tt>proxy_protocol</tt> - proxy protocol to use. Defaults to http.
# * <tt>proxy_host</tt> - proxy host to use. Defaults to nil.
- # * <tt>proxy_port</tt> - proxy host to use. Defaults to nil.
+ # * <tt>proxy_port</tt> - proxy host to use. Defaults to 8080.
# * <tt>proxy_user</tt> - proxy username to use. Defaults to nil.
# * <tt>proxy_pass</tt> - proxy password to use. Defaults to nil.
# * <tt>user_agent</tt> - user agent string to use for each request of the HTTP header.
# * <tt>application_name</tt> - name of your client application. Defaults to 'Twitter4R'.
# * <tt>application_version</tt> - version of your client application. Defaults to current <tt>Twitter::Version.to_version</tt>.
@@ -36,10 +37,11 @@
:path_prefix,
:search_protocol,
:search_host,
:search_port,
:search_path_prefix,
+ :proxy_protocol,
:proxy_host,
:proxy_port,
:proxy_user,
:proxy_pass,
:user_agent,
@@ -75,12 +77,13 @@
:path_prefix => "",
:search_host => 'search.twitter.com',
:search_port => 80,
:search_protocol => :http,
:search_path_prefix => "",
+ :proxy_protocol => "http",
:proxy_host => nil,
- :proxy_port => nil,
+ :proxy_port => 8080,
:user_agent => "default",
:application_name => 'Twitter4R',
:application_version => Twitter::Version.to_version,
:application_url => 'http://twitter4r.rubyforge.org',
:source => 'twitter4r',
@@ -91,13 +94,18 @@
}
@@config = Twitter::Config.new(@@defaults)
# Twitter::Client class methods
class << self
+ # returns configuration object
+ def config
+ @@config
+ end
+
# Yields to given <tt>block</tt> to configure the Twitter4R API.
def configure(&block)
raise ArgumentError, "Block must be provided to configure" unless block_given?
- yield @@config
+ yield config
end # configure
end # class << self
end # Client class
end # Twitter module