Class: Milkman::Authorizer
- Inherits:
-
Object
- Object
- Milkman::Authorizer
- Includes:
- Utility
- Defined in:
- lib/milkman/authorizer.rb
Instance Attribute Summary collapse
-
#options ⇒ Object
Returns the value of attribute options.
-
#shared_secret ⇒ Object
Returns the value of attribute shared_secret.
Class Method Summary collapse
Instance Method Summary collapse
- #authorize ⇒ Object
-
#initialize(attributes) ⇒ Authorizer
constructor
A new instance of Authorizer.
Methods included from Utility
#default_options, #encode, #format, #request_url, #sign
Constructor Details
#initialize(attributes) ⇒ Authorizer
Returns a new instance of Authorizer.
8 9 10 11 |
# File 'lib/milkman/authorizer.rb', line 8 def initialize(attributes) @shared_secret = attributes.delete(:shared_secret) @options = attributes.merge! end |
Instance Attribute Details
#options ⇒ Object
Returns the value of attribute options.
6 7 8 |
# File 'lib/milkman/authorizer.rb', line 6 def @options end |
#shared_secret ⇒ Object
Returns the value of attribute shared_secret.
6 7 8 |
# File 'lib/milkman/authorizer.rb', line 6 def shared_secret @shared_secret end |
Class Method Details
.authorize(options) ⇒ Object
13 14 15 |
# File 'lib/milkman/authorizer.rb', line 13 def self.() new(). end |
Instance Method Details
#authorize ⇒ Object
17 18 19 20 |
# File 'lib/milkman/authorizer.rb', line 17 def puts I18n.t("milkman.authorization.frob_message", url: ) puts I18n.t("milkman.authorization.auth_token_message", username: response["rsp"]["auth"]["user"]["username"], api_key: [:api_key], shared_secret: shared_secret, auth_token: response["rsp"]["auth"]["token"]) end |