Module: Echowrap::Configurable
Instance Attribute Summary collapse
-
#api_key ⇒ Object
writeonly
Sets the attribute api_key.
-
#connection_options ⇒ Object
Returns the value of attribute connection_options.
-
#consumer_key ⇒ Object
writeonly
Sets the attribute consumer_key.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#middleware ⇒ Object
Returns the value of attribute middleware.
-
#shared_secret ⇒ Object
writeonly
Sets the attribute shared_secret.
Class Method Summary collapse
Instance Method Summary collapse
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block.
- #credentials? ⇒ Boolean
- #reset! ⇒ Object (also: #setup)
Instance Attribute Details
#api_key=(value) ⇒ Object (writeonly)
Sets the attribute api_key
8 9 10 |
# File 'lib/echowrap/configurable.rb', line 8 def api_key=(value) @api_key = value end |
#connection_options ⇒ Object
Returns the value of attribute connection_options.
9 10 11 |
# File 'lib/echowrap/configurable.rb', line 9 def @connection_options end |
#consumer_key=(value) ⇒ Object (writeonly)
Sets the attribute consumer_key
8 9 10 |
# File 'lib/echowrap/configurable.rb', line 8 def consumer_key=(value) @consumer_key = value end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
9 10 11 |
# File 'lib/echowrap/configurable.rb', line 9 def endpoint @endpoint end |
#middleware ⇒ Object
Returns the value of attribute middleware.
9 10 11 |
# File 'lib/echowrap/configurable.rb', line 9 def middleware @middleware end |
#shared_secret=(value) ⇒ Object (writeonly)
Sets the attribute shared_secret
8 9 10 |
# File 'lib/echowrap/configurable.rb', line 8 def shared_secret=(value) @shared_secret = value end |
Class Method Details
.keys ⇒ Object
13 14 15 16 17 18 19 20 21 22 |
# File 'lib/echowrap/configurable.rb', line 13 def keys @keys ||= [ :api_key, :consumer_key, :shared_secret, :endpoint, :connection_options, :middleware, ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block
29 30 31 32 33 |
# File 'lib/echowrap/configurable.rb', line 29 def configure yield self validate_credential_type! self end |
#credentials? ⇒ Boolean
36 37 38 |
# File 'lib/echowrap/configurable.rb', line 36 def credentials? credentials.values.all? end |
#reset! ⇒ Object Also known as: setup
40 41 42 43 44 45 |
# File 'lib/echowrap/configurable.rb', line 40 def reset! Echowrap::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Echowrap::Default.[key]) end self end |