Module: Lelylan::Configuration
- Included in:
- Lelylan
- Defined in:
- lib/lelylan/configuration.rb
Constant Summary collapse
- VALID_OPTIONS_KEYS =
[ :adapter, :api_version, :api_endpoint, :web_endpoint, :endpoint, :client_id, :client_secret, :proxy, :token, :user_agent, :auto_traversal, :per_page].freeze
- DEFAULT_ADAPTER =
Faraday.default_adapter
- DEFAULT_API_VERSION =
0
- DEFAULT_API_ENDPOINT =
'http://api.lelylan.com/'
- DEFAULT_WEB_ENDPOINT =
'http://lelylan.com/'
- DEFAULT_USER_AGENT =
"Lelylan Ruby Gem #{Lelylan::Version}".freeze
- DEFAULT_AUTO_TRAVERSAL =
false
Class Method Summary collapse
Instance Method Summary collapse
- #api_endpoint=(value) ⇒ Object (also: #endpoint=)
- #configure {|_self| ... } ⇒ Object
- #options ⇒ Object
- #reset ⇒ Object
- #web_endpoint=(value) ⇒ Object
Class Method Details
.extended(base) ⇒ Object
29 30 31 |
# File 'lib/lelylan/configuration.rb', line 29 def self.extended(base) base.reset end |
Instance Method Details
#api_endpoint=(value) ⇒ Object Also known as: endpoint=
41 42 43 |
# File 'lib/lelylan/configuration.rb', line 41 def api_endpoint=(value) @api_endpoint = File.join(value, "") end |
#configure {|_self| ... } ⇒ Object
33 34 35 |
# File 'lib/lelylan/configuration.rb', line 33 def configure yield self end |
#options ⇒ Object
37 38 39 |
# File 'lib/lelylan/configuration.rb', line 37 def VALID_OPTIONS_KEYS.inject({}){|o,k| o.merge!(k => send(k)) } end |
#reset ⇒ Object
52 53 54 55 56 57 58 59 60 61 62 63 |
# File 'lib/lelylan/configuration.rb', line 52 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.client_id = nil self.client_secret = nil self.proxy = nil self.token = nil self.user_agent = DEFAULT_USER_AGENT self.auto_traversal = DEFAULT_AUTO_TRAVERSAL end |
#web_endpoint=(value) ⇒ Object
45 46 47 |
# File 'lib/lelylan/configuration.rb', line 45 def web_endpoint=(value) @web_endpoint = File.join(value, "") end |