Module: Hackeroo::Configurable
Instance Attribute Summary collapse
-
#clientkey ⇒ Object
Returns the value of attribute clientkey.
-
#connection_options ⇒ Object
Returns the value of attribute connection_options.
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#identity_map ⇒ Object
Returns the value of attribute identity_map.
-
#middleware ⇒ Object
Returns the value of attribute middleware.
Class Method Summary collapse
Instance Method Summary collapse
- #bearer_token? ⇒ Boolean
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block.
- #credentials? ⇒ Boolean
- #reset! ⇒ Object (also: #setup)
- #user_token? ⇒ Boolean
Instance Attribute Details
#clientkey ⇒ Object
Returns the value of attribute clientkey.
7 8 9 |
# File 'lib/hackeroo/configurable.rb', line 7 def clientkey @clientkey end |
#connection_options ⇒ Object
Returns the value of attribute connection_options.
7 8 9 |
# File 'lib/hackeroo/configurable.rb', line 7 def @connection_options end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
7 8 9 |
# File 'lib/hackeroo/configurable.rb', line 7 def endpoint @endpoint end |
#identity_map ⇒ Object
Returns the value of attribute identity_map.
7 8 9 |
# File 'lib/hackeroo/configurable.rb', line 7 def identity_map @identity_map end |
#middleware ⇒ Object
Returns the value of attribute middleware.
7 8 9 |
# File 'lib/hackeroo/configurable.rb', line 7 def middleware @middleware end |
Class Method Details
.keys ⇒ Object
12 13 14 15 16 17 18 19 20 |
# File 'lib/hackeroo/configurable.rb', line 12 def keys @keys ||= [ :clientkey, :endpoint, :connection_options, :identity_map, :middleware, ] end |
Instance Method Details
#bearer_token? ⇒ Boolean
48 49 50 |
# File 'lib/hackeroo/configurable.rb', line 48 def bearer_token? !!@bearer_token end |
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block
28 29 30 31 32 |
# File 'lib/hackeroo/configurable.rb', line 28 def configure yield self validate_credential_type! self end |
#credentials? ⇒ Boolean
53 54 55 |
# File 'lib/hackeroo/configurable.rb', line 53 def credentials? credentials.values.all? || bearer_token? end |
#reset! ⇒ Object Also known as: setup
34 35 36 37 38 39 |
# File 'lib/hackeroo/configurable.rb', line 34 def reset! Hackeroo::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Hackeroo::Default.[key]) end self end |
#user_token? ⇒ Boolean
43 44 45 |
# File 'lib/hackeroo/configurable.rb', line 43 def user_token? !!(@oauth_token && @oauth_token_secret) end |