Module: Twitter::Configurable
Instance Attribute Summary collapse
-
#connection_options ⇒ Object
Returns the value of attribute connection_options.
-
#consumer_key ⇒ Object
writeonly
Sets the attribute consumer_key.
-
#consumer_secret ⇒ Object
writeonly
Sets the attribute consumer_secret.
-
#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.
-
#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
-
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block.
- #credentials? ⇒ Boolean
- #reset! ⇒ Object (also: #setup)
Instance Attribute Details
#connection_options ⇒ Object
Returns the value of attribute connection_options.
8 9 10 |
# File 'lib/twitter/configurable.rb', line 8 def @connection_options end |
#consumer_key=(value) ⇒ Object (writeonly)
Sets the attribute consumer_key
7 8 9 |
# File 'lib/twitter/configurable.rb', line 7 def consumer_key=(value) @consumer_key = value end |
#consumer_secret=(value) ⇒ Object (writeonly)
Sets the attribute consumer_secret
7 8 9 |
# File 'lib/twitter/configurable.rb', line 7 def consumer_secret=(value) @consumer_secret = value end |
#endpoint ⇒ Object
Returns the value of attribute endpoint.
8 9 10 |
# File 'lib/twitter/configurable.rb', line 8 def endpoint @endpoint end |
#identity_map ⇒ Object
Returns the value of attribute identity_map.
8 9 10 |
# File 'lib/twitter/configurable.rb', line 8 def identity_map @identity_map end |
#middleware ⇒ Object
Returns the value of attribute middleware.
8 9 10 |
# File 'lib/twitter/configurable.rb', line 8 def middleware @middleware end |
#oauth_token=(value) ⇒ Object (writeonly)
Sets the attribute oauth_token
7 8 9 |
# File 'lib/twitter/configurable.rb', line 7 def oauth_token=(value) @oauth_token = value end |
#oauth_token_secret=(value) ⇒ Object (writeonly)
Sets the attribute oauth_token_secret
7 8 9 |
# File 'lib/twitter/configurable.rb', line 7 def oauth_token_secret=(value) @oauth_token_secret = value end |
Class Method Details
.keys ⇒ Object
13 14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/twitter/configurable.rb', line 13 def keys @keys ||= [ :consumer_key, :consumer_secret, :oauth_token, :oauth_token_secret, :endpoint, :connection_options, :identity_map, :middleware, ] end |
Instance Method Details
#configure {|_self| ... } ⇒ Object
Convenience method to allow configuration options to be set in a block
32 33 34 35 36 |
# File 'lib/twitter/configurable.rb', line 32 def configure yield self validate_credential_type! self end |
#credentials? ⇒ Boolean
39 40 41 |
# File 'lib/twitter/configurable.rb', line 39 def credentials? credentials.values.all? end |
#reset! ⇒ Object Also known as: setup
43 44 45 46 47 48 |
# File 'lib/twitter/configurable.rb', line 43 def reset! Twitter::Configurable.keys.each do |key| instance_variable_set(:"@#{key}", Twitter::Default.[key]) end self end |