recurly v0.1.3 Recurly.Adjustment

Module for handling adjustments in Recurly. See the developer docs on adjustments for more details

Summary

Functions

Generates the path to create an adjustment for given the account code

Creates an adjustment from a changeset

Finds a adjustment given a adjustment uuid. Returns the adjustment or an error

Generates the path to find an adjustment given the uuid

Creates a stream of adjustments on a given account

Functions

account_path(account_code)

Generates the path to create an adjustment for given the account code.

Parameters

  • account_code String account code
create(changeset, account_code)

Creates an adjustment from a changeset.

Parameters

  • changeset Keyword list changeset
  • account_code String account code of associated account

Examples

alias Recurly.ValidationError

case Recurly.Adjustment.create([unit_amount_in_cents: 100, currency: "USD"], "myaccountcode") do
  {:ok, adjustment} ->
    # created the adjustment
  {:error, %ValidationError{errors: errors}} ->
    # will give you a list of validation errors
end
find(uuid)

Finds a adjustment given a adjustment uuid. Returns the adjustment or an error.

Parameters

  • uuid String adjustment uuid

Examples

alias Recurly.NotFoundError

case Recurly.Adjustment.find("uuid") do
  {:ok, adjustment} ->
    # Found the adjustment
  {:error, %NotFoundError{}} ->
    # 404 adjustment was not found
end
find_path(uuid)

Generates the path to find an adjustment given the uuid.

Parameters

  • uuid String uuid
stream(account_code, options \\ [])

Creates a stream of adjustments on a given account.

Parameters

  • account_code String account code of associated account
  • options Keyword list of the request options. See options in the adjustment list section of the docs

Examples

See Recurly.Resource.stream/3 for more detailed examples of working with resource streams.

# stream of adjustments sorted from most recently updated to least recently updated
stream = Recurly.Adjustment.stream("myaccountcode", sort: :updated_at)