Module: WorldTimeEngine::Configurable
- Included in:
- WorldTimeEngine, Client
- Defined in:
- lib/worldtimeengine/configurable.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
writeonly
Sets the attribute api_key.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#timeout ⇒ Object
writeonly
Sets the attribute timeout.
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
3 4 5 |
# File 'lib/worldtimeengine/configurable.rb', line 3 def api_key=(value) @api_key = value end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
5 6 7 |
# File 'lib/worldtimeengine/configurable.rb', line 5 def endpoint @endpoint end |
#timeout=(value) ⇒ Object (writeonly)
Sets the attribute timeout
4 5 6 |
# File 'lib/worldtimeengine/configurable.rb', line 4 def timeout=(value) @timeout = value end |
Class Method Details
.keys ⇒ Object
9 10 11 12 13 14 15 |
# File 'lib/worldtimeengine/configurable.rb', line 9 def keys @keys ||= [ :api_key, :timeout, :endpoint ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block
20 21 22 23 |
# File 'lib/worldtimeengine/configurable.rb', line 20 def configure yield self self end |
#credentials? ⇒ Boolean
26 27 28 |
# File 'lib/worldtimeengine/configurable.rb', line 26 def credentials? credentials.values.all? end |
#reset! ⇒ Object Also known as: setup
30 31 32 33 34 35 |
# File 'lib/worldtimeengine/configurable.rb', line 30 def reset! @api_key = nil @endpoint = 'http://worldtimeengine.com' @timeout = 10 # seconds self end |