Class: ChaskiqRubyClient::Auth
- Inherits:
-
Object
- Object
- ChaskiqRubyClient::Auth
- Defined in:
- lib/chaskiqRubyClient/auth.rb
Instance Attribute Summary collapse
-
#secret ⇒ Object
Returns the value of attribute secret.
-
#site ⇒ Object
Returns the value of attribute site.
-
#uid ⇒ Object
Returns the value of attribute uid.
Instance Method Summary collapse
- #authorize_url ⇒ Object
- #get_token(user, password) ⇒ Object
-
#initialize(uid:, secret:, site:) ⇒ Auth
constructor
A new instance of Auth.
Constructor Details
#initialize(uid:, secret:, site:) ⇒ Auth
Returns a new instance of Auth.
7 8 9 10 11 |
# File 'lib/chaskiqRubyClient/auth.rb', line 7 def initialize(uid:, secret:, site:) self.uid = uid self.secret = secret self.site = site end |
Instance Attribute Details
#secret ⇒ Object
Returns the value of attribute secret.
5 6 7 |
# File 'lib/chaskiqRubyClient/auth.rb', line 5 def secret @secret end |
#site ⇒ Object
Returns the value of attribute site.
5 6 7 |
# File 'lib/chaskiqRubyClient/auth.rb', line 5 def site @site end |
#uid ⇒ Object
Returns the value of attribute uid.
5 6 7 |
# File 'lib/chaskiqRubyClient/auth.rb', line 5 def uid @uid end |
Instance Method Details
#authorize_url ⇒ Object
21 22 23 24 25 26 27 28 |
# File 'lib/chaskiqRubyClient/auth.rb', line 21 def client = OAuth2::Client.new(uid, secret, site: site) client.( redirect_uri: site , client_id: uid, response_type: "code" ) end |
#get_token(user, password) ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/chaskiqRubyClient/auth.rb', line 13 def get_token(user, password) client = OAuth2::Client.new(uid, secret, site: site) access_token = client.password.get_token( user, password ).token end |