The Users resource: inviting, listing, updating, deactivating, and reactivating Ramp platform users.
Like Ramp.Cards, user creation is asynchronous -- create/2 polls to
completion by default (poll: false to opt out).
Summary
Functions
Invites a new Ramp user. The user starts in "INVITE_PENDING" status
until they accept the email invitation.
Deactivates a user and cancels their associated cards.
Fetches a single user by ID.
Returns a lazily auto-paginating Stream of Ramp.Users.Users.
Fetches a single page of users. See Ramp.Page.
Restores a previously deactivated user.
Updates a user's mutable fields.
Types
@type list_opt() :: {:start, String.t()} | {:page_size, pos_integer()} | {:department_id, String.t()} | {:location_id, String.t()} | {:updated_after, DateTime.t()}
Functions
@spec create(Ramp.Client.t(), map(), [create_opt()]) :: {:ok, Ramp.Users.User.t()} | {:ok, Ramp.DeferredTaskRef.t()} | {:error, Ramp.Error.t()}
Invites a new Ramp user. The user starts in "INVITE_PENDING" status
until they accept the email invitation.
Required: email, first_name, last_name, role (one of
"ADMIN", "CARDHOLDER", "BUSINESS_OWNER", "ACCOUNTANT",
"IT_ADMIN").
Blocks and polls until the invite is created by default (poll: false
to instead get a Ramp.DeferredTaskRef back immediately).
@spec deactivate(Ramp.Client.t(), String.t()) :: :ok | {:error, Ramp.Error.t()}
Deactivates a user and cancels their associated cards.
@spec get(Ramp.Client.t(), String.t()) :: {:ok, Ramp.Users.User.t()} | {:error, Ramp.Error.t()}
Fetches a single user by ID.
@spec list(Ramp.Client.t(), [list_opt()]) :: Enumerable.t(Ramp.Users.User.t())
Returns a lazily auto-paginating Stream of Ramp.Users.Users.
@spec list_page(Ramp.Client.t(), [list_opt()]) :: {:ok, Ramp.Page.t(Ramp.Users.User.t())} | {:error, Ramp.Error.t()}
Fetches a single page of users. See Ramp.Page.
@spec reactivate(Ramp.Client.t(), String.t()) :: {:ok, Ramp.Users.User.t()} | {:error, Ramp.Error.t()}
Restores a previously deactivated user.
@spec update(Ramp.Client.t(), String.t(), [update_opt()]) :: {:ok, Ramp.Users.User.t()} | {:error, Ramp.Error.t()}
Updates a user's mutable fields.