Class: Kuva::Authorizer
- Inherits:
-
Object
- Object
- Kuva::Authorizer
- Defined in:
- lib/kuva/authorizer.rb
Instance Attribute Summary collapse
-
#out ⇒ Object
readonly
Returns the value of attribute out.
Class Method Summary collapse
Instance Method Summary collapse
- #authorize ⇒ Object
-
#initialize ⇒ Authorizer
constructor
A new instance of Authorizer.
Constructor Details
#initialize ⇒ Authorizer
Returns a new instance of Authorizer.
10 11 12 13 |
# File 'lib/kuva/authorizer.rb', line 10 def initialize FlickRaw.api_key = Kuva.api_key FlickRaw.shared_secret = Kuva.shared_secret end |
Instance Attribute Details
#out ⇒ Object (readonly)
Returns the value of attribute out.
4 5 6 |
# File 'lib/kuva/authorizer.rb', line 4 def out @out end |
Class Method Details
.authorize ⇒ Object
6 7 8 |
# File 'lib/kuva/authorizer.rb', line 6 def self. new. end |
Instance Method Details
#authorize ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 |
# File 'lib/kuva/authorizer.rb', line 15 def puts I18n.t("kuva.authentication.url", url: authentication_url) puts I18n.t("kuva.authentication.code") begin flickr.get_access_token oauth_token, oauth_token_secret, puts I18n.t("kuva.authentication.success", account: flickr.test.login.username, api_key: Kuva.api_key, shared_secret: Kuva.shared_secret, access_token: flickr.access_token, access_secret: flickr.access_secret) rescue FlickRaw::OAuthClient::FailedResponse => error puts I18n.t("kuva.authentication.error", message: error) end end |