class Base::Endpoints::Users

This endpoint contains methods for creating and managing users.

Public Class Methods

new(access_token:, url:) click to toggle source

Initializes this endpoint.

Calls superclass method Base::Endpoint::new
# File lib/base/endpoints/users.rb, line 8
def initialize(access_token:, url:)
  @path = 'users'
  super
end

Public Instance Methods

create(email:, password:, confirmation:, custom_data: nil) click to toggle source

Creates a user with the given credentials.

# File lib/base/endpoints/users.rb, line 24
def create(email:, password:, confirmation:, custom_data: nil)
  request do
    response =
      connection.post('',
                      'custom_data' => custom_data.to_json,
                      'confirmation' => confirmation,
                      'password' => password,
                      'email' => email)

    parse(response.body)
  end
end
delete(id) click to toggle source

Deletes the user with the given ID.

# File lib/base/endpoints/users.rb, line 60
def delete(id)
  request do
    response =
      connection.delete id

    parse(response.body)
  end
end
get(id) click to toggle source

Gets the details of the user with the given ID.

# File lib/base/endpoints/users.rb, line 50
def get(id)
  request do
    response =
      connection.get id

    parse(response.body)
  end
end
list(page: 1, per_page: 10) click to toggle source

Lists the files of a project

# File lib/base/endpoints/users.rb, line 14
def list(page: 1, per_page: 10)
  request do
    response =
      connection.get('', per_page: per_page, page: page)

    parse(response.body)
  end
end
update(id:, email:, custom_data: nil) click to toggle source

Updates a user with the given data.

# File lib/base/endpoints/users.rb, line 38
def update(id:, email:, custom_data: nil)
  request do
    response =
      connection.post(id,
                      'custom_data' => custom_data.to_json,
                      'email' => email)

    parse(response.body)
  end
end