Class: Yelpify::Authorization
- Inherits:
-
Object
- Object
- Yelpify::Authorization
- Defined in:
- lib/yelpify/authorization.rb
Instance Attribute Summary collapse
-
#access_token ⇒ Object
readonly
Returns the value of attribute access_token.
-
#credentials ⇒ Object
readonly
Returns the value of attribute credentials.
Instance Method Summary collapse
-
#initialize(oauth_creds) ⇒ Authorization
constructor
A new instance of Authorization.
Constructor Details
#initialize(oauth_creds) ⇒ Authorization
Returns a new instance of Authorization.
6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/yelpify/authorization.rb', line 6 def initialize(oauth_creds) @credentials = oauth_creds consumer_key = oauth_creds[:consumer_key] consumer_secret = oauth_creds[:consumer_secret] token = oauth_creds[:token] token_secret = oauth_creds[:token_secret] api_site = {:site => "http://api.yelp.com"} if oauth_creds.values.any? {|v| v.empty? } raise InvalidCredentials.new, "That was wrong" else consumer = OAuth::Consumer.new(consumer_key, consumer_secret, api_site) @access_token = OAuth::AccessToken.new(consumer, token, token_secret) end end |
Instance Attribute Details
#access_token ⇒ Object (readonly)
Returns the value of attribute access_token.
4 5 6 |
# File 'lib/yelpify/authorization.rb', line 4 def access_token @access_token end |
#credentials ⇒ Object (readonly)
Returns the value of attribute credentials.
4 5 6 |
# File 'lib/yelpify/authorization.rb', line 4 def credentials @credentials end |