Class: ScalarGalaxy::Resources::Authentication
- Inherits:
-
Object
- Object
- ScalarGalaxy::Resources::Authentication
- Defined in:
- lib/galaxy-ruby/resources/authentication.rb,
sig/galaxy-ruby/resources/authentication.rbs
Overview
Some endpoints are public, but some require authentication. We provide all the required endpoints to create an account and authorize yourself.
Instance Method Summary collapse
-
#create_token(email:, password:, request_options: {}) ⇒ ScalarGalaxy::Models::AuthenticationCreateTokenResponse
Yeah, this is the boring security stuff.
-
#create_user(email:, password:, name: nil, request_options: {}) ⇒ ScalarGalaxy::Models::User
Time to create a user account, eh?.
-
#initialize(client:) ⇒ Authentication
constructor
private
A new instance of Authentication.
-
#list_me(request_options: {}) ⇒ ScalarGalaxy::Models::User
Find yourself they say.
Constructor Details
#initialize(client:) ⇒ Authentication
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Authentication.
75 76 77 |
# File 'lib/galaxy-ruby/resources/authentication.rb', line 75 def initialize(client:) @client = client end |
Instance Method Details
#create_token(email:, password:, request_options: {}) ⇒ ScalarGalaxy::Models::AuthenticationCreateTokenResponse
Yeah, this is the boring security stuff. Just get your super secret token and move on.
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/galaxy-ruby/resources/authentication.rb', line 20 def create_token(params) parsed, = ScalarGalaxy::AuthenticationCreateTokenParams.dump_request(params) @client.request( method: :post, path: "auth/token", body: parsed, model: ScalarGalaxy::Models::AuthenticationCreateTokenResponse, options: ) end |
#create_user(email:, password:, name: nil, request_options: {}) ⇒ ScalarGalaxy::Models::User
Time to create a user account, eh?
43 44 45 46 47 48 49 50 51 52 |
# File 'lib/galaxy-ruby/resources/authentication.rb', line 43 def create_user(params) parsed, = ScalarGalaxy::AuthenticationCreateUserParams.dump_request(params) @client.request( method: :post, path: "user/signup", body: parsed, model: ScalarGalaxy::User, options: ) end |
#list_me(request_options: {}) ⇒ ScalarGalaxy::Models::User
Find yourself they say. That's what you can do here.
63 64 65 66 67 68 69 70 |
# File 'lib/galaxy-ruby/resources/authentication.rb', line 63 def list_me(params = {}) @client.request( method: :get, path: "me", model: ScalarGalaxy::User, options: params[:request_options] ) end |