Module: Croudia::Configurable
Instance Attribute Summary collapse
-
#access_token ⇒ Object
writeonly
Sets the attribute access_token.
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_secret ⇒ Object
writeonly
Sets the attribute client_secret.
-
#connection_options ⇒ Object
Returns the value of attribute connection_options.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#middleware ⇒ Object
Returns the value of attribute middleware.
Class Method Summary collapse
Instance Method Summary collapse
- #configure {|_self| ... } ⇒ Object
- #options ⇒ Object
- #reset! ⇒ Object (also: #setup)
Instance Attribute Details
#access_token=(value) ⇒ Object (writeonly)
Sets the attribute access_token
5 6 7 |
# File 'lib/croudia/configurable.rb', line 5 def access_token=(value) @access_token = value end |
#client_id ⇒ Object
Returns the value of attribute client_id.
6 7 8 |
# File 'lib/croudia/configurable.rb', line 6 def client_id @client_id end |
#client_secret=(value) ⇒ Object (writeonly)
Sets the attribute client_secret
5 6 7 |
# File 'lib/croudia/configurable.rb', line 5 def client_secret=(value) @client_secret = value end |
#connection_options ⇒ Object
Returns the value of attribute connection_options.
6 7 8 |
# File 'lib/croudia/configurable.rb', line 6 def @connection_options end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
6 7 8 |
# File 'lib/croudia/configurable.rb', line 6 def endpoint @endpoint end |
#middleware ⇒ Object
Returns the value of attribute middleware.
6 7 8 |
# File 'lib/croudia/configurable.rb', line 6 def middleware @middleware end |
Class Method Details
.keys ⇒ Object
9 10 11 12 13 14 15 16 17 18 |
# File 'lib/croudia/configurable.rb', line 9 def keys @keys ||= [ :endpoint, :connection_options, :middleware, :client_id, :client_secret, :access_token, ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
21 22 23 24 |
# File 'lib/croudia/configurable.rb', line 21 def configure yield self self end |
#options ⇒ Object
33 34 35 36 37 |
# File 'lib/croudia/configurable.rb', line 33 def Hash[Croudia::Configurable.keys.map do |key| [key, instance_variable_get(:"@#{key}")] end] end |
#reset! ⇒ Object Also known as: setup
26 27 28 29 30 |
# File 'lib/croudia/configurable.rb', line 26 def reset! Croudia::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Croudia::Default.[key]) end end |