Module: Tradier::Configurable
Instance Attribute Summary collapse
-
#access_token ⇒ Object
writeonly
Sets the attribute access_token.
-
#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.
-
#version ⇒ Object
Returns the value of attribute version.
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
#access_token=(value) ⇒ Object (writeonly)
Sets the attribute access_token
7 8 9 |
# File 'lib/tradier/configurable.rb', line 7 def access_token=(value) @access_token = value end |
#connection_options ⇒ Object
Returns the value of attribute connection_options.
8 9 10 |
# File 'lib/tradier/configurable.rb', line 8 def @connection_options end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
8 9 10 |
# File 'lib/tradier/configurable.rb', line 8 def endpoint @endpoint end |
#middleware ⇒ Object
Returns the value of attribute middleware.
8 9 10 |
# File 'lib/tradier/configurable.rb', line 8 def middleware @middleware end |
#version ⇒ Object
Returns the value of attribute version.
8 9 10 |
# File 'lib/tradier/configurable.rb', line 8 def version @version end |
Class Method Details
.keys ⇒ Object
13 14 15 16 17 18 19 20 21 |
# File 'lib/tradier/configurable.rb', line 13 def keys @keys ||= [ :access_token, :endpoint, :version, :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/tradier/configurable.rb', line 29 def configure yield self validate_credentials! self end |
#credentials? ⇒ Boolean
36 37 38 |
# File 'lib/tradier/configurable.rb', line 36 def credentials? credentials.values.all? end |
#reset! ⇒ Object Also known as: setup
40 41 42 43 44 45 |
# File 'lib/tradier/configurable.rb', line 40 def reset! Tradier::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Tradier::Default.[key]) end self end |