The Limits resource (spend controls): creating, listing, updating, and terminating spend limits.
Summary
Functions
Creates a new spend limit for user_id. Blocks and polls until creation
completes by default (poll: false for a Ramp.DeferredTaskRef).
Fetches a single limit by ID.
Returns a lazily auto-paginating Stream of Ramp.Limits.Limits.
Fetches a single page of limits. See Ramp.Page.
Permanently terminates a limit. This action is irreversible. Blocks
and polls until termination completes by default (poll: false for a
Ramp.DeferredTaskRef).
Updates a limit's display name, balance, and/or restrictions.
Types
@type create_opt() :: {:balance, Ramp.Money.t()} | {:restrictions, Ramp.Limits.Restrictions.t()} | {:spend_program_id, String.t()} | {:idempotency_key, String.t()} | {:poll, boolean()} | {:poll_timeout_ms, pos_integer()}
@type list_opt() :: {:start, String.t()} | {:page_size, pos_integer()} | {:user_id, String.t()} | {:status, String.t()} | {:entity_id, String.t()}
@type update_opt() :: {:display_name, String.t()} | {:balance, Ramp.Money.t()} | {:restrictions, Ramp.Limits.Restrictions.t()}
Functions
@spec create(Ramp.Client.t(), String.t(), String.t(), [create_opt()]) :: {:ok, Ramp.Limits.Limit.t()} | {:ok, Ramp.DeferredTaskRef.t()} | {:error, Ramp.Error.t()}
Creates a new spend limit for user_id. Blocks and polls until creation
completes by default (poll: false for a Ramp.DeferredTaskRef).
Example
Ramp.Limits.create(client, "usr_123", "Q3 Travel Budget",
balance: %Ramp.Money{amount: 500_000, currency_code: "USD"},
restrictions: %Ramp.Limits.Restrictions{categories: ["AIRLINES"]}
)
@spec get(Ramp.Client.t(), String.t()) :: {:ok, Ramp.Limits.Limit.t()} | {:error, Ramp.Error.t()}
Fetches a single limit by ID.
@spec list(Ramp.Client.t(), [list_opt()]) :: Enumerable.t(Ramp.Limits.Limit.t())
Returns a lazily auto-paginating Stream of Ramp.Limits.Limits.
@spec list_page(Ramp.Client.t(), [list_opt()]) :: {:ok, Ramp.Page.t(Ramp.Limits.Limit.t())} | {:error, Ramp.Error.t()}
Fetches a single page of limits. See Ramp.Page.
@spec terminate(Ramp.Client.t(), String.t(), poll: boolean(), poll_timeout_ms: pos_integer() ) :: :ok | {:ok, Ramp.DeferredTaskRef.t()} | {:error, Ramp.Error.t()}
Permanently terminates a limit. This action is irreversible. Blocks
and polls until termination completes by default (poll: false for a
Ramp.DeferredTaskRef).
@spec update(Ramp.Client.t(), String.t(), [update_opt()]) :: {:ok, Ramp.Limits.Limit.t()} | {:error, Ramp.Error.t()}
Updates a limit's display name, balance, and/or restrictions.