Class: RDStation::Authentication
- Inherits:
-
Object
- Object
- RDStation::Authentication
- Includes:
- HTTParty
- Defined in:
- lib/rdstation/authentication.rb
Instance Method Summary collapse
-
#auth_url(redirect_url) ⇒ Object
param redirect_url URL that the user will be redirected after confirming application authorization.
-
#authenticate(code) ⇒ Object
param code parameter sent by RDStation after user confirms authorization.
-
#initialize(client_id, client_secret) ⇒ Authentication
constructor
A new instance of Authentication.
-
#update_access_token(refresh_token) ⇒ Object
param refresh_token parameter sent by RDStation after authenticate.
Constructor Details
#initialize(client_id, client_secret) ⇒ Authentication
Returns a new instance of Authentication.
6 7 8 9 |
# File 'lib/rdstation/authentication.rb', line 6 def initialize(client_id, client_secret) @client_id = client_id @client_secret = client_secret end |
Instance Method Details
#auth_url(redirect_url) ⇒ Object
param redirect_url
URL that the user will be redirected
after confirming application
16 17 18 |
# File 'lib/rdstation/authentication.rb', line 16 def auth_url(redirect_url) "https://api.rd.services/auth/dialog?client_id=#{@client_id}&redirect_url=#{redirect_url}" end |
#authenticate(code) ⇒ Object
param code
parameter sent by RDStation after user confirms
24 25 26 |
# File 'lib/rdstation/authentication.rb', line 24 def authenticate(code) post_to_auth_endpoint({ :code => code }) end |
#update_access_token(refresh_token) ⇒ Object
param refresh_token
parameter sent by RDStation after authenticate
32 33 34 |
# File 'lib/rdstation/authentication.rb', line 32 def update_access_token(refresh_token) post_to_auth_endpoint({ :refresh_token => refresh_token }) end |