Module: Pixela::Client::UserMethods
- Included in:
- Pixela::Client
- Defined in:
- lib/pixela/client/user_methods.rb
Instance Method Summary collapse
-
#create_user(agree_terms_of_service:, not_minor:) ⇒ Pixela::Response
Create a new Pixela user.
-
#delete_user ⇒ Pixela::Response
Deletes the specified registered user.
-
#update_user(new_token:) ⇒ Pixela::Response
Updates the authentication token for the specified user.
Instance Method Details
#create_user(agree_terms_of_service:, not_minor:) ⇒ Pixela::Response
Create a new Pixela user.
15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/pixela/client/user_methods.rb', line 15 def create_user(agree_terms_of_service:, not_minor:) params = { token: token, username: username, agreeTermsOfService: to_boolean_string(agree_terms_of_service), notMinor: to_boolean_string(not_minor), } with_error_handling do connection(request_headers: default_headers).post("users", params).body end end |
#delete_user ⇒ Pixela::Response
Deletes the specified registered user.
65 66 67 68 69 |
# File 'lib/pixela/client/user_methods.rb', line 65 def delete_user with_error_handling do connection.delete("users/#{username}").body end end |
#update_user(new_token:) ⇒ Pixela::Response
Updates the authentication token for the specified user.
40 41 42 43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/pixela/client/user_methods.rb', line 40 def update_user(new_token:) params = { newToken: new_token, } response = with_error_handling do connection.put("users/#{username}", params).body end @token = new_token response end |