Class: DatabasusRuby::Auth
- Includes:
- Endpoint
- Defined in:
- lib/databasus_ruby/objects/auth.rb,
sig/databasus_ruby.rbs
Overview
Obtaining a token. Every other endpoint needs the JWT these methods
return, so #signin and #signup install it on the client as api_key.
client.auth.signin(email: "me@example.com", password: "secret")
client.users.me.name
Read the token off the result if you want to keep it for a later client.
Instance Attribute Summary
Attributes included from Endpoint
Instance Method Summary collapse
-
#github_callback(code:, redirect_uri:) ⇒ Object
POST /auth/github/callback.
-
#google_callback(code:, redirect_uri:) ⇒ Object
POST /auth/google/callback.
-
#reset_password(email:, code:, new_password:) ⇒ Object
POST /users/reset-password.
-
#send_reset_password_code(email:, cloudflare_turnstile_token: nil) ⇒ Object
POST /users/send-reset-password-code.
-
#signin(email:, password:, cloudflare_turnstile_token: nil) ⇒ Object
POST /users/signin.
-
#signup(email:, name:, password:, cloudflare_turnstile_token: nil) ⇒ Object
POST /users/signup.
Methods included from Endpoint
#acknowledged, #build, #collection, #compact, #escape, #http_delete, #http_get, #http_post, #http_put, #initialize, #inspect, #object, #single_value, #with_default_workspace
Methods inherited from Object
#==, #[], #hash, #initialize, #inspect, #key?, #keys, #method_missing, #respond_to_missing?, #to_h
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class DatabasusRuby::Object
Instance Method Details
#github_callback(code:, redirect_uri:) ⇒ Object
POST /auth/github/callback
34 35 36 |
# File 'lib/databasus_ruby/objects/auth.rb', line 34 def github_callback(code:, redirect_uri:) object(http_post("auth/github/callback", { code: code, redirectUri: redirect_uri })) end |
#google_callback(code:, redirect_uri:) ⇒ Object
POST /auth/google/callback
39 40 41 |
# File 'lib/databasus_ruby/objects/auth.rb', line 39 def google_callback(code:, redirect_uri:) object(http_post("auth/google/callback", { code: code, redirectUri: redirect_uri })) end |
#reset_password(email:, code:, new_password:) ⇒ Object
POST /users/reset-password
52 53 54 |
# File 'lib/databasus_ruby/objects/auth.rb', line 52 def reset_password(email:, code:, new_password:) object(http_post("users/reset-password", { email: email, code: code, newPassword: new_password })) end |
#send_reset_password_code(email:, cloudflare_turnstile_token: nil) ⇒ Object
POST /users/send-reset-password-code
44 45 46 47 48 49 |
# File 'lib/databasus_ruby/objects/auth.rb', line 44 def send_reset_password_code(email:, cloudflare_turnstile_token: nil) object(http_post("users/send-reset-password-code", { email: email, cloudflareTurnstileToken: cloudflare_turnstile_token })) end |
#signin(email:, password:, cloudflare_turnstile_token: nil) ⇒ Object
POST /users/signin
15 16 17 18 19 20 21 |
# File 'lib/databasus_ruby/objects/auth.rb', line 15 def signin(email:, password:, cloudflare_turnstile_token: nil) object(http_post("users/signin", { email: email, password: password, cloudflareTurnstileToken: cloudflare_turnstile_token })) end |
#signup(email:, name:, password:, cloudflare_turnstile_token: nil) ⇒ Object
POST /users/signup
24 25 26 27 28 29 30 31 |
# File 'lib/databasus_ruby/objects/auth.rb', line 24 def signup(email:, name:, password:, cloudflare_turnstile_token: nil) object(http_post("users/signup", { email: email, name: name, password: password, cloudflareTurnstileToken: cloudflare_turnstile_token })) end |