Class: Wordnik::Configuration
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Wordnik credentials.
-
#auth_token ⇒ Object
TODO: Steal all the auth stuff from the old gem!.
-
#base_path ⇒ Object
Returns the value of attribute base_path.
-
#host ⇒ Object
Returns the value of attribute host.
-
#hosts ⇒ Object
to do in process load balancing.
-
#load_balancer ⇒ Object
Returns the value of attribute load_balancer.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#password ⇒ Object
Returns the value of attribute password.
-
#proxy ⇒ Object
Returns the value of attribute proxy.
-
#proxy_password ⇒ Object
Returns the value of attribute proxy_password.
-
#proxy_username ⇒ Object
Returns the value of attribute proxy_username.
-
#resource_names ⇒ Object
A comma-delimited list of the API’s resources.
-
#response_format ⇒ Object
Response format can be ‘json’ (default) or ‘xml’.
-
#scheme ⇒ Object
The URL of the API server.
-
#user_agent ⇒ Object
Returns the value of attribute user_agent.
-
#user_id ⇒ Object
Returns the value of attribute user_id.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
- #base_url ⇒ Object
- #clear ⇒ Object
-
#initialize ⇒ Configuration
constructor
Defaults go in here..
Constructor Details
#initialize ⇒ Configuration
Defaults go in here..
37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/wordnik/configuration.rb', line 37 def initialize @response_format = 'json' @scheme = 'http' @host = 'api.wordnik.com' @hosts = [] @load_balancer = nil @base_path = '/v4' @user_agent = "ruby-#{Wordnik::VERSION}" # Build the default set of resource names from the filenames of the API documentation begin api_docs_path = File.join(File.dirname(__FILE__), "../../api_docs") @resource_names = `find #{api_docs_path} -name '*.json'`.split("\n").map {|f| f.split("/").last.sub('.json', '') }.sort true rescue raise "Problem loading the resource files in ./api_docs/" end end |
Instance Attribute Details
#api_key ⇒ Object
Wordnik credentials
7 8 9 |
# File 'lib/wordnik/configuration.rb', line 7 def api_key @api_key end |
#auth_token ⇒ Object
TODO: Steal all the auth stuff from the old gem!
12 13 14 |
# File 'lib/wordnik/configuration.rb', line 12 def auth_token @auth_token end |
#base_path ⇒ Object
Returns the value of attribute base_path.
26 27 28 |
# File 'lib/wordnik/configuration.rb', line 26 def base_path @base_path end |
#host ⇒ Object
Returns the value of attribute host.
23 24 25 |
# File 'lib/wordnik/configuration.rb', line 23 def host @host end |
#hosts ⇒ Object
to do in process load balancing
24 25 26 |
# File 'lib/wordnik/configuration.rb', line 24 def hosts @hosts end |
#load_balancer ⇒ Object
Returns the value of attribute load_balancer.
25 26 27 |
# File 'lib/wordnik/configuration.rb', line 25 def load_balancer @load_balancer end |
#logger ⇒ Object
Returns the value of attribute logger.
34 35 36 |
# File 'lib/wordnik/configuration.rb', line 34 def logger @logger end |
#password ⇒ Object
Returns the value of attribute password.
9 10 11 |
# File 'lib/wordnik/configuration.rb', line 9 def password @password end |
#proxy ⇒ Object
Returns the value of attribute proxy.
30 31 32 |
# File 'lib/wordnik/configuration.rb', line 30 def proxy @proxy end |
#proxy_password ⇒ Object
Returns the value of attribute proxy_password.
32 33 34 |
# File 'lib/wordnik/configuration.rb', line 32 def proxy_password @proxy_password end |
#proxy_username ⇒ Object
Returns the value of attribute proxy_username.
31 32 33 |
# File 'lib/wordnik/configuration.rb', line 31 def proxy_username @proxy_username end |
#resource_names ⇒ Object
A comma-delimited list of the API’s resources
19 20 21 |
# File 'lib/wordnik/configuration.rb', line 19 def resource_names @resource_names end |
#response_format ⇒ Object
Response format can be ‘json’ (default) or ‘xml’
16 17 18 |
# File 'lib/wordnik/configuration.rb', line 16 def response_format @response_format end |
#scheme ⇒ Object
The URL of the API server
22 23 24 |
# File 'lib/wordnik/configuration.rb', line 22 def scheme @scheme end |
#user_agent ⇒ Object
Returns the value of attribute user_agent.
28 29 30 |
# File 'lib/wordnik/configuration.rb', line 28 def user_agent @user_agent end |
#user_id ⇒ Object
Returns the value of attribute user_id.
13 14 15 |
# File 'lib/wordnik/configuration.rb', line 13 def user_id @user_id end |
#username ⇒ Object
Returns the value of attribute username.
8 9 10 |
# File 'lib/wordnik/configuration.rb', line 8 def username @username end |
Instance Method Details
#base_url ⇒ Object
55 56 57 58 59 60 61 |
# File 'lib/wordnik/configuration.rb', line 55 def base_url Addressable::URI.new( :scheme => self.scheme, :host => self.host, :path => self.base_path ) end |
#clear ⇒ Object
63 64 65 |
# File 'lib/wordnik/configuration.rb', line 63 def clear initialize end |