Class: VoiceNotes::Resources::Auth
- Defined in:
- lib/voice_notes/resources/auth.rb
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#login(email:, password:) ⇒ Hash
Login with email and password.
-
#logout ⇒ Hash?
Logout and invalidate the current session.
-
#me ⇒ Hash
Get current authenticated user.
-
#refresh(refresh_token:) ⇒ Hash
Refresh access token using refresh token.
Methods inherited from Base
Constructor Details
This class inherits a constructor from VoiceNotes::Resources::Base
Instance Method Details
#login(email:, password:) ⇒ Hash
Login with email and password
10 11 12 13 14 15 16 |
# File 'lib/voice_notes/resources/auth.rb', line 10 def login(email:, password:) post("/api/v1/auth/login", { email: email, password: password, grant_type: "password" }) end |
#logout ⇒ Hash?
Logout and invalidate the current session
30 31 32 |
# File 'lib/voice_notes/resources/auth.rb', line 30 def logout delete("/api/v1/auth/logout") end |
#me ⇒ Hash
Get current authenticated user
36 37 38 |
# File 'lib/voice_notes/resources/auth.rb', line 36 def me get("/api/v1/me") end |
#refresh(refresh_token:) ⇒ Hash
Refresh access token using refresh token
21 22 23 24 25 26 |
# File 'lib/voice_notes/resources/auth.rb', line 21 def refresh(refresh_token:) post("/api/v1/auth/login", { grant_type: "refresh_token", refresh_token: refresh_token }) end |