Class: Recurly::Client

Inherits:
Object
  • Object
show all
Includes:
NetHttpAdapter
Defined in:
lib/recurly/client.rb,
lib/recurly/client/adapter.rb,
lib/recurly/client/operations.rb

Defined Under Namespace

Modules: NetHttpAdapter, NetHttpPersistentAdapter

Constant Summary collapse

BASE_URL =
"https://v3.recurly.com/"
BINARY_TYPES =
[
  "application/pdf",
]

Instance Method Summary collapse

Constructor Details

#initialize(api_key:, site_id: nil, subdomain: nil, **options) {|_self| ... } ⇒ Client

Initialize a client. It requires an API key.

Examples:

API_KEY = '83749879bbde395b5fe0cc1a5abf8e5'
client = Recurly::Client.new(api_key: API_KEY)
sub = client.get_subscription(subscription_id: 'abcd123456')
# You can also pass the initializer a block. This will give you
# a client scoped for just that block
Recurly::Client.new(api_key: API_KEY) do |client|
  sub = client.get_subscription(subscription_id: 'abcd123456')
end
# If you only plan on using the client for more than one site,
# you should initialize a new client for each site.

client = Recurly::Client.new(api_key: API_KEY1)
sub = client.get_subscription(subscription_id: 'uuid-abcd123456')

# you should create a new client to connect to another site
client = Recurly::Client.new(api_key: API_KEY2)
sub = client.get_subscription(subscription_id: 'uuid-abcd7890')

Parameters:

  • api_key (String)

    The private API key

  • site_id (String) (defaults to: nil)

    The site you wish to be scoped to.

  • subdomain (String) (defaults to: nil)

    Optional subdomain for the site you wish to be scoped to. Providing this makes all the `site_id` parameters optional.

Yields:

  • (_self)

Yield Parameters:


43
44
45
46
47
48
49
50
# File 'lib/recurly/client.rb', line 43

def initialize(api_key:, site_id: nil, subdomain: nil, **options)
  set_site_id(site_id, subdomain)
  set_options(options)
  set_faraday_connection(api_key)

  # execute block with this client if given
  yield(self) if block_given?
end

Instance Method Details

#api_versionObject


7
8
9
# File 'lib/recurly/client/operations.rb', line 7

def api_version
  "v2019-10-10"
end

#cancel_subscription(subscription_id:, **options) ⇒ Resources::Subscription

Cancel a subscription

cancel_subscription api documenation

Examples:

begin
  subscription = @client.cancel_subscription(
    subscription_id: subscription_id
  )
  puts "Canceled Subscription #{subscription}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • body (Requests::SubscriptionCancel)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::SubscriptionCancel

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2404
2405
2406
2407
# File 'lib/recurly/client/operations.rb', line 2404

def cancel_subscription(subscription_id:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/cancel", subscription_id: subscription_id)
  put(path, options[:body], Requests::SubscriptionCancel, **options)
end

#collect_invoice(invoice_id:, **options) ⇒ Resources::Invoice

Collect a pending or past due, automatic invoice

collect_invoice api documenation

Examples:

begin
  invoice = @client.collect_invoice(invoice_id: invoice_id)
  puts "Collected invoice #{invoice}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • invoice_id (String)

    Invoice ID or number. For ID no prefix is used e.g. e28zov4fw0v2. For number use prefix number-, e.g. number-1000.

  • body (Requests::InvoiceCollect)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::InvoiceCollect

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1591
1592
1593
1594
# File 'lib/recurly/client/operations.rb', line 1591

def collect_invoice(invoice_id:, **options)
  path = interpolate_path("/invoices/{invoice_id}/collect", invoice_id: invoice_id)
  put(path, options[:body], Requests::InvoiceCollect, **options)
end

#create_account(body:, **options) ⇒ Resources::Account

Examples:

begin
   = {
    code: ,
    first_name: "Benjamin",
    last_name: "Du Monde",
    acquisition: {
      campaign: "podcast-marketing",
      channel: "social_media",
      subchannel: "twitter",
      cost: {
        currency: "USD",
        amount: 0.50
      }
    },
    shipping_addresses: [
      {
        nickname: "Home",
        street1: "1 Tchoupitoulas St",
        city: "New Orleans",
        region: "LA",
        country: "US",
        postal_code: "70115",
        first_name: "Benjamin",
        last_name: "Du Monde"
      }
    ]
  }
   = @client.(body: )
  puts "Created Account #{}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • body (Requests::AccountCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::AccountCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


145
146
147
148
# File 'lib/recurly/client/operations.rb', line 145

def (body:, **options)
  path = interpolate_path("/accounts")
  post(path, body, Requests::AccountCreate, **options)
end

#create_coupon(body:, **options) ⇒ Resources::Coupon

Create a new coupon

create_coupon api documenation

Examples:

begin
  coupon_create = {
    name: "Promotional Coupon",
    code: coupon_code,
    discount_type: 'fixed',
    currencies: [
      {
        currency: 'USD',
        discount: 10_000
      }
    ]
  }
  coupon = @client.create_coupon(
    body: coupon_create
  )
  puts "Created Coupon #{coupon}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • body (Requests::CouponCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::CouponCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1198
1199
1200
1201
# File 'lib/recurly/client/operations.rb', line 1198

def create_coupon(body:, **options)
  path = interpolate_path("/coupons")
  post(path, body, Requests::CouponCreate, **options)
end

#create_coupon_redemption(account_id:, body:, **options) ⇒ Resources::CouponRedemption

Generate an active coupon redemption on an account

create_coupon_redemption api documenation

Examples:

begin
  redemption_create = {
    currency: 'USD',
    coupon_id: coupon_id
  }
  redemption = @client.create_coupon_redemption(
    account_id: ,
    body: redemption_create
  )
  puts "Created CouponRedemption #{redemption}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • body (Requests::CouponRedemptionCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::CouponRedemptionCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


489
490
491
492
# File 'lib/recurly/client/operations.rb', line 489

def create_coupon_redemption(account_id:, body:, **options)
  path = interpolate_path("/accounts/{account_id}/coupon_redemptions/active", account_id: )
  post(path, body, Requests::CouponRedemptionCreate, **options)
end

#create_invoice(account_id:, body:, **options) ⇒ Resources::InvoiceCollection

Create an invoice for pending line items

create_invoice api documenation

Examples:

begin
  invoice_create = {
    currency: 'USD',
    collection_method: 'automatic'
  }
  collection = @client.create_invoice(
    account_id: ,
    body: invoice_create
  )
  puts "Created InvoiceCollection #{collection}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • body (Requests::InvoiceCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::InvoiceCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


625
626
627
628
# File 'lib/recurly/client/operations.rb', line 625

def create_invoice(account_id:, body:, **options)
  path = interpolate_path("/accounts/{account_id}/invoices", account_id: )
  post(path, body, Requests::InvoiceCreate, **options)
end

#create_item(body:, **options) ⇒ Resources::Item

Create a new item

create_item api documenation

Parameters:

  • body (Requests::ItemCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::ItemCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1412
1413
1414
1415
# File 'lib/recurly/client/operations.rb', line 1412

def create_item(body:, **options)
  path = interpolate_path("/items")
  post(path, body, Requests::ItemCreate, **options)
end

#create_line_item(account_id:, body:, **options) ⇒ Resources::LineItem

Create a new line item for the account

create_line_item api documenation

Examples:

begin
  line_item_create = {
    currency: 'USD',
    unit_amount: 1_000,
    type: :charge
  }
  line_item = @client.create_line_item(
    account_id: ,
    body: line_item_create
  )
  puts "Created LineItem #{line_item}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • body (Requests::LineItemCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::LineItemCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


734
735
736
737
# File 'lib/recurly/client/operations.rb', line 734

def create_line_item(account_id:, body:, **options)
  path = interpolate_path("/accounts/{account_id}/line_items", account_id: )
  post(path, body, Requests::LineItemCreate, **options)
end

#create_plan(body:, **options) ⇒ Resources::Plan

Examples:

begin
  plan_create = {
    code: plan_code,
    name: plan_name,
    currencies: [
      currency: "USD",
      setup_fee: 1_000
    ],
    add_ons: [
      {
        name: 'Extra User',
        code: 'extra_user',
        currencies: [
          { currency: 'USD', unit_amount: 10_000 }
        ]
      }
    ]
  }
  plan = @client.create_plan(body: plan_create)
  puts "Created Plan #{plan}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • body (Requests::PlanCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::PlanCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1958
1959
1960
1961
# File 'lib/recurly/client/operations.rb', line 1958

def create_plan(body:, **options)
  path = interpolate_path("/plans")
  post(path, body, Requests::PlanCreate, **options)
end

#create_plan_add_on(plan_id:, body:, **options) ⇒ Resources::AddOn

Parameters:

  • plan_id (String)

    Plan ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-gold.

  • body (Requests::AddOnCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::AddOnCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2064
2065
2066
2067
# File 'lib/recurly/client/operations.rb', line 2064

def create_plan_add_on(plan_id:, body:, **options)
  path = interpolate_path("/plans/{plan_id}/add_ons", plan_id: plan_id)
  post(path, body, Requests::AddOnCreate, **options)
end

#create_purchase(body:, **options) ⇒ Resources::InvoiceCollection

Create a new purchase

create_purchase api documenation

Examples:

begin
  purchase = {
    currency: "USD",
    account: {
      code: ,
      first_name: "Benjamin",
      last_name: "Du Monde",
      billing_info: {
        token_id: rjs_token_id
      },
    },
    subscriptions: [
      { plan_code: plan_code }
    ]
  }
  invoice_collection = @client.create_purchase(
    body: purchase
  )
  puts "Created Charge Invoice #{invoice_collection.charge_invoice}"
  puts "Created Credit Invoices #{invoice_collection.credit_invoices}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • body (Requests::PurchaseCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::PurchaseCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2841
2842
2843
2844
# File 'lib/recurly/client/operations.rb', line 2841

def create_purchase(body:, **options)
  path = interpolate_path("/purchases")
  post(path, body, Requests::PurchaseCreate, **options)
end

#create_shipping_address(account_id:, body:, **options) ⇒ Resources::ShippingAddress

Create a new shipping address for the account

create_shipping_address api documenation

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • body (Requests::ShippingAddressCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::ShippingAddressCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


848
849
850
851
# File 'lib/recurly/client/operations.rb', line 848

def create_shipping_address(account_id:, body:, **options)
  path = interpolate_path("/accounts/{account_id}/shipping_addresses", account_id: )
  post(path, body, Requests::ShippingAddressCreate, **options)
end

#create_subscription(body:, **options) ⇒ Resources::Subscription

Create a new subscription

create_subscription api documenation

Examples:

begin
  subscription_create = {
    plan_code: plan_code,
    currency: "USD",
    # This can be an existing account or
    # a new acocunt
    account: {
      code: ,
    }
  }
  subscription = @client.create_subscription(
    body: subscription_create
  )
  puts "Created Subscription #{subscription}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • body (Requests::SubscriptionCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::SubscriptionCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2291
2292
2293
2294
# File 'lib/recurly/client/operations.rb', line 2291

def create_subscription(body:, **options)
  path = interpolate_path("/subscriptions")
  post(path, body, Requests::SubscriptionCreate, **options)
end

#create_subscription_change(subscription_id:, body:, **options) ⇒ Resources::SubscriptionChange

Create a new subscription change

create_subscription_change api documenation

Examples:

begin
  change_create = {
    timeframe: "now",
    plan_code: new_plan_code
  }
  change = @client.create_subscription_change(
    subscription_id: subscription_id,
    body: change_create
  )
  puts "Created SubscriptionChange #{change}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • body (Requests::SubscriptionChangeCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::SubscriptionChangeCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2535
2536
2537
2538
# File 'lib/recurly/client/operations.rb', line 2535

def create_subscription_change(subscription_id:, body:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/change", subscription_id: subscription_id)
  post(path, body, Requests::SubscriptionChangeCreate, **options)
end

#deactivate_account(account_id:, **options) ⇒ Resources::Account

Deactivate an account

deactivate_account api documenation

Examples:

begin
   = @client.(account_id: )
  puts "Deactivated Account #{}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


219
220
221
222
# File 'lib/recurly/client/operations.rb', line 219

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}", account_id: )
  delete(path, **options)
end

#deactivate_item(item_id:, **options) ⇒ Resources::Item

Parameters:

  • item_id (String)

    Item ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-red.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1449
1450
1451
1452
# File 'lib/recurly/client/operations.rb', line 1449

def deactivate_item(item_id:, **options)
  path = interpolate_path("/items/{item_id}", item_id: item_id)
  delete(path, **options)
end

#deactivate_unique_coupon_code(unique_coupon_code_id:, **options) ⇒ Resources::UniqueCouponCode

Deactivate a unique coupon code

deactivate_unique_coupon_code api documenation

Parameters:

  • unique_coupon_code_id (String)

    Unique Coupon Code ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-abc-8dh2-def.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2790
2791
2792
2793
# File 'lib/recurly/client/operations.rb', line 2790

def deactivate_unique_coupon_code(unique_coupon_code_id:, **options)
  path = interpolate_path("/unique_coupon_codes/{unique_coupon_code_id}", unique_coupon_code_id: unique_coupon_code_id)
  delete(path, **options)
end

#fail_invoice(invoice_id:, **options) ⇒ Resources::Invoice

Mark an open invoice as failed

fail_invoice api documenation

Examples:

begin
  invoice = @client.fail_invoice(invoice_id: invoice_id)
  puts "Failed invoice #{invoice}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • invoice_id (String)

    Invoice ID or number. For ID no prefix is used e.g. e28zov4fw0v2. For number use prefix number-, e.g. number-1000.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1613
1614
1615
1616
# File 'lib/recurly/client/operations.rb', line 1613

def fail_invoice(invoice_id:, **options)
  path = interpolate_path("/invoices/{invoice_id}/mark_failed", invoice_id: invoice_id)
  put(path, **options)
end

#get_account(account_id:, **options) ⇒ Resources::Account

Fetch an account

get_account api documenation

Examples:

begin
   = @client.(account_id: )
  puts "Got Account #{}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


167
168
169
170
# File 'lib/recurly/client/operations.rb', line 167

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}", account_id: )
  get(path, **options)
end

#get_account_acquisition(account_id:, **options) ⇒ Resources::AccountAcquisition

Fetch an account's acquisition data

get_account_acquisition api documenation

Examples:

begin
  @client.(account_id: )
  puts "Got AccountAcquisition"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


241
242
243
244
# File 'lib/recurly/client/operations.rb', line 241

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/acquisition", account_id: )
  get(path, **options)
end

#get_account_balance(account_id:, **options) ⇒ Resources::AccountBalance

Fetch an account's balance and past due status

get_account_balance api documenation

Examples:

begin
  balance = @client.(account_id: )
  puts "Got AccountBalance #{balance}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


320
321
322
323
# File 'lib/recurly/client/operations.rb', line 320

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/balance", account_id: )
  get(path, **options)
end

#get_account_note(account_id:, account_note_id:, **options) ⇒ Resources::AccountNote

Fetch an account note

get_account_note api documenation

Examples:

begin
  note = @client.(
    account_id: ,
    account_note_id: note_id
  )
  puts "Got AccountNote #{note}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • account_note_id (String)

    Account Note ID.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


790
791
792
793
# File 'lib/recurly/client/operations.rb', line 790

def (account_id:, account_note_id:, **options)
  path = interpolate_path("/accounts/{account_id}/notes/{account_note_id}", account_id: , account_note_id: )
  get(path, **options)
end

#get_active_coupon_redemption(account_id:, **options) ⇒ Resources::CouponRedemption

Show the coupon redemption that is active on an account

get_active_coupon_redemption api documenation

Examples:

begin
  redemption = @client.get_active_coupon_redemption(account_id: )
  puts "Got CouponRedemption #{redemption}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


459
460
461
462
# File 'lib/recurly/client/operations.rb', line 459

def get_active_coupon_redemption(account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/coupon_redemptions/active", account_id: )
  get(path, **options)
end

#get_add_on(add_on_id:, **options) ⇒ Resources::AddOn

Fetch an add-on

get_add_on api documenation

Parameters:

  • add_on_id (String)

    Add-on ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-gold.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2164
2165
2166
2167
# File 'lib/recurly/client/operations.rb', line 2164

def get_add_on(add_on_id:, **options)
  path = interpolate_path("/add_ons/{add_on_id}", add_on_id: add_on_id)
  get(path, **options)
end

#get_billing_info(account_id:, **options) ⇒ Resources::BillingInfo

Fetch an account's billing information

get_billing_info api documenation

Examples:

begin
  billing = @client.get_billing_info(account_id: )
  puts "Got BillingInfo #{billing}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


342
343
344
345
# File 'lib/recurly/client/operations.rb', line 342

def get_billing_info(account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/billing_info", account_id: )
  get(path, **options)
end

#get_coupon(coupon_id:, **options) ⇒ Resources::Coupon

Examples:

begin
  coupon = @client.get_coupon(coupon_id: coupon_id)
  puts "Got Coupon #{coupon}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • coupon_id (String)

    Coupon ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-10off.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1220
1221
1222
1223
# File 'lib/recurly/client/operations.rb', line 1220

def get_coupon(coupon_id:, **options)
  path = interpolate_path("/coupons/{coupon_id}", coupon_id: coupon_id)
  get(path, **options)
end

#get_credit_payment(credit_payment_id:, **options) ⇒ Resources::CreditPayment

Fetch a credit payment

get_credit_payment api documenation

Parameters:

  • credit_payment_id (String)

    Credit Payment ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1310
1311
1312
1313
# File 'lib/recurly/client/operations.rb', line 1310

def get_credit_payment(credit_payment_id:, **options)
  path = interpolate_path("/credit_payments/{credit_payment_id}", credit_payment_id: credit_payment_id)
  get(path, **options)
end

#get_custom_field_definition(custom_field_definition_id:, **options) ⇒ Resources::CustomFieldDefinition

Fetch an custom field definition

get_custom_field_definition api documenation

Parameters:

  • custom_field_definition_id (String)

    Custom Field Definition ID

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1364
1365
1366
1367
# File 'lib/recurly/client/operations.rb', line 1364

def get_custom_field_definition(custom_field_definition_id:, **options)
  path = interpolate_path("/custom_field_definitions/{custom_field_definition_id}", custom_field_definition_id: custom_field_definition_id)
  get(path, **options)
end

#get_invoice(invoice_id:, **options) ⇒ Resources::Invoice

Fetch an invoice

get_invoice api documenation

Examples:

begin
  invoice = @client.get_invoice(invoice_id: invoice_id)
  puts "Got invoice #{invoice}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • invoice_id (String)

    Invoice ID or number. For ID no prefix is used e.g. e28zov4fw0v2. For number use prefix number-, e.g. number-1000.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1530
1531
1532
1533
# File 'lib/recurly/client/operations.rb', line 1530

def get_invoice(invoice_id:, **options)
  path = interpolate_path("/invoices/{invoice_id}", invoice_id: invoice_id)
  get(path, **options)
end

#get_invoice_pdf(invoice_id:, **options) ⇒ Resources::BinaryFile

Fetch an invoice as a PDF

get_invoice_pdf api documenation

Examples:

begin
  invoice = @client.get_invoice_pdf(invoice_id: invoice_id)
  puts "Got invoice #{invoice}"
  filename = "#{download_directory}/rubyinvoice-#{invoice_id}.pdf"
  IO.write(filename, invoice.data)
  puts "Saved Invoice PDF to #{filename}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • invoice_id (String)

    Invoice ID or number. For ID no prefix is used e.g. e28zov4fw0v2. For number use prefix number-, e.g. number-1000.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1568
1569
1570
1571
# File 'lib/recurly/client/operations.rb', line 1568

def get_invoice_pdf(invoice_id:, **options)
  path = interpolate_path("/invoices/{invoice_id}.pdf", invoice_id: invoice_id)
  get(path, **options)
end

#get_item(item_id:, **options) ⇒ Resources::Item

Parameters:

  • item_id (String)

    Item ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-red.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1424
1425
1426
1427
# File 'lib/recurly/client/operations.rb', line 1424

def get_item(item_id:, **options)
  path = interpolate_path("/items/{item_id}", item_id: item_id)
  get(path, **options)
end

#get_line_item(line_item_id:, **options) ⇒ Resources::LineItem

Fetch a line item

get_line_item api documenation

Examples:

begin
  line_item = @client.get_line_item(line_item_id: line_item_id)
  puts "Got LineItem #{line_item}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • line_item_id (String)

    Line Item ID.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1853
1854
1855
1856
# File 'lib/recurly/client/operations.rb', line 1853

def get_line_item(line_item_id:, **options)
  path = interpolate_path("/line_items/{line_item_id}", line_item_id: line_item_id)
  get(path, **options)
end

#get_plan(plan_id:, **options) ⇒ Resources::Plan

Examples:

begin
  plan = @client.get_plan(plan_id: plan_id)
  puts "Got plan #{plan}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • plan_id (String)

    Plan ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-gold.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1980
1981
1982
1983
# File 'lib/recurly/client/operations.rb', line 1980

def get_plan(plan_id:, **options)
  path = interpolate_path("/plans/{plan_id}", plan_id: plan_id)
  get(path, **options)
end

#get_plan_add_on(plan_id:, add_on_id:, **options) ⇒ Resources::AddOn

Fetch a plan's add-on

get_plan_add_on api documenation

Examples:

begin
  add_on = @client.get_plan_add_on(
    plan_id: plan_id, add_on_id: add_on_id
  )
  puts "Got plan add-on #{add_on}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • plan_id (String)

    Plan ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-gold.

  • add_on_id (String)

    Add-on ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-gold.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2089
2090
2091
2092
# File 'lib/recurly/client/operations.rb', line 2089

def get_plan_add_on(plan_id:, add_on_id:, **options)
  path = interpolate_path("/plans/{plan_id}/add_ons/{add_on_id}", plan_id: plan_id, add_on_id: add_on_id)
  get(path, **options)
end

#get_shipping_address(account_id:, shipping_address_id:, **options) ⇒ Resources::ShippingAddress

Fetch an account's shipping address

get_shipping_address api documenation

Examples:

begin
  address = @client.get_shipping_address(
    account_id: ,
    shipping_address_id: shipping_address_id
  )
  puts "Got ShippingAddress #{address}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • shipping_address_id (String)

    Shipping Address ID.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


874
875
876
877
# File 'lib/recurly/client/operations.rb', line 874

def get_shipping_address(account_id:, shipping_address_id:, **options)
  path = interpolate_path("/accounts/{account_id}/shipping_addresses/{shipping_address_id}", account_id: , shipping_address_id: shipping_address_id)
  get(path, **options)
end

#get_shipping_method(id:, **options) ⇒ Resources::ShippingMethod

Fetch a shipping method

get_shipping_method api documenation

Parameters:

  • id (String)

    Shipping Method ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-usps_2-day.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2211
2212
2213
2214
# File 'lib/recurly/client/operations.rb', line 2211

def get_shipping_method(id:, **options)
  path = interpolate_path("/shipping_methods/{id}", id: id)
  get(path, **options)
end

#get_site(site_id:) ⇒ Resources::Site

Parameters:

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


51
52
53
54
# File 'lib/recurly/client/operations.rb', line 51

def get_site(site_id:)
  path = interpolate_path("/sites/{site_id}", site_id: site_id)
  get(path)
end

#get_subscription(subscription_id:, **options) ⇒ Resources::Subscription

Fetch a subscription

get_subscription api documenation

Examples:

begin
  subscription = @client.get_subscription(
    subscription_id: subscription_id
  )
  puts "Got Subscription #{subscription}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2315
2316
2317
2318
# File 'lib/recurly/client/operations.rb', line 2315

def get_subscription(subscription_id:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}", subscription_id: subscription_id)
  get(path, **options)
end

#get_subscription_change(subscription_id:, **options) ⇒ Resources::SubscriptionChange

Fetch a subscription's pending change

get_subscription_change api documenation

Examples:

begin
  change = @client.get_subscription_change(
    subscription_id: subscription_id
  )
  puts "Got SubscriptionChange #{change}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2505
2506
2507
2508
# File 'lib/recurly/client/operations.rb', line 2505

def get_subscription_change(subscription_id:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/change", subscription_id: subscription_id)
  get(path, **options)
end

#get_transaction(transaction_id:, **options) ⇒ Resources::Transaction

Fetch a transaction

get_transaction api documenation

Examples:

begin
  transaction = @client.get_transaction(transaction_id: transaction_id)
  puts "Got Transaction #{transaction}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • transaction_id (String)

    Transaction ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2766
2767
2768
2769
# File 'lib/recurly/client/operations.rb', line 2766

def get_transaction(transaction_id:, **options)
  path = interpolate_path("/transactions/{transaction_id}", transaction_id: transaction_id)
  get(path, **options)
end

#get_unique_coupon_code(unique_coupon_code_id:, **options) ⇒ Resources::UniqueCouponCode

Fetch a unique coupon code

get_unique_coupon_code api documenation

Parameters:

  • unique_coupon_code_id (String)

    Unique Coupon Code ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-abc-8dh2-def.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2778
2779
2780
2781
# File 'lib/recurly/client/operations.rb', line 2778

def get_unique_coupon_code(unique_coupon_code_id:, **options)
  path = interpolate_path("/unique_coupon_codes/{unique_coupon_code_id}", unique_coupon_code_id: unique_coupon_code_id)
  get(path, **options)
end

#list_account_acquisition(**options) ⇒ Pager<Resources::AccountAcquisition>

List a site's account acquisition data

list_account_acquisition api documenation

Examples:

acquisitions = @client.(limit: 200)
acquisitions.each do |acquisition|
  puts "AccountAcquisition: #{acquisition.cost}"
end

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1122
1123
1124
1125
# File 'lib/recurly/client/operations.rb', line 1122

def (**options)
  path = interpolate_path("/acquisitions")
  pager(path, **options)
end

#list_account_coupon_redemptions(account_id:, **options) ⇒ Pager<Resources::CouponRedemption>

Show the coupon redemptions for an account

list_account_coupon_redemptions api documenation

Examples:

redemptions = @client.(
  account_id: ,
  limit: 200
)
redemptions.each do |redemption|
  puts "CouponRedemption: #{redemption.id}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


437
438
439
440
# File 'lib/recurly/client/operations.rb', line 437

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/coupon_redemptions", account_id: )
  pager(path, **options)
end

#list_account_credit_payments(account_id:, **options) ⇒ Pager<Resources::CreditPayment>

List an account's credit payments

list_account_credit_payments api documenation

Examples:

payments = @client.(
  account_id: ,
  limit: 200
)
payments.each do |payment|
  puts "CreditPayment: #{payment.id}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


544
545
546
547
# File 'lib/recurly/client/operations.rb', line 544

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/credit_payments", account_id: )
  pager(path, **options)
end

#list_account_invoices(account_id:, **options) ⇒ Pager<Resources::Invoice>

List an account's invoices

list_account_invoices api documenation

Examples:

invoices = @client.(
  account_id: ,
  limit: 200
)
invoices.each do |invoice|
  puts "Invoice: #{invoice.number}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • type (String)

    Filter by type when:

    • type=charge, only charge invoices will be returned.

    • type=credit, only credit invoices will be returned.

    • type=non-legacy, only charge and credit invoices will be returned.

    • type=legacy, only legacy invoices will be returned.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


595
596
597
598
# File 'lib/recurly/client/operations.rb', line 595

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/invoices", account_id: )
  pager(path, **options)
end

#list_account_line_items(account_id:, **options) ⇒ Pager<Resources::LineItem>

List an account's line items

list_account_line_items api documenation

Examples:

line_items = @client.(
  account_id: ,
  limit: 200
)
line_items.each do |line_item|
  puts "LineItem: #{line_item.id}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • original (String)

    Filter by original field.

  • state (String)

    Filter by state field.

  • type (String)

    Filter by type field.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


703
704
705
706
# File 'lib/recurly/client/operations.rb', line 703

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/line_items", account_id: )
  pager(path, **options)
end

#list_account_notes(account_id:, **options) ⇒ Pager<Resources::AccountNote>

Fetch a list of an account's notes

list_account_notes api documenation

Examples:

 = @client.(account_id: , limit: 200)
.each do |note|
  puts "AccountNote: #{note.message}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


764
765
766
767
# File 'lib/recurly/client/operations.rb', line 764

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/notes", account_id: )
  pager(path, **options)
end

#list_account_subscriptions(account_id:, **options) ⇒ Pager<Resources::Subscription>

List an account's subscriptions

list_account_subscriptions api documenation

Examples:

subscriptions = @client.(
  account_id: ,
  limit: 200
)
subscriptions.each do |subscription|
  puts "Subscription: #{subscription.uuid}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • state (String)

    Filter by state.

    • When state=active, state=canceled, state=expired, or state=future, subscriptions with states that match the query and only those subscriptions will be returned.

    • When state=in_trial, only subscriptions that have a trial_started_at date earlier than now and a trial_ends_at date later than now will be returned.

    • When state=live, only subscriptions that are in an active, canceled, or future state or are in trial will be returned.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


984
985
986
987
# File 'lib/recurly/client/operations.rb', line 984

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/subscriptions", account_id: )
  pager(path, **options)
end

#list_account_transactions(account_id:, **options) ⇒ Pager<Resources::Transaction>

List an account's transactions

list_account_transactions api documenation

Examples:

transactions = @client.(
  account_id: ,
  limit: 200
)
transactions.each do |transaction|
  puts "Transaction: #{transaction.uuid}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • type (String)

    Filter by type field. The value payment will return both purchase and capture transactions.

  • success (String)

    Filter by success field.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1031
1032
1033
1034
# File 'lib/recurly/client/operations.rb', line 1031

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/transactions", account_id: )
  pager(path, **options)
end

#list_accounts(**options) ⇒ Pager<Resources::Account>

List a site's accounts

list_accounts api documenation

Examples:

accounts = @client.list_accounts(limit: 200)
accounts.each do ||
  puts "Account: #{.code}"
end

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • email (String)

    Filter for accounts with this exact email address. A blank value will return accounts with both null and “” email addresses. Note that multiple accounts can share one email address.

  • subscriber (Boolean)

    Filter for accounts with or without a subscription in the active, canceled, or future state.

  • past_due (String)

    Filter for accounts with an invoice in the past_due state.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


97
98
99
100
# File 'lib/recurly/client/operations.rb', line 97

def list_accounts(**options)
  path = interpolate_path("/accounts")
  pager(path, **options)
end

#list_add_ons(**options) ⇒ Pager<Resources::AddOn>

List a site's add-ons

list_add_ons api documenation

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • state (String)

    Filter by state.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2152
2153
2154
2155
# File 'lib/recurly/client/operations.rb', line 2152

def list_add_ons(**options)
  path = interpolate_path("/add_ons")
  pager(path, **options)
end

#list_child_accounts(account_id:, **options) ⇒ Pager<Resources::Account>

List an account's child accounts

list_child_accounts api documenation

Examples:

child_accounts = @client.list_child_accounts(
  account_id: ,
  limit: 200
)
child_accounts.each do |child|
  puts "Account: #{child.code}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • email (String)

    Filter for accounts with this exact email address. A blank value will return accounts with both null and “” email addresses. Note that multiple accounts can share one email address.

  • subscriber (Boolean)

    Filter for accounts with or without a subscription in the active, canceled, or future state.

  • past_due (String)

    Filter for accounts with an invoice in the past_due state.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1081
1082
1083
1084
# File 'lib/recurly/client/operations.rb', line 1081

def list_child_accounts(account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/accounts", account_id: )
  pager(path, **options)
end

#list_coupons(**options) ⇒ Pager<Resources::Coupon>

List a site's coupons

list_coupons api documenation

Examples:

coupons = @client.list_coupons(limit: 200)
coupons.each do |coupon|
  puts "coupon: #{coupon.code}"
end

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1163
1164
1165
1166
# File 'lib/recurly/client/operations.rb', line 1163

def list_coupons(**options)
  path = interpolate_path("/coupons")
  pager(path, **options)
end

#list_credit_payments(**options) ⇒ Pager<Resources::CreditPayment>

List a site's credit payments

list_credit_payments api documenation

Examples:

payments = @client.list_credit_payments(limit: 200)
payments.each do |payment|
  puts "CreditPayment: #{payment.id}"
end

Parameters:

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1298
1299
1300
1301
# File 'lib/recurly/client/operations.rb', line 1298

def list_credit_payments(**options)
  path = interpolate_path("/credit_payments")
  pager(path, **options)
end

#list_custom_field_definitions(**options) ⇒ Pager<Resources::CustomFieldDefinition>

List a site's custom field definitions

list_custom_field_definitions api documenation

Examples:

custom_fields = @client.list_custom_field_definitions(limit: 200)
custom_fields.each do |field|
  puts "CustomFieldDefinition: #{field.name}"
end

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • related_type (String)

    Filter by related type.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1352
1353
1354
1355
# File 'lib/recurly/client/operations.rb', line 1352

def list_custom_field_definitions(**options)
  path = interpolate_path("/custom_field_definitions")
  pager(path, **options)
end

#list_invoice_coupon_redemptions(invoice_id:, **options) ⇒ Pager<Resources::CouponRedemption>

Show the coupon redemptions applied to an invoice

list_invoice_coupon_redemptions api documenation

Examples:

coupon_redemptions = @client.list_invoice_coupon_redemptions(
  invoice_id: invoice_id,
  limit: 200
)
coupon_redemptions.each do |redemption|
  puts "CouponRedemption: #{redemption.id}"
end

Parameters:

  • invoice_id (String)

    Invoice ID or number. For ID no prefix is used e.g. e28zov4fw0v2. For number use prefix number-, e.g. number-1000.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1751
1752
1753
1754
# File 'lib/recurly/client/operations.rb', line 1751

def list_invoice_coupon_redemptions(invoice_id:, **options)
  path = interpolate_path("/invoices/{invoice_id}/coupon_redemptions", invoice_id: invoice_id)
  pager(path, **options)
end

#list_invoice_line_items(invoice_id:, **options) ⇒ Pager<Resources::LineItem>

List an invoice's line items

list_invoice_line_items api documenation

Parameters:

  • invoice_id (String)

    Invoice ID or number. For ID no prefix is used e.g. e28zov4fw0v2. For number use prefix number-, e.g. number-1000.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • original (String)

    Filter by original field.

  • state (String)

    Filter by state field.

  • type (String)

    Filter by type field.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1708
1709
1710
1711
# File 'lib/recurly/client/operations.rb', line 1708

def list_invoice_line_items(invoice_id:, **options)
  path = interpolate_path("/invoices/{invoice_id}/line_items", invoice_id: invoice_id)
  pager(path, **options)
end

#list_invoices(**options) ⇒ Pager<Resources::Invoice>

List a site's invoices

list_invoices api documenation

Examples:

invoices = @client.list_invoices(limit: 200)
invoices.each do |invoice|
  puts "Invoice: #{invoice.number}"
end

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • type (String)

    Filter by type when:

    • type=charge, only charge invoices will be returned.

    • type=credit, only credit invoices will be returned.

    • type=non-legacy, only charge and credit invoices will be returned.

    • type=legacy, only legacy invoices will be returned.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1508
1509
1510
1511
# File 'lib/recurly/client/operations.rb', line 1508

def list_invoices(**options)
  path = interpolate_path("/invoices")
  pager(path, **options)
end

#list_items(**options) ⇒ Pager<Resources::Item>

List a site's items

list_items api documenation

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • state (String)

    Filter by state.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1400
1401
1402
1403
# File 'lib/recurly/client/operations.rb', line 1400

def list_items(**options)
  path = interpolate_path("/items")
  pager(path, **options)
end

#list_line_items(**options) ⇒ Pager<Resources::LineItem>

List a site's line items

list_line_items api documenation

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • original (String)

    Filter by original field.

  • state (String)

    Filter by state field.

  • type (String)

    Filter by type field.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1831
1832
1833
1834
# File 'lib/recurly/client/operations.rb', line 1831

def list_line_items(**options)
  path = interpolate_path("/line_items")
  pager(path, **options)
end

#list_plan_add_ons(plan_id:, **options) ⇒ Pager<Resources::AddOn>

List a plan's add-ons

list_plan_add_ons api documenation

Examples:

add_ons = @client.list_plan_add_ons(
  plan_id: plan_id,
  limit: 200
)
add_ons.each do |add_on|
  puts "AddOn: #{add_on.code}"
end

Parameters:

  • plan_id (String)

    Plan ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-gold.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • state (String)

    Filter by state.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2051
2052
2053
2054
# File 'lib/recurly/client/operations.rb', line 2051

def list_plan_add_ons(plan_id:, **options)
  path = interpolate_path("/plans/{plan_id}/add_ons", plan_id: plan_id)
  pager(path, **options)
end

#list_plans(**options) ⇒ Pager<Resources::Plan>

List a site's plans

list_plans api documenation

Examples:

plans = @client.list_plans(limit: 200)
plans.each do |plan|
  puts "Plan: #{plan.code}"
end

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • state (String)

    Filter by state.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1919
1920
1921
1922
# File 'lib/recurly/client/operations.rb', line 1919

def list_plans(**options)
  path = interpolate_path("/plans")
  pager(path, **options)
end

List an invoice's related credit or charge invoices

list_related_invoices api documenation

Parameters:

  • invoice_id (String)

    Invoice ID or number. For ID no prefix is used e.g. e28zov4fw0v2. For number use prefix number-, e.g. number-1000.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1763
1764
1765
1766
# File 'lib/recurly/client/operations.rb', line 1763

def list_related_invoices(invoice_id:, **options)
  path = interpolate_path("/invoices/{invoice_id}/related_invoices", invoice_id: invoice_id)
  pager(path, **options)
end

#list_shipping_addresses(account_id:, **options) ⇒ Pager<Resources::ShippingAddress>

Fetch a list of an account's shipping addresses

list_shipping_addresses api documenation

Examples:

shipping_addresses = @client.list_shipping_addresses(
  account_id: ,
  limit: 200
)
shipping_addresses.each do |addr|
  puts "ShippingAddress: #{addr.nickname} - #{addr.street1}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


835
836
837
838
# File 'lib/recurly/client/operations.rb', line 835

def list_shipping_addresses(account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/shipping_addresses", account_id: )
  pager(path, **options)
end

#list_shipping_methods(**options) ⇒ Pager<Resources::ShippingMethod>

List a site's shipping methods

list_shipping_methods api documenation

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2199
2200
2201
2202
# File 'lib/recurly/client/operations.rb', line 2199

def list_shipping_methods(**options)
  path = interpolate_path("/shipping_methods")
  pager(path, **options)
end

#list_sites(**options) ⇒ Pager<Resources::Site>

Examples:

sites = @client.list_sites(limit: 200)
sites.each do |site|
  puts "Site: #{site.subdomain}"
end

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

Returns:


40
41
42
43
# File 'lib/recurly/client/operations.rb', line 40

def list_sites(**options)
  path = "/sites"
  pager(path, **options)
end

#list_subscription_coupon_redemptions(subscription_id:, **options) ⇒ Pager<Resources::CouponRedemption>

Show the coupon redemptions for a subscription

list_subscription_coupon_redemptions api documenation

Examples:

coupon_redemptions = @client.list_subscription_coupon_redemptions(
  subscription_id: subscription_id,
  limit: 200
)
coupon_redemptions.each do |redemption|
  puts "CouponRedemption: #{redemption.id}"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2701
2702
2703
2704
# File 'lib/recurly/client/operations.rb', line 2701

def list_subscription_coupon_redemptions(subscription_id:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/coupon_redemptions", subscription_id: subscription_id)
  pager(path, **options)
end

#list_subscription_invoices(subscription_id:, **options) ⇒ Pager<Resources::Invoice>

List a subscription's invoices

list_subscription_invoices api documenation

Examples:

invoices = @client.list_subscription_invoices(
  subscription_id: subscription_id,
  limit: 200
)
invoices.each do |invoice|
  puts "Invoice: #{invoice.number}"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • type (String)

    Filter by type when:

    • type=charge, only charge invoices will be returned.

    • type=credit, only credit invoices will be returned.

    • type=non-legacy, only charge and credit invoices will be returned.

    • type=legacy, only legacy invoices will be returned.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2610
2611
2612
2613
# File 'lib/recurly/client/operations.rb', line 2610

def list_subscription_invoices(subscription_id:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/invoices", subscription_id: subscription_id)
  pager(path, **options)
end

#list_subscription_line_items(subscription_id:, **options) ⇒ Pager<Resources::LineItem>

List a subscription's line items

list_subscription_line_items api documenation

Examples:

line_items = @client.list_subscription_line_items(
  subscription_id: subscription_id,
  limit: 200
)
line_items.each do |line_item|
  puts "LineItem: #{line_item.id}"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • original (String)

    Filter by original field.

  • state (String)

    Filter by state field.

  • type (String)

    Filter by type field.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2658
2659
2660
2661
# File 'lib/recurly/client/operations.rb', line 2658

def list_subscription_line_items(subscription_id:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/line_items", subscription_id: subscription_id)
  pager(path, **options)
end

#list_subscriptions(**options) ⇒ Pager<Resources::Subscription>

List a site's subscriptions

list_subscriptions api documenation

Examples:

subscriptions = @client.list_subscriptions(limit: 200)
subscriptions.each do |subscription|
  puts "Subscription: #{subscription.uuid}"
end

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • state (String)

    Filter by state.

    • When state=active, state=canceled, state=expired, or state=future, subscriptions with states that match the query and only those subscriptions will be returned.

    • When state=in_trial, only subscriptions that have a trial_started_at date earlier than now and a trial_ends_at date later than now will be returned.

    • When state=live, only subscriptions that are in an active, canceled, or future state or are in trial will be returned.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2258
2259
2260
2261
# File 'lib/recurly/client/operations.rb', line 2258

def list_subscriptions(**options)
  path = interpolate_path("/subscriptions")
  pager(path, **options)
end

#list_transactions(**options) ⇒ Pager<Resources::Transaction>

List a site's transactions

list_transactions api documenation

Examples:

transactions = @client.list_transactions(limit: 200)
transactions.each do |transaction|
  puts "Transaction: #{transaction.uuid}"
end

Parameters:

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • type (String)

    Filter by type field. The value payment will return both purchase and capture transactions.

  • success (String)

    Filter by success field.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2744
2745
2746
2747
# File 'lib/recurly/client/operations.rb', line 2744

def list_transactions(**options)
  path = interpolate_path("/transactions")
  pager(path, **options)
end

#list_unique_coupon_codes(coupon_id:, **options) ⇒ Pager<Resources::UniqueCouponCode>

List unique coupon codes associated with a bulk coupon

list_unique_coupon_codes api documenation

Parameters:

  • coupon_id (String)

    Coupon ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-10off.

  • ids (String)

    Filter results by their IDs. Up to 200 IDs can be passed at once using commas as separators, e.g. ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6.

    *Important notes:*

    • The ids parameter cannot be used with any other ordering or filtering parameters (limit, order, sort, begin_time, end_time, etc)

    • Invalid or unknown IDs will be ignored, so you should check that the results correspond to your request.

    • Records are returned in an arbitrary order. Since results are all returned at once you can sort the records yourself.

  • limit (Integer)

    Limit number of records 1-200.

  • order (String)

    Sort order.

  • sort (String)

    Sort field. You really only want to sort by updated_at in ascending order. In descending order updated records will move behind the cursor and could prevent some records from being returned.

  • begin_time (DateTime)

    Filter by begin_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • end_time (DateTime)

    Filter by end_time when sort=created_at or sort=updated_at. Note: this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1269
1270
1271
1272
# File 'lib/recurly/client/operations.rb', line 1269

def list_unique_coupon_codes(coupon_id:, **options)
  path = interpolate_path("/coupons/{coupon_id}/unique_coupon_codes", coupon_id: coupon_id)
  pager(path, **options)
end

#mark_invoice_successful(invoice_id:, **options) ⇒ Resources::Invoice

Mark an open invoice as successful

mark_invoice_successful api documenation

Examples:

begin
  invoice = @client.mark_invoice_successful(invoice_id: invoice_id)
  puts "Marked invoice sucessful #{invoice}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • invoice_id (String)

    Invoice ID or number. For ID no prefix is used e.g. e28zov4fw0v2. For number use prefix number-, e.g. number-1000.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1635
1636
1637
1638
# File 'lib/recurly/client/operations.rb', line 1635

def mark_invoice_successful(invoice_id:, **options)
  path = interpolate_path("/invoices/{invoice_id}/mark_successful", invoice_id: invoice_id)
  put(path, **options)
end

#modify_subscription(subscription_id:, body:, **options) ⇒ Resources::Subscription

Modify a subscription

modify_subscription api documenation

Examples:

begin
  subscription_update = {
    customer_notes: "New Notes",
    terms_and_conditions: "New ToC"
  }
  subscription = @client.modify_subscription(
    subscription_id: subscription_id,
    body: subscription_update
  )
  puts "Modified Subscription #{subscription}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • body (Requests::SubscriptionUpdate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::SubscriptionUpdate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2345
2346
2347
2348
# File 'lib/recurly/client/operations.rb', line 2345

def modify_subscription(subscription_id:, body:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}", subscription_id: subscription_id)
  put(path, body, Requests::SubscriptionUpdate, **options)
end

#next_page(pager) ⇒ Object


52
53
54
55
56
# File 'lib/recurly/client.rb', line 52

def next_page(pager)
  req = HTTP::Request.new(:get, pager.next, nil)
  faraday_resp = run_request(req, headers)
  handle_response! req, faraday_resp
end

#pause_subscription(subscription_id:, body:, **options) ⇒ Resources::Subscription

Examples:

begin
  subscription_pause = {
    remaining_pause_cycles: 10
  }
  subscription = @client.pause_subscription(
    subscription_id: subscription_id,
    body: subscription_pause
  )
  puts "Paused Subscription #{subscription}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • body (Requests::SubscriptionPause)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::SubscriptionPause

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2457
2458
2459
2460
# File 'lib/recurly/client/operations.rb', line 2457

def pause_subscription(subscription_id:, body:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/pause", subscription_id: subscription_id)
  put(path, body, Requests::SubscriptionPause, **options)
end

#preview_invoice(account_id:, body:, **options) ⇒ Resources::InvoiceCollection

Preview new invoice for pending line items

preview_invoice api documenation

Examples:

begin
  invoice_preview = {
    currency: "USD",
    collection_method: "automatic"
  }
  collection = @client.create_invoice(
    account_id: ,
    body: invoice_preview
  )
  puts "Created InvoiceCollection #{collection}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • body (Requests::InvoiceCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::InvoiceCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


655
656
657
658
# File 'lib/recurly/client/operations.rb', line 655

def preview_invoice(account_id:, body:, **options)
  path = interpolate_path("/accounts/{account_id}/invoices/preview", account_id: )
  post(path, body, Requests::InvoiceCreate, **options)
end

#preview_purchase(body:, **options) ⇒ Resources::InvoiceCollection

Preview a new purchase

preview_purchase api documenation

Examples:

begin
  purchase = {
    currency: "USD",
    account: {
      code: ,
      first_name: "Benjamin",
      last_name: "Du Monde",
      billing_info: {
        token_id: rjs_token_id
      },
    },
    subscriptions: [
      { plan_code: plan_code }
    ]
  }
  invoice_collection = @client.preview_purchase(
    body: purchase
  )
  puts "Preview Charge Invoice #{invoice_collection.charge_invoice}"
  puts "Preview Credit Invoices #{invoice_collection.credit_invoices}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • body (Requests::PurchaseCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::PurchaseCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2880
2881
2882
2883
# File 'lib/recurly/client/operations.rb', line 2880

def preview_purchase(body:, **options)
  path = interpolate_path("/purchases/preview")
  post(path, body, Requests::PurchaseCreate, **options)
end

#put_invoice(invoice_id:, body:, **options) ⇒ Resources::Invoice

Update an invoice

put_invoice api documenation

Parameters:

  • invoice_id (String)

    Invoice ID or number. For ID no prefix is used e.g. e28zov4fw0v2. For number use prefix number-, e.g. number-1000.

  • body (Requests::InvoiceUpdatable)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::InvoiceUpdatable

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1543
1544
1545
1546
# File 'lib/recurly/client/operations.rb', line 1543

def put_invoice(invoice_id:, body:, **options)
  path = interpolate_path("/invoices/{invoice_id}", invoice_id: invoice_id)
  put(path, body, Requests::InvoiceUpdatable, **options)
end

#reactivate_account(account_id:, **options) ⇒ Resources::Account

Reactivate an inactive account

reactivate_account api documenation

Examples:

begin
   = @client.(account_id: )
  puts "Reactivated account #{}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


298
299
300
301
# File 'lib/recurly/client/operations.rb', line 298

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/reactivate", account_id: )
  put(path, **options)
end

#reactivate_item(item_id:, **options) ⇒ Resources::Item

Reactivate an inactive item

reactivate_item api documenation

Parameters:

  • item_id (String)

    Item ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-red.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1461
1462
1463
1464
# File 'lib/recurly/client/operations.rb', line 1461

def reactivate_item(item_id:, **options)
  path = interpolate_path("/items/{item_id}/reactivate", item_id: item_id)
  put(path, **options)
end

#reactivate_subscription(subscription_id:, **options) ⇒ Resources::Subscription

Reactivate a canceled subscription

reactivate_subscription api documenation

Examples:

begin
  subscription = @client.reactivate_subscription(
    subscription_id: subscription_id
  )
  puts "Reactivated Canceled Subscription #{subscription}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2428
2429
2430
2431
# File 'lib/recurly/client/operations.rb', line 2428

def reactivate_subscription(subscription_id:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/reactivate", subscription_id: subscription_id)
  put(path, **options)
end

#reactivate_unique_coupon_code(unique_coupon_code_id:, **options) ⇒ Resources::UniqueCouponCode

Restore a unique coupon code

reactivate_unique_coupon_code api documenation

Parameters:

  • unique_coupon_code_id (String)

    Unique Coupon Code ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-abc-8dh2-def.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2802
2803
2804
2805
# File 'lib/recurly/client/operations.rb', line 2802

def reactivate_unique_coupon_code(unique_coupon_code_id:, **options)
  path = interpolate_path("/unique_coupon_codes/{unique_coupon_code_id}/restore", unique_coupon_code_id: unique_coupon_code_id)
  put(path, **options)
end

#refund_invoice(invoice_id:, body:, **options) ⇒ Resources::Invoice

Examples:

begin
  invoice_refund = {
    type: "amount",
    amount: 100,
  }
  invoice = @client.refund_invoice(
    invoice_id: invoice_id,
    body: invoice_refund
  )
  puts "Refunded invoice #{invoice}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • invoice_id (String)

    Invoice ID or number. For ID no prefix is used e.g. e28zov4fw0v2. For number use prefix number-, e.g. number-1000.

  • body (Requests::InvoiceRefund)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::InvoiceRefund

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1793
1794
1795
1796
# File 'lib/recurly/client/operations.rb', line 1793

def refund_invoice(invoice_id:, body:, **options)
  path = interpolate_path("/invoices/{invoice_id}/refund", invoice_id: invoice_id)
  post(path, body, Requests::InvoiceRefund, **options)
end

#remove_account_acquisition(account_id:, **options) ⇒ Empty

Remove an account's acquisition data

remove_account_acquisition api documenation

Examples:

begin
  acquisition = @client.(account_id: )
  puts "Removed AccountAcqusition #{acquisition}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:

  • (Empty)

    Acquisition data was succesfully deleted.


276
277
278
279
# File 'lib/recurly/client/operations.rb', line 276

def (account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/acquisition", account_id: )
  delete(path, **options)
end

#remove_billing_info(account_id:, **options) ⇒ Empty

Remove an account's billing information

remove_billing_info api documenation

Examples:

begin
  @client.remove_billing_info(account_id: )
  puts "Removed BillingInfo #{}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:

  • (Empty)

    Billing information deleted


394
395
396
397
# File 'lib/recurly/client/operations.rb', line 394

def remove_billing_info(account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/billing_info", account_id: )
  delete(path, **options)
end

#remove_coupon_redemption(account_id:, **options) ⇒ Resources::CouponRedemption

Delete the active coupon redemption from an account

remove_coupon_redemption api documenation

Examples:

begin
  @client.remove_coupon_redemption(account_id: )
  puts "Removed CouponRedemption #{}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


511
512
513
514
# File 'lib/recurly/client/operations.rb', line 511

def remove_coupon_redemption(account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/coupon_redemptions/active", account_id: )
  delete(path, **options)
end

#remove_line_item(line_item_id:, **options) ⇒ Empty

Delete an uninvoiced line item

remove_line_item api documenation

Examples:

begin
  @client.remove_line_item(
    line_item_id: line_item_id
  )
  puts "Removed LineItem #{line_item_id}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • line_item_id (String)

    Line Item ID.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:

  • (Empty)

    Line item deleted.


1877
1878
1879
1880
# File 'lib/recurly/client/operations.rb', line 1877

def remove_line_item(line_item_id:, **options)
  path = interpolate_path("/line_items/{line_item_id}", line_item_id: line_item_id)
  delete(path, **options)
end

#remove_plan(plan_id:, **options) ⇒ Resources::Plan

Parameters:

  • plan_id (String)

    Plan ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-gold.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2005
2006
2007
2008
# File 'lib/recurly/client/operations.rb', line 2005

def remove_plan(plan_id:, **options)
  path = interpolate_path("/plans/{plan_id}", plan_id: plan_id)
  delete(path, **options)
end

#remove_plan_add_on(plan_id:, add_on_id:, **options) ⇒ Resources::AddOn

Parameters:

  • plan_id (String)

    Plan ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-gold.

  • add_on_id (String)

    Add-on ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-gold.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2116
2117
2118
2119
# File 'lib/recurly/client/operations.rb', line 2116

def remove_plan_add_on(plan_id:, add_on_id:, **options)
  path = interpolate_path("/plans/{plan_id}/add_ons/{add_on_id}", plan_id: plan_id, add_on_id: add_on_id)
  delete(path, **options)
end

#remove_shipping_address(account_id:, shipping_address_id:, **options) ⇒ Empty

Remove an account's shipping address

remove_shipping_address api documenation

Examples:

begin
  @client.remove_shipping_address(
    account_id: ,
    shipping_address_id: shipping_address_id
  )
  puts "Removed ShippingAddress #{shipping_address_id}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • shipping_address_id (String)

    Shipping Address ID.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:

  • (Empty)

    Shipping address deleted.


933
934
935
936
# File 'lib/recurly/client/operations.rb', line 933

def remove_shipping_address(account_id:, shipping_address_id:, **options)
  path = interpolate_path("/accounts/{account_id}/shipping_addresses/{shipping_address_id}", account_id: , shipping_address_id: shipping_address_id)
  delete(path, **options)
end

#remove_subscription_change(subscription_id:, **options) ⇒ Empty

Delete the pending subscription change

remove_subscription_change api documenation

Examples:

begin
  @client.remove_subscription_change(
    subscription_id: subscription_id
  )
  puts "Removed SubscriptionChange #{subscription_id}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:

  • (Empty)

    Subscription change was deleted.


2559
2560
2561
2562
# File 'lib/recurly/client/operations.rb', line 2559

def remove_subscription_change(subscription_id:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/change", subscription_id: subscription_id)
  delete(path, **options)
end

#reopen_invoice(invoice_id:, **options) ⇒ Resources::Invoice

Reopen a closed, manual invoice

reopen_invoice api documenation

Examples:

begin
  invoice = @client.reopen_invoice(invoice_id: invoice_id)
  puts "Reopened invoice #{invoice}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • invoice_id (String)

    Invoice ID or number. For ID no prefix is used e.g. e28zov4fw0v2. For number use prefix number-, e.g. number-1000.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1657
1658
1659
1660
# File 'lib/recurly/client/operations.rb', line 1657

def reopen_invoice(invoice_id:, **options)
  path = interpolate_path("/invoices/{invoice_id}/reopen", invoice_id: invoice_id)
  put(path, **options)
end

#resume_subscription(subscription_id:, **options) ⇒ Resources::Subscription

Examples:

begin
  subscription = @client.resume_subscription(
    subscription_id: subscription_id
  )
  puts "Resumed Subscription #{subscription}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2481
2482
2483
2484
# File 'lib/recurly/client/operations.rb', line 2481

def resume_subscription(subscription_id:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/resume", subscription_id: subscription_id)
  put(path, **options)
end

#terminate_subscription(subscription_id:, **options) ⇒ Resources::Subscription

Terminate a subscription

terminate_subscription api documenation

Examples:

begin
  subscription = @client.terminate_subscription(
    subscription_id: subscription_id,
  )
  puts "Terminated Subscription #{subscription}"
rescue Recurly::Errors::NotFoundError  # If the resource was not found, you may want to alert the user or
  # just return nil

  puts "Resource Not Found"
end

Parameters:

  • subscription_id (String)

    Subscription ID or UUID. For ID no prefix is used e.g. e28zov4fw0v2. For UUID use prefix uuid-, e.g. uuid-123457890.

  • refund (String)

    The type of refund to perform:

    • full - Performs a full refund of the last invoice for the current subscription term.

    • partial - Prorates a refund based on the amount of time remaining in the current bill cycle.

    • none - Terminates the subscription without a refund.

    In the event that the most recent invoice is a $0 invoice paid entirely by credit, Recurly will apply the credit back to the customer’s account.

    You may also terminate a subscription with no refund and then manually refund specific invoices.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2379
2380
2381
2382
# File 'lib/recurly/client/operations.rb', line 2379

def terminate_subscription(subscription_id:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}", subscription_id: subscription_id)
  delete(path, **options)
end

#update_account(account_id:, body:, **options) ⇒ Resources::Account

Examples:

begin
   = {
    first_name: "Aaron",
    last_name: "Du Monde",
  }
   = @client.(
    account_id: ,
    body: 
  )
  puts "Updated Account #{}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • body (Requests::AccountUpdate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::AccountUpdate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


197
198
199
200
# File 'lib/recurly/client/operations.rb', line 197

def (account_id:, body:, **options)
  path = interpolate_path("/accounts/{account_id}", account_id: )
  put(path, body, Requests::AccountUpdate, **options)
end

#update_account_acquisition(account_id:, body:, **options) ⇒ Resources::AccountAcquisition

Update an account's acquisition data

update_account_acquisition api documenation

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • body (Requests::AccountAcquisitionUpdatable)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::AccountAcquisitionUpdatable

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


254
255
256
257
# File 'lib/recurly/client/operations.rb', line 254

def (account_id:, body:, **options)
  path = interpolate_path("/accounts/{account_id}/acquisition", account_id: )
  put(path, body, Requests::AccountAcquisitionUpdatable, **options)
end

#update_billing_info(account_id:, body:, **options) ⇒ Resources::BillingInfo

Set an account's billing information

update_billing_info api documenation

Examples:

begin
  billing_update = {
    first_name: "Aaron",
    last_name: "Du Monde",
  }
  billing = @client.update_billing_info(
    account_id: ,
    body: billing_update
  )
  puts "Updated BillingInfo #{billing}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • body (Requests::BillingInfoCreate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::BillingInfoCreate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


372
373
374
375
# File 'lib/recurly/client/operations.rb', line 372

def update_billing_info(account_id:, body:, **options)
  path = interpolate_path("/accounts/{account_id}/billing_info", account_id: )
  put(path, body, Requests::BillingInfoCreate, **options)
end

#update_coupon(coupon_id:, body:, **options) ⇒ Resources::Coupon

Update an active coupon

update_coupon api documenation

Parameters:

  • coupon_id (String)

    Coupon ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-10off.

  • body (Requests::CouponUpdate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::CouponUpdate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1233
1234
1235
1236
# File 'lib/recurly/client/operations.rb', line 1233

def update_coupon(coupon_id:, body:, **options)
  path = interpolate_path("/coupons/{coupon_id}", coupon_id: coupon_id)
  put(path, body, Requests::CouponUpdate, **options)
end

#update_item(item_id:, body:, **options) ⇒ Resources::Item

Update an active item

update_item api documenation

Parameters:

  • item_id (String)

    Item ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-red.

  • body (Requests::ItemUpdate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::ItemUpdate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1437
1438
1439
1440
# File 'lib/recurly/client/operations.rb', line 1437

def update_item(item_id:, body:, **options)
  path = interpolate_path("/items/{item_id}", item_id: item_id)
  put(path, body, Requests::ItemUpdate, **options)
end

#update_plan(plan_id:, body:, **options) ⇒ Resources::Plan

Parameters:

  • plan_id (String)

    Plan ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-gold.

  • body (Requests::PlanUpdate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::PlanUpdate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1993
1994
1995
1996
# File 'lib/recurly/client/operations.rb', line 1993

def update_plan(plan_id:, body:, **options)
  path = interpolate_path("/plans/{plan_id}", plan_id: plan_id)
  put(path, body, Requests::PlanUpdate, **options)
end

#update_plan_add_on(plan_id:, add_on_id:, body:, **options) ⇒ Resources::AddOn

Parameters:

  • plan_id (String)

    Plan ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-gold.

  • add_on_id (String)

    Add-on ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-gold.

  • body (Requests::AddOnUpdate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::AddOnUpdate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


2103
2104
2105
2106
# File 'lib/recurly/client/operations.rb', line 2103

def update_plan_add_on(plan_id:, add_on_id:, body:, **options)
  path = interpolate_path("/plans/{plan_id}/add_ons/{add_on_id}", plan_id: plan_id, add_on_id: add_on_id)
  put(path, body, Requests::AddOnUpdate, **options)
end

#update_shipping_address(account_id:, shipping_address_id:, body:, **options) ⇒ Resources::ShippingAddress

Update an account's shipping address

update_shipping_address api documenation

Examples:

begin
  address_update = {
    first_name: "Aaron",
    last_name: "Du Monde",
    postal_code: "70130"
  }
  address = @client.update_shipping_address(
    account_id: ,
    shipping_address_id: shipping_address_id,
    body: address_update
  )
  puts "Updated ShippingAddress #{address}"
rescue Recurly::Errors::ValidationError => e  # If the request was invalid, you may want to tell your user
  # why. You can find the invalid params and reasons in e.recurly_error.params

  puts "ValidationError: #{e.recurly_error.params}"
end

Parameters:

  • account_id (String)

    Account ID or code. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-bob.

  • shipping_address_id (String)

    Shipping Address ID.

  • body (Requests::ShippingAddressUpdate)

    The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::ShippingAddressUpdate

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


907
908
909
910
# File 'lib/recurly/client/operations.rb', line 907

def update_shipping_address(account_id:, shipping_address_id:, body:, **options)
  path = interpolate_path("/accounts/{account_id}/shipping_addresses/{shipping_address_id}", account_id: , shipping_address_id: shipping_address_id)
  put(path, body, Requests::ShippingAddressUpdate, **options)
end

#void_invoice(invoice_id:, **options) ⇒ Resources::Invoice

Void a credit invoice.

void_invoice api documenation

Parameters:

  • invoice_id (String)

    Invoice ID or number. For ID no prefix is used e.g. e28zov4fw0v2. For number use prefix number-, e.g. number-1000.

  • site_id (String)

    Site ID or subdomain. For ID no prefix is used e.g. e28zov4fw0v2. For subdomain use prefix subdomain-, e.g. subdomain-recurly.

Returns:


1669
1670
1671
1672
# File 'lib/recurly/client/operations.rb', line 1669

def void_invoice(invoice_id:, **options)
  path = interpolate_path("/invoices/{invoice_id}/void", invoice_id: invoice_id)
  put(path, **options)
end