Module: Plurky::Configurable
Instance Attribute Summary collapse
-
#consumer_key ⇒ Object
writeonly
Sets the attribute consumer_key.
-
#consumer_secret ⇒ Object
writeonly
Sets the attribute consumer_secret.
-
#oauth_token ⇒ Object
writeonly
Sets the attribute oauth_token.
-
#oauth_token_secret ⇒ Object
writeonly
Sets the attribute oauth_token_secret.
Class Method Summary collapse
Instance Method Summary collapse
- #cache_key ⇒ Fixnum
-
#configure {|_self| ... } ⇒ Object
Allow configuration options to be set in a block.
- #credentials? ⇒ Boolean
- #reset! ⇒ Object (also: #setup)
Instance Attribute Details
#consumer_key=(value) ⇒ Object (writeonly)
Sets the attribute consumer_key
5 6 7 |
# File 'lib/plurky/configurable.rb', line 5 def consumer_key=(value) @consumer_key = value end |
#consumer_secret=(value) ⇒ Object (writeonly)
Sets the attribute consumer_secret
5 6 7 |
# File 'lib/plurky/configurable.rb', line 5 def consumer_secret=(value) @consumer_secret = value end |
#oauth_token=(value) ⇒ Object (writeonly)
Sets the attribute oauth_token
5 6 7 |
# File 'lib/plurky/configurable.rb', line 5 def oauth_token=(value) @oauth_token = value end |
#oauth_token_secret=(value) ⇒ Object (writeonly)
Sets the attribute oauth_token_secret
5 6 7 |
# File 'lib/plurky/configurable.rb', line 5 def oauth_token_secret=(value) @oauth_token_secret = value end |
Class Method Details
.keys ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 |
# File 'lib/plurky/configurable.rb', line 8 def keys @keys ||= [ :consumer_key, :consumer_secret, :oauth_token, :oauth_token_secret, :endpoint, :connection_options, :middleware ] end |
Instance Method Details
#cache_key ⇒ Fixnum
33 34 35 |
# File 'lib/plurky/configurable.rb', line 33 def cache_key .hash end |
#configure {|_self| ... } ⇒ Object
Allow configuration options to be set in a block
22 23 24 25 |
# File 'lib/plurky/configurable.rb', line 22 def configure yield self self end |
#credentials? ⇒ Boolean
28 29 30 |
# File 'lib/plurky/configurable.rb', line 28 def credentials? credentials.values.all? end |
#reset! ⇒ Object Also known as: setup
37 38 39 40 41 42 |
# File 'lib/plurky/configurable.rb', line 37 def reset! Plurky::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Plurky::Default.[key]) end self end |