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:) ⇒ Hashie::Mash
Create a new Pixela user.
-
#delete_user ⇒ Hashie::Mash
Deletes the specified registered user.
-
#update_user(new_token:) ⇒ Hashie::Mash
Updates the authentication token for the specified user.
Instance Method Details
#create_user(agree_terms_of_service:, not_minor:) ⇒ Hashie::Mash
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.post("users", params, default_headers).body end end |
#delete_user ⇒ Hashie::Mash
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}", nil, user_token_headers).body end end |
#update_user(new_token:) ⇒ Hashie::Mash
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, user_token_headers).body end @token = new_token response end |