Module: Ronnie::Configuration
- Included in:
- Ronnie
- Defined in:
- lib/ronnie/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :adapter, :faraday_config_block, :api_version, :api_endpoint, :web_endpoint, :proxy, :token, :token_secret, :consumer_key, :consumer_secret, :user_agent, :request_host, :auto_traversal, :per_page ].freeze
- DEFAULT_ADAPTER =
Faraday.default_adapter
- DEFAULT_API_VERSION =
1
- DEFAULT_API_ENDPOINT =
'http://api.rdio.com'
- DEFAULT_WEB_ENDPOINT =
'http://rdio.com'
- DEFAULT_USER_AGENT =
"Ronnie Ruby Gem #{Ronnie::VERSION}".freeze
- DEFAULT_AUTO_TRAVERSAL =
false
Class Method Summary collapse
Instance Method Summary collapse
- #api_endpoint=(value) ⇒ Object
- #configure {|_self| ... } ⇒ Object
- #faraday_config(&block) ⇒ Object
- #options ⇒ Object
- #reset ⇒ Object
- #web_endpoint=(value) ⇒ Object
Class Method Details
.extended(base) ⇒ Object
32 33 34 |
# File 'lib/ronnie/configuration.rb', line 32 def self.extended(base) base.reset end |
Instance Method Details
#api_endpoint=(value) ⇒ Object
44 45 46 |
# File 'lib/ronnie/configuration.rb', line 44 def api_endpoint=(value) @api_endpoint = File.join(value, '') end |
#configure {|_self| ... } ⇒ Object
36 37 38 |
# File 'lib/ronnie/configuration.rb', line 36 def configure yield self end |
#faraday_config(&block) ⇒ Object
52 53 54 |
# File 'lib/ronnie/configuration.rb', line 52 def faraday_config(&block) @faraday_config_block = block end |
#options ⇒ Object
40 41 42 |
# File 'lib/ronnie/configuration.rb', line 40 def VALID_OPTIONS_KEYS.inject({}){ |o,k| o.merge!(k => send(k)) } end |
#reset ⇒ Object
56 57 58 59 60 61 62 63 64 65 66 67 68 69 |
# File 'lib/ronnie/configuration.rb', line 56 def reset self.adapter = DEFAULT_ADAPTER self.api_version = DEFAULT_API_VERSION self.api_endpoint = DEFAULT_API_ENDPOINT self.web_endpoint = DEFAULT_WEB_ENDPOINT self.proxy = nil self.token = nil self.token_secret = nil self.consumer_key = nil self.consumer_secret = nil self.request_host = nil self.user_agent = DEFAULT_USER_AGENT self.auto_traversal = DEFAULT_AUTO_TRAVERSAL end |
#web_endpoint=(value) ⇒ Object
48 49 50 |
# File 'lib/ronnie/configuration.rb', line 48 def web_endpoint=(value) @web_endpoint = File.join(value, '') end |