recurly v0.0.1 Recurly.Account
Module for handling accounts in Recurly. See the developer docs on accounts for more details
Summary
Functions
Creates an account from a changeset. Supports nesting the billing_info
Finds an account given an account code. Returns the account or an error
Lists all the accounts. See the accounts dev docs for more details
Generates the path to an account given the account code
Updates an account from a changeset
Functions
Creates an account from a changeset. Supports nesting the billing_info
Parameters
changeset
Keyword list changeset
Examples
alias Recurly.ValidationError
case Recurly.Account.create(account_code: "myaccountcode") do
{:ok, account} ->
# created the account
{:error, %ValidationError{errors: errors}} ->
# will give you a list of validation errors
end
Finds an account given an account code. Returns the account or an error.
Parameters
account_code
String account code
Examples
alias Recurly.NotFoundError
case Recurly.Account.find("myaccountcode") do
{:ok, account} ->
# Found the account
{:error, %NotFoundError{}} ->
# 404 account was not found
end
Lists all the accounts. See the accounts dev docs for more details.
Parameters
options
Keyword list of GET params
Examples
case Recurly.Account.list(state: "subscriber") do
{:ok, accounts} ->
# list of subscriber accounts
{:error, error} ->
# error happened
end
Generates the path to an account given the account code
Parameters
account_code
String account code
Updates an account from a changeset
Parameters
account
account resource structchangeset
Keyword list changeset representing the updates
Examples
alias Recurly.ValidationError
changeset = [
first_name: "Benjamin",
last_name: nil
]
case Recurly.Account.update(account, changeset) do
{:ok, account} ->
# the updated account
{:error, %ValidationError{errors: errors}} ->
# will give you a list of validation errors
end