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.
-
#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
-
#initialize ⇒ Configuration
constructor
Defaults go in here..
Constructor Details
#initialize ⇒ Configuration
Defaults go in here..
35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 |
# File 'lib/wordnik/configuration.rb', line 35 def initialize @response_format = 'json' @scheme = 'http' @host = 'api.wordnik.com' @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.
24 25 26 |
# File 'lib/wordnik/configuration.rb', line 24 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 |
#logger ⇒ Object
Returns the value of attribute logger.
32 33 34 |
# File 'lib/wordnik/configuration.rb', line 32 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.
28 29 30 |
# File 'lib/wordnik/configuration.rb', line 28 def proxy @proxy end |
#proxy_password ⇒ Object
Returns the value of attribute proxy_password.
30 31 32 |
# File 'lib/wordnik/configuration.rb', line 30 def proxy_password @proxy_password end |
#proxy_username ⇒ Object
Returns the value of attribute proxy_username.
29 30 31 |
# File 'lib/wordnik/configuration.rb', line 29 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.
26 27 28 |
# File 'lib/wordnik/configuration.rb', line 26 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
51 52 53 54 55 56 57 |
# File 'lib/wordnik/configuration.rb', line 51 def base_url Addressable::URI.new( :scheme => self.scheme, :host => self.host, :path => self.base_path ) end |