Class: Recurly::Client

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

Constant Summary collapse

API_HOSTS =
{
  us: "https://v3.recurly.com",
  eu: "https://v3.eu.recurly.com",
}
REGION =
:us
CA_FILE =
File.join(File.dirname(__FILE__), "../data/ca-certificates.crt")
BINARY_TYPES =
[
  "application/pdf",
].freeze
JSON_CONTENT_TYPE =
"application/json"
MAX_RETRIES =
3
LOG_LEVELS =
%i(debug info warn error fatal).freeze
BASE36_ALPHABET =
(("0".."9").to_a + ("a".."z").to_a).freeze
ALLOWED_OPTIONS =
[
  :site_id,
  :open_timeout,
  :read_timeout,
  :body,
  :params,
  :headers,
].freeze

Class Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(region: REGION, base_url: , ca_file: CA_FILE, api_key:, logger: nil) {|_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:

  • region (String) (defaults to: REGION)

    The DataCenter that is called by the API. Default to “us”

  • base_url (String) (defaults to: )

    The base URL for the API. Defaults to “v3.recurly.com

  • ca_file (String) (defaults to: CA_FILE)

    The CA bundle to use when connecting to the API. Defaults to “data/ca-certificates.crt”

  • api_key (String)

    The private API key

  • logger (Logger) (defaults to: nil)

    A logger to use. Defaults to creating a new STDOUT logger with level WARN.

Yields:

  • (_self)

Yield Parameters:

Raises:

  • (ArgumentError)


64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# File 'lib/recurly/client.rb', line 64

def initialize(region: REGION, base_url: API_HOSTS[:us], ca_file: CA_FILE, api_key:, logger: nil)
  raise ArgumentError, "'api_key' must be set to a non-nil value" if api_key.nil?

  raise ArgumentError, "Invalid region type. Expected one of: #{API_HOSTS.keys.join(", ")}" if !API_HOSTS.key?(region)

  base_url = API_HOSTS[region] if base_url == API_HOSTS[:us] && API_HOSTS.key?(region)

  set_api_key(api_key)
  set_connection_options(base_url, ca_file)

  if logger.nil?
    @logger = Logger.new(STDOUT).tap do |l|
      l.level = Logger::WARN
    end
  else
    unless LOG_LEVELS.all? { |lev| logger.respond_to?(lev) }
      raise ArgumentError, "You must pass in a logger implementation that responds to the following messages: #{LOG_LEVELS}"
    end
    @logger = logger
  end

  if @logger.level < Logger::INFO
    msg = <<-MSG
    The Recurly logger should not be initialized
    beyond the level INFO. It is currently configured to emit
    headers and request / response bodies. This has the potential to leak
    PII and other sensitive information and should never be used in production.
    MSG
    log_warn("SECURITY_WARNING", message: msg)
  end

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

Class Attribute Details

.connection_poolRecurly::ConnectionPool



171
172
173
# File 'lib/recurly/client.rb', line 171

def connection_pool
  @connection_pool
end

Instance Method Details

#api_versionObject



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

def api_version
  "v2021-02-25"
end

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

Apply available credit to a pending or past due charge invoice

apply_credit_balance api documentation

Examples:

begin
  invoice = @client.apply_credit_balance(invoice_id: invoice_id)
  puts "Applied credit balance to 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.

  • params (Hash)

    Optional query string 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:



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

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

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

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.

  • params (Hash)

    Optional query string parameters: :body [Requests::SubscriptionCancel] The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::SubscriptionCancel

Returns:



3570
3571
3572
3573
# File 'lib/recurly/client/operations.rb', line 3570

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 documentation

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.

  • params (Hash)

    Optional query string parameters: :body [Requests::InvoiceCollect] The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::InvoiceCollect

Returns:



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

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

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

Convert trial subscription

convert_trial api documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



3664
3665
3666
3667
# File 'lib/recurly/client/operations.rb', line 3664

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

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

Examples:

begin
   = {
    code: ,
    first_name: "Benjamin",
    last_name: "Du Monde",
    preferred_time_zone: "America/Chicago",
    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:

Returns:



169
170
171
172
# File 'lib/recurly/client/operations.rb', line 169

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

#create_account_external_account(account_id:, body:, **options) ⇒ Resources::ExternalAccount

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::ExternalAccountCreate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



777
778
779
780
# File 'lib/recurly/client/operations.rb', line 777

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

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

Add new billing information on an account

create_billing_info api documentation

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

  • params (Hash)

    Optional query string parameters:

Returns:



541
542
543
544
# File 'lib/recurly/client/operations.rb', line 541

def create_billing_info(account_id:, body:, **options)
  path = interpolate_path("/accounts/{account_id}/billing_infos", account_id: )
  post(path, body, Requests::BillingInfoCreate, **options)
end

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

Create a new coupon

create_coupon api documentation

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:

Returns:



1562
1563
1564
1565
# File 'lib/recurly/client/operations.rb', line 1562

def create_coupon(body:, **options)
  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 or subscription

create_coupon_redemption api documentation

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

  • params (Hash)

    Optional query string parameters:

Returns:



688
689
690
691
# File 'lib/recurly/client/operations.rb', line 688

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_external_product(body:, **options) ⇒ Resources::ExternalProduct

Create an external product

create_external_product api documentation

Parameters:

Returns:



2171
2172
2173
2174
# File 'lib/recurly/client/operations.rb', line 2171

def create_external_product(body:, **options)
  path = "/external_products"
  post(path, body, Requests::ExternalProductCreate, **options)
end

#create_external_product_external_product_reference(external_product_id:, body:, **options) ⇒ Resources::ExternalProductReferenceMini

Create an external product reference on an external product

create_external_product_external_product_reference api documentation

Parameters:

Returns:



2247
2248
2249
2250
# File 'lib/recurly/client/operations.rb', line 2247

def create_external_product_external_product_reference(external_product_id:, body:, **options)
  path = interpolate_path("/external_products/{external_product_id}/external_product_references", external_product_id: external_product_id)
  post(path, body, Requests::ExternalProductReferenceCreate, **options)
end

#create_gift_card(body:, **options) ⇒ Resources::GiftCard

Parameters:

Returns:



4522
4523
4524
4525
# File 'lib/recurly/client/operations.rb', line 4522

def create_gift_card(body:, **options)
  path = "/gift_cards"
  post(path, body, Requests::GiftCardCreate, **options)
end

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

Create an invoice for pending line items

create_invoice api documentation

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

  • params (Hash)

    Optional query string parameters:

Returns:



929
930
931
932
# File 'lib/recurly/client/operations.rb', line 929

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 documentation

Examples:

begin
  item_create = {
    code: item_code,
    name: "Item Name",
    description: "Item Description",
    external_sku: "a35JE-44",
    accounting_code: "item-code-127",
    revenue_schedule_type: "at_range_end",
    custom_fields: [{
      name: "custom-field-1",
      value: "Custom Field 1 value"
    }]
  }
  item = @client.create_item(body: item_create)
  puts "Created Item #{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:

  • body (Requests::ItemCreate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



1945
1946
1947
1948
# File 'lib/recurly/client/operations.rb', line 1945

def create_item(body:, **options)
  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 documentation

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

  • params (Hash)

    Optional query string parameters:

Returns:



1044
1045
1046
1047
# File 'lib/recurly/client/operations.rb', line 1044

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_measured_unit(body:, **options) ⇒ Resources::MeasuredUnit

Create a new measured unit

create_measured_unit api documentation

Parameters:

Returns:



2097
2098
2099
2100
# File 'lib/recurly/client/operations.rb', line 2097

def create_measured_unit(body:, **options)
  path = "/measured_units"
  post(path, body, Requests::MeasuredUnitCreate, **options)
end

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

Create a pending purchase

create_pending_purchase api documentation

Examples:

begin
  purchase = {
    currency: 'EUR',
    account: {
      code: ,
      email: '[email protected]',
      billing_info: {
        first_name: 'Benjamin',
        last_name: 'Du Monde',
        online_banking_payment_type: 'ideal'
      },
    },
    line_items: [
      {
        currency: 'EUR',
        unit_amount: 1000,
        type: 'charge'
      }
    ]
  }
  invoice_collection = @client.create_pending_purchase(body: purchase)
  puts "Created ChargeInvoice with UUID: #{invoice_collection.charge_invoice.uuid}"
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:

Returns:



4272
4273
4274
4275
# File 'lib/recurly/client/operations.rb', line 4272

def create_pending_purchase(body:, **options)
  path = "/purchases/pending"
  post(path, body, Requests::PurchaseCreate, **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

  • params (Hash)

    Optional query string parameters:

Returns:



2950
2951
2952
2953
# File 'lib/recurly/client/operations.rb', line 2950

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

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

Examples:

begin
  new_add_on = {
    code: 'coffee_grinder',
    name: 'A quality grinder for your beans',
    default_quantity: 1,
    currencies: [
      {
        currency: 'USD',
        unit_amount: 10_000
      }
    ]
  }
  add_on = @client.create_plan_add_on(plan_id: plan_id, body: new_add_on)
  puts "Created 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.

  • body (Requests::AddOnCreate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



3108
3109
3110
3111
# File 'lib/recurly/client/operations.rb', line 3108

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 documentation

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:

Returns:



4190
4191
4192
4193
# File 'lib/recurly/client/operations.rb', line 4190

def create_purchase(body:, **options)
  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 documentation

Examples:

begin
  shipping_address_create = {
    nickname: 'Work',
    street1: '900 Camp St',
    city: 'New Orleans',
    region: 'LA',
    country: 'US',
    postal_code: '70115',
    first_name: 'Joanna',
    last_name: 'Du Monde'
  }
  shipping_address = @client.create_shipping_address(account_id: , body: shipping_address_create)
  puts "Created Shipping Address #{shipping_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.

  • body (Requests::ShippingAddressCreate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



1188
1189
1190
1191
# File 'lib/recurly/client/operations.rb', line 1188

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_shipping_method(body:, **options) ⇒ Resources::ShippingMethod

Create a new shipping method

create_shipping_method api documentation

Parameters:

Returns:



3325
3326
3327
3328
# File 'lib/recurly/client/operations.rb', line 3325

def create_shipping_method(body:, **options)
  path = "/shipping_methods"
  post(path, body, Requests::ShippingMethodCreate, **options)
end

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

Create a new subscription

create_subscription api documentation

Examples:

begin
  subscription_create = {
    plan_code: plan_code,
    currency: "USD",
    # This can be an existing account or a new account
    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:

Returns:



3452
3453
3454
3455
# File 'lib/recurly/client/operations.rb', line 3452

def create_subscription(body:, **options)
  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 documentation

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

  • params (Hash)

    Optional query string parameters:

Returns:



3745
3746
3747
3748
# File 'lib/recurly/client/operations.rb', line 3745

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

#create_usage(subscription_id:, add_on_id:, body:, **options) ⇒ Resources::Usage

Log a usage record on this subscription add-on

create_usage api documentation

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.

  • 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::UsageCreate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



3995
3996
3997
3998
# File 'lib/recurly/client/operations.rb', line 3995

def create_usage(subscription_id:, add_on_id:, body:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/add_ons/{add_on_id}/usage", subscription_id: subscription_id, add_on_id: add_on_id)
  post(path, body, Requests::UsageCreate, **options)
end

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

Deactivate an account

deactivate_account api documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



246
247
248
249
# File 'lib/recurly/client/operations.rb', line 246

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

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

Examples:

begin
  coupon = @client.deactivate_coupon(coupon_id: coupon_id)
  puts "Deactivated 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.

  • params (Hash)

    Optional query string parameters:

Returns:



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

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

#deactivate_external_product_external_product_reference(external_product_id:, external_product_reference_id:, **options) ⇒ Resources::ExternalProductReferenceMini

Parameters:

  • external_product_id (String)

    External product id

  • external_product_reference_id (String)

    External product reference ID, e.g. d39iun2fw1v4.

  • params (Hash)

    Optional query string parameters:

Returns:



2277
2278
2279
2280
# File 'lib/recurly/client/operations.rb', line 2277

def deactivate_external_product_external_product_reference(external_product_id:, external_product_reference_id:, **options)
  path = interpolate_path("/external_products/{external_product_id}/external_product_references/{external_product_reference_id}", external_product_id: external_product_id, external_product_reference_id: external_product_reference_id)
  delete(path, **options)
end

#deactivate_external_products(external_product_id:, **options) ⇒ Resources::ExternalProduct

Deactivate an external product

deactivate_external_products api documentation

Parameters:

  • external_product_id (String)

    External product id

  • params (Hash)

    Optional query string parameters:

Returns:



2214
2215
2216
2217
# File 'lib/recurly/client/operations.rb', line 2214

def deactivate_external_products(external_product_id:, **options)
  path = interpolate_path("/external_products/{external_product_id}", external_product_id: external_product_id)
  delete(path, **options)
end

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

Examples:

begin
  item = @client.deactivate_item(item_id: item_id)
  puts "Deactivated Item #{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:

  • 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.

  • params (Hash)

    Optional query string parameters:

Returns:



2022
2023
2024
2025
# File 'lib/recurly/client/operations.rb', line 2022

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

#deactivate_shipping_method(shipping_method_id:, **options) ⇒ Resources::ShippingMethod

Deactivate a shipping method

deactivate_shipping_method api documentation

Parameters:

  • shipping_method_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.

  • params (Hash)

    Optional query string parameters:

Returns:



3368
3369
3370
3371
# File 'lib/recurly/client/operations.rb', line 3368

def deactivate_shipping_method(shipping_method_id:, **options)
  path = interpolate_path("/shipping_methods/{shipping_method_id}", shipping_method_id: shipping_method_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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



4136
4137
4138
4139
# File 'lib/recurly/client/operations.rb', line 4136

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

#delete_account_external_account(account_id:, external_account_id:, **options) ⇒ Resources::ExternalAccount

Delete an external account for an account

delete_account_external_account api documentation

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.

  • external_account_id (String)

    External account ID, e.g. s28zov4fw0cb.

  • params (Hash)

    Optional query string parameters:

Returns:



823
824
825
826
# File 'lib/recurly/client/operations.rb', line 823

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

#generate_unique_coupon_codes(coupon_id:, body:, **options) ⇒ Resources::UniqueCouponCodeParams

Generate unique coupon codes

generate_unique_coupon_codes api documentation

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::CouponBulkCreate)

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

  • params (Hash)

    Optional query string parameters:

Returns:

  • (Resources::UniqueCouponCodeParams)

    A set of parameters that can be passed to the ‘list_unique_coupon_codes` endpoint to obtain only the newly generated `UniqueCouponCodes`.



1650
1651
1652
1653
# File 'lib/recurly/client/operations.rb', line 1650

def generate_unique_coupon_codes(coupon_id:, body:, **options)
  path = interpolate_path("/coupons/{coupon_id}/generate", coupon_id: coupon_id)
  post(path, body, Requests::CouponBulkCreate, **options)
end

#get_a_billing_info(account_id:, billing_info_id:, **options) ⇒ Resources::BillingInfo

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.

  • billing_info_id (String)

    Billing Info ID. Can ONLY be used for sites utilizing the Wallet feature.

  • params (Hash)

    Optional query string parameters:

Returns:



556
557
558
559
# File 'lib/recurly/client/operations.rb', line 556

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

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

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.

  • params (Hash)

    Optional query string parameters:

Returns:



192
193
194
195
# File 'lib/recurly/client/operations.rb', line 192

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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



269
270
271
272
# File 'lib/recurly/client/operations.rb', line 269

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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



374
375
376
377
# File 'lib/recurly/client/operations.rb', line 374

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

#get_account_external_account(account_id:, external_account_id:, **options) ⇒ Resources::ExternalAccount

Get an external account for an account

get_account_external_account api documentation

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.

  • external_account_id (String)

    External account ID, e.g. s28zov4fw0cb.

  • params (Hash)

    Optional query string parameters:

Returns:



792
793
794
795
# File 'lib/recurly/client/operations.rb', line 792

def (account_id:, external_account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/external_accounts/{external_account_id}", account_id: , external_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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



1105
1106
1107
1108
# File 'lib/recurly/client/operations.rb', line 1105

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_add_on(add_on_id:, **options) ⇒ Resources::AddOn

Examples:

begin
  add_on = @client.get_add_on(add_on_id: add_on_id)
  puts "Got 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:

  • 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.

  • params (Hash)

    Optional query string parameters:

Returns:



3264
3265
3266
3267
# File 'lib/recurly/client/operations.rb', line 3264

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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



397
398
399
400
# File 'lib/recurly/client/operations.rb', line 397

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

#get_business_entity(business_entity_id:, **options) ⇒ Resources::BusinessEntity

Fetch a business entity

get_business_entity api documentation

Parameters:

  • business_entity_id (String)

    Business Entity ID. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-entity1.

  • params (Hash)

    Optional query string parameters:

Returns:



4482
4483
4484
4485
# File 'lib/recurly/client/operations.rb', line 4482

def get_business_entity(business_entity_id:, **options)
  path = interpolate_path("/business_entities/{business_entity_id}", business_entity_id: business_entity_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.

  • params (Hash)

    Optional query string parameters:

Returns:



1585
1586
1587
1588
# File 'lib/recurly/client/operations.rb', line 1585

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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



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

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 documentation

Examples:

begin
  custom_field_definition = @client.get_custom_field_definition(
    custom_field_definition_id: custom_field_definition_id
  )
  puts "Got Custom Field Definition #{custom_field_definition}"
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:

  • custom_field_definition_id (String)

    Custom Field Definition ID

  • params (Hash)

    Optional query string parameters:

Returns:



1821
1822
1823
1824
# File 'lib/recurly/client/operations.rb', line 1821

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_dunning_campaign(dunning_campaign_id:, **options) ⇒ Resources::DunningCampaign

Fetch a dunning campaign

get_dunning_campaign api documentation

Parameters:

  • dunning_campaign_id (String)

    Dunning Campaign ID, e.g. e28zov4fw0v2.

  • params (Hash)

    Optional query string parameters:

Returns:



4352
4353
4354
4355
# File 'lib/recurly/client/operations.rb', line 4352

def get_dunning_campaign(dunning_campaign_id:, **options)
  path = interpolate_path("/dunning_campaigns/{dunning_campaign_id}", dunning_campaign_id: dunning_campaign_id)
  get(path, **options)
end

#get_export_dates(**options) ⇒ Resources::ExportDates

List the dates that have an available export to download.

get_export_dates api documentation

Examples:

begin
  export_dates = @client.get_export_dates()
  export_dates.dates.each do |date|
    puts "Exports are available for: #{date}"
  end
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:

  • params (Hash)

    Optional query string parameters:

Returns:



4296
4297
4298
4299
# File 'lib/recurly/client/operations.rb', line 4296

def get_export_dates(**options)
  path = "/export_dates"
  get(path, **options)
end

#get_export_files(export_date:, **options) ⇒ Resources::ExportFiles

List of the export files that are available to download.

get_export_files api documentation

Examples:

begin
  export_files = @client.get_export_files(export_date: export_date)
  export_files.files.each do |file|
    puts "Export file download URL: #{file.href}"
  end
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:

  • export_date (String)

    Date for which to get a list of available automated export files. Date must be in YYYY-MM-DD format.

  • params (Hash)

    Optional query string parameters:

Returns:



4321
4322
4323
4324
# File 'lib/recurly/client/operations.rb', line 4321

def get_export_files(export_date:, **options)
  path = interpolate_path("/export_dates/{export_date}/export_files", export_date: export_date)
  get(path, **options)
end

#get_external_product(external_product_id:, **options) ⇒ Resources::ExternalProduct

Fetch an external product

get_external_product api documentation

Parameters:

  • external_product_id (String)

    External product id

  • params (Hash)

    Optional query string parameters:

Returns:



2185
2186
2187
2188
# File 'lib/recurly/client/operations.rb', line 2185

def get_external_product(external_product_id:, **options)
  path = interpolate_path("/external_products/{external_product_id}", external_product_id: external_product_id)
  get(path, **options)
end

#get_external_product_external_product_reference(external_product_id:, external_product_reference_id:, **options) ⇒ Resources::ExternalProductReferenceMini

Parameters:

  • external_product_id (String)

    External product id

  • external_product_reference_id (String)

    External product reference ID, e.g. d39iun2fw1v4.

  • params (Hash)

    Optional query string parameters:

Returns:



2262
2263
2264
2265
# File 'lib/recurly/client/operations.rb', line 2262

def get_external_product_external_product_reference(external_product_id:, external_product_reference_id:, **options)
  path = interpolate_path("/external_products/{external_product_id}/external_product_references/{external_product_reference_id}", external_product_id: external_product_id, external_product_reference_id: external_product_reference_id)
  get(path, **options)
end

#get_external_subscription(external_subscription_id:, **options) ⇒ Resources::ExternalSubscription

Fetch an external subscription

get_external_subscription api documentation

Parameters:

  • external_subscription_id (String)

    External subscription id

  • params (Hash)

    Optional query string parameters:

Returns:



2308
2309
2310
2311
# File 'lib/recurly/client/operations.rb', line 2308

def get_external_subscription(external_subscription_id:, **options)
  path = interpolate_path("/external_subscriptions/{external_subscription_id}", external_subscription_id: external_subscription_id)
  get(path, **options)
end

#get_gift_card(gift_card_id:, **options) ⇒ Resources::GiftCard

Parameters:

  • gift_card_id (String)

    Gift Card ID, e.g. e28zov4fw0v2.

  • params (Hash)

    Optional query string parameters:

Returns:



4536
4537
4538
4539
# File 'lib/recurly/client/operations.rb', line 4536

def get_gift_card(gift_card_id:, **options)
  path = interpolate_path("/gift_cards/{gift_card_id}", gift_card_id: gift_card_id)
  get(path, **options)
end

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

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.

  • params (Hash)

    Optional query string parameters:

Returns:



2402
2403
2404
2405
# File 'lib/recurly/client/operations.rb', line 2402

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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



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

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

#get_invoice_template(invoice_template_id:, **options) ⇒ Resources::InvoiceTemplate

Fetch an invoice template

get_invoice_template api documentation

Parameters:

  • invoice_template_id (String)

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

  • params (Hash)

    Optional query string parameters:

Returns:



4398
4399
4400
4401
# File 'lib/recurly/client/operations.rb', line 4398

def get_invoice_template(invoice_template_id:, **options)
  path = interpolate_path("/invoice_templates/{invoice_template_id}", invoice_template_id: invoice_template_id)
  get(path, **options)
end

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

Examples:

begin
  item = @client.get_item(item_id: item_id)
  puts "Got Item #{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:

  • 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.

  • params (Hash)

    Optional query string parameters:

Returns:



1968
1969
1970
1971
# File 'lib/recurly/client/operations.rb', line 1968

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

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.

  • params (Hash)

    Optional query string parameters:

Returns:



2839
2840
2841
2842
# File 'lib/recurly/client/operations.rb', line 2839

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_measured_unit(measured_unit_id:, **options) ⇒ Resources::MeasuredUnit

Fetch a measured unit

get_measured_unit api documentation

Parameters:

  • measured_unit_id (String)

    Measured unit ID or name. For ID no prefix is used e.g. e28zov4fw0v2. For name use prefix name-, e.g. name-Storage.

  • params (Hash)

    Optional query string parameters:

Returns:



2111
2112
2113
2114
# File 'lib/recurly/client/operations.rb', line 2111

def get_measured_unit(measured_unit_id:, **options)
  path = interpolate_path("/measured_units/{measured_unit_id}", measured_unit_id: measured_unit_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.

  • params (Hash)

    Optional query string parameters:

Returns:



2973
2974
2975
2976
# File 'lib/recurly/client/operations.rb', line 2973

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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



3134
3135
3136
3137
# File 'lib/recurly/client/operations.rb', line 3134

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_preview_renewal(subscription_id:, **options) ⇒ Resources::InvoiceCollection

Fetch a preview of a subscription’s renewal invoice(s)

get_preview_renewal api documentation

Examples:

begin
  invoice_collection = @client.get_preview_renewal(
    subscription_id: subscription_id
  )
  puts "Fetched Renewal Preview with total: #{invoice_collection.charge_invoice.total}"
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.

  • params (Hash)

    Optional query string parameters:

Returns:



3689
3690
3691
3692
# File 'lib/recurly/client/operations.rb', line 3689

def get_preview_renewal(subscription_id:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/preview_renewal", subscription_id: subscription_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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



1215
1216
1217
1218
# File 'lib/recurly/client/operations.rb', line 1215

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(shipping_method_id:, **options) ⇒ Resources::ShippingMethod

Fetch a shipping method

get_shipping_method api documentation

Parameters:

  • shipping_method_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.

  • params (Hash)

    Optional query string parameters:

Returns:



3339
3340
3341
3342
# File 'lib/recurly/client/operations.rb', line 3339

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

#get_site(site_id:, **options) ⇒ Resources::Site

Examples:

begin
  site = @client.get_site(site_id: site_id)
  puts "Got Site #{site}"
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:

  • 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.

  • params (Hash)

    Optional query string parameters:

Returns:



69
70
71
72
# File 'lib/recurly/client/operations.rb', line 69

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

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

Fetch a subscription

get_subscription api documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



3477
3478
3479
3480
# File 'lib/recurly/client/operations.rb', line 3477

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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



3714
3715
3716
3717
# File 'lib/recurly/client/operations.rb', line 3714

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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



4108
4109
4110
4111
# File 'lib/recurly/client/operations.rb', line 4108

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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



4122
4123
4124
4125
# File 'lib/recurly/client/operations.rb', line 4122

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

#get_usage(usage_id:, **options) ⇒ Resources::Usage

Get a usage record

get_usage api documentation

Parameters:

  • usage_id (String)

    Usage Record ID.

  • params (Hash)

    Optional query string parameters:

Returns:



4009
4010
4011
4012
# File 'lib/recurly/client/operations.rb', line 4009

def get_usage(usage_id:, **options)
  path = interpolate_path("/usage/{usage_id}", usage_id: usage_id)
  get(path, **options)
end

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

List a site’s account acquisition data

list_account_acquisition api documentation

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] Inclusively 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] Inclusively 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.

Examples:

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

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



1481
1482
1483
1484
# File 'lib/recurly/client/operations.rb', line 1481

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

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

List the coupon redemptions for an account

list_account_coupon_redemptions api documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
redemptions = @client.(
  account_id: ,
  params: params
)
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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



635
636
637
638
# File 'lib/recurly/client/operations.rb', line 635

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 documentation

order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.

     :begin_time [DateTime] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
payments = @client.(
  account_id: ,
  params: params
)
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.

  • params (Hash)

    Optional query string 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

Returns:



748
749
750
751
# File 'lib/recurly/client/operations.rb', line 748

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

#list_account_external_account(account_id:, **options) ⇒ Pager<Resources::ExternalAccount>

List external accounts for an account

list_account_external_account api documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



762
763
764
765
# File 'lib/recurly/client/operations.rb', line 762

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

#list_account_external_invoices(account_id:, **options) ⇒ Pager<Resources::ExternalInvoice>

List the external invoices on an account

list_account_external_invoices api documentation

order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.

     :limit [Integer] Limit number of records 1-200.
     :order [String] Sort order.

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.

  • params (Hash)

    Optional query string parameters: :sort [String] Sort field. You really only want to sort by updated_at in ascending

Returns:



843
844
845
846
# File 'lib/recurly/client/operations.rb', line 843

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

#list_account_external_subscriptions(account_id:, **options) ⇒ Pager<Resources::ExternalSubscription>

List an account’s external subscriptions

list_account_external_subscriptions api documentation

order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.

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.

  • params (Hash)

    Optional query string parameters: :sort [String] Sort field. You really only want to sort by updated_at in ascending

Returns:



4468
4469
4470
4471
# File 'lib/recurly/client/operations.rb', line 4468

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

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

List an account’s invoices

list_account_invoices api documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
invoices = @client.(
  account_id: ,
  params: params
)
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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



898
899
900
901
# File 'lib/recurly/client/operations.rb', line 898

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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
line_items = @client.(
  account_id: ,
  params: params
)
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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



1012
1013
1014
1015
# File 'lib/recurly/client/operations.rb', line 1012

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>

List an account’s notes

list_account_notes api documentation

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.

Examples:

params = {
  limit: 200
}
 = @client.(account_id: , params: params)
.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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



1078
1079
1080
1081
# File 'lib/recurly/client/operations.rb', line 1078

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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
subscriptions = @client.(
  account_id: ,
  params: params
)
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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



1331
1332
1333
1334
# File 'lib/recurly/client/operations.rb', line 1331

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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
transactions = @client.(
  account_id: ,
  params: params
)
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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



1382
1383
1384
1385
# File 'lib/recurly/client/operations.rb', line 1382

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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

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

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



119
120
121
122
# File 'lib/recurly/client/operations.rb', line 119

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

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

List the coupon redemptions that are active on an account

list_active_coupon_redemptions api documentation

Examples:

params = {
  limit: 200
}
redemptions = @client.list_active_coupon_redemptions(account_id: , params: params)
redemptions.each do |redemption|
  puts "Redemption: #{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.

  • params (Hash)

    Optional query string parameters:

Returns:



657
658
659
660
# File 'lib/recurly/client/operations.rb', line 657

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

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

List a site’s add-ons

list_add_ons api documentation

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] Inclusively 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] Inclusively 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.

Examples:

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

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



3241
3242
3243
3244
# File 'lib/recurly/client/operations.rb', line 3241

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

#list_billing_infos(account_id:, **options) ⇒ Pager<Resources::BillingInfo>

Get the list of billing information associated with an account

list_billing_infos api documentation

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] Inclusively 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] Inclusively 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.

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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



526
527
528
529
# File 'lib/recurly/client/operations.rb', line 526

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

#list_business_entities(**options) ⇒ Pager<Resources::BusinessEntity>

Parameters:

  • params (Hash)

    Optional query string parameters:

Returns:



4495
4496
4497
4498
# File 'lib/recurly/client/operations.rb', line 4495

def list_business_entities(**options)
  path = "/business_entities"
  pager(path, **options)
end

#list_business_entity_invoices(business_entity_id:, **options) ⇒ Pager<Resources::Invoice>

List a business entity’s invoices

list_business_entity_invoices api documentation

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] Inclusively 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] Inclusively 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.

Parameters:

  • business_entity_id (String)

    Business Entity ID. For ID no prefix is used e.g. e28zov4fw0v2. For code use prefix code-, e.g. code-entity1.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



4609
4610
4611
4612
# File 'lib/recurly/client/operations.rb', line 4609

def list_business_entity_invoices(business_entity_id:, **options)
  path = interpolate_path("/business_entities/{business_entity_id}/invoices", business_entity_id: business_entity_id)
  pager(path, **options)
end

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

List an account’s child accounts

list_child_accounts api documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
child_accounts = @client.list_child_accounts(
  account_id: ,
  params: params
)
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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



1436
1437
1438
1439
# File 'lib/recurly/client/operations.rb', line 1436

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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

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

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



1526
1527
1528
1529
# File 'lib/recurly/client/operations.rb', line 1526

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

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

List a site’s credit payments

list_credit_payments api documentation

order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.

     :begin_time [DateTime] Inclusively 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] Inclusively 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.

Examples:

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

Parameters:

  • params (Hash)

    Optional query string 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

Returns:



1736
1737
1738
1739
# File 'lib/recurly/client/operations.rb', line 1736

def list_credit_payments(**options)
  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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

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

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



1796
1797
1798
1799
# File 'lib/recurly/client/operations.rb', line 1796

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

#list_dunning_campaigns(**options) ⇒ Pager<Resources::DunningCampaign>

List the dunning campaigns for a site

list_dunning_campaigns api documentation

order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.

Parameters:

  • params (Hash)

    Optional query string parameters: :sort [String] Sort field. You really only want to sort by updated_at in ascending

Returns:



4338
4339
4340
4341
# File 'lib/recurly/client/operations.rb', line 4338

def list_dunning_campaigns(**options)
  path = "/dunning_campaigns"
  pager(path, **options)
end

#list_entitlements(account_id:, **options) ⇒ Pager<Resources::Entitlements>

List entitlements granted to an account

list_entitlements api documentation

- 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 no state is provided, subscriptions with active or canceled states will be returned.

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.

  • params (Hash)

    Optional query string parameters: :state [String] Filter the entitlements based on the state of the applicable subscription.

Returns:



4450
4451
4452
4453
# File 'lib/recurly/client/operations.rb', line 4450

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

#list_external_invoices(**options) ⇒ Pager<Resources::ExternalInvoice>

List the external invoices on a site

list_external_invoices api documentation

order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.

     :limit [Integer] Limit number of records 1-200.
     :order [String] Sort order.

Parameters:

  • params (Hash)

    Optional query string parameters: :sort [String] Sort field. You really only want to sort by updated_at in ascending

Returns:



4417
4418
4419
4420
# File 'lib/recurly/client/operations.rb', line 4417

def list_external_invoices(**options)
  path = "/external_invoices"
  pager(path, **options)
end

#list_external_product_external_product_references(external_product_id:, **options) ⇒ Pager<Resources::ExternalProductReferenceCollection>

List the external product references for an external product

list_external_product_external_product_references api documentation

order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.

Parameters:

  • external_product_id (String)

    External product id

  • params (Hash)

    Optional query string parameters: :sort [String] Sort field. You really only want to sort by updated_at in ascending

Returns:



2232
2233
2234
2235
# File 'lib/recurly/client/operations.rb', line 2232

def list_external_product_external_product_references(external_product_id:, **options)
  path = interpolate_path("/external_products/{external_product_id}/external_product_references", external_product_id: external_product_id)
  pager(path, **options)
end

#list_external_products(**options) ⇒ Pager<Resources::ExternalProduct>

List a site’s external products

list_external_products api documentation

order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.

Parameters:

  • params (Hash)

    Optional query string parameters: :sort [String] Sort field. You really only want to sort by updated_at in ascending

Returns:



2157
2158
2159
2160
# File 'lib/recurly/client/operations.rb', line 2157

def list_external_products(**options)
  path = "/external_products"
  pager(path, **options)
end

#list_external_subscription_external_invoices(external_subscription_id:, **options) ⇒ Pager<Resources::ExternalInvoice>

List the external invoices on an external subscription

list_external_subscription_external_invoices api documentation

order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.

     :limit [Integer] Limit number of records 1-200.
     :order [String] Sort order.

Parameters:

  • external_subscription_id (String)

    External subscription id

  • params (Hash)

    Optional query string parameters: :sort [String] Sort field. You really only want to sort by updated_at in ascending

Returns:



2328
2329
2330
2331
# File 'lib/recurly/client/operations.rb', line 2328

def list_external_subscription_external_invoices(external_subscription_id:, **options)
  path = interpolate_path("/external_subscriptions/{external_subscription_id}/external_invoices", external_subscription_id: external_subscription_id)
  pager(path, **options)
end

#list_external_subscriptions(**options) ⇒ Pager<Resources::ExternalSubscription>

List a site’s external subscriptions

list_external_subscriptions api documentation

order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.

Parameters:

  • params (Hash)

    Optional query string parameters: :sort [String] Sort field. You really only want to sort by updated_at in ascending

Returns:



2294
2295
2296
2297
# File 'lib/recurly/client/operations.rb', line 2294

def list_external_subscriptions(**options)
  path = "/external_subscriptions"
  pager(path, **options)
end

#list_gift_cards(**options) ⇒ Pager<Resources::GiftCard>

Parameters:

  • params (Hash)

    Optional query string parameters:

Returns:



4508
4509
4510
4511
# File 'lib/recurly/client/operations.rb', line 4508

def list_gift_cards(**options)
  path = "/gift_cards"
  pager(path, **options)
end

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

List the coupon redemptions applied to an invoice

list_invoice_coupon_redemptions api documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
coupon_redemptions = @client.list_invoice_coupon_redemptions(
  invoice_id: invoice_id,
  params: params
)
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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



2710
2711
2712
2713
# File 'lib/recurly/client/operations.rb', line 2710

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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
line_items = @client.list_invoice_line_items(
  invoice_id: invoice_id,
  params: params
)
line_items.each do |line_item|
  puts "Line Item: #{line_item.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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



2663
2664
2665
2666
# File 'lib/recurly/client/operations.rb', line 2663

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_invoice_template_accounts(invoice_template_id:, **options) ⇒ Pager<Resources::Account>

List an invoice template’s associated accounts

list_invoice_template_accounts api documentation

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] Inclusively 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] Inclusively 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.

Parameters:

  • invoice_template_id (String)

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

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



1864
1865
1866
1867
# File 'lib/recurly/client/operations.rb', line 1864

def list_invoice_template_accounts(invoice_template_id:, **options)
  path = interpolate_path("/invoice_templates/{invoice_template_id}/accounts", invoice_template_id: invoice_template_id)
  pager(path, **options)
end

#list_invoice_templates(**options) ⇒ Pager<Resources::InvoiceTemplate>

Show the invoice templates for a site

list_invoice_templates api documentation

order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.

Parameters:

  • params (Hash)

    Optional query string parameters: :sort [String] Sort field. You really only want to sort by updated_at in ascending

Returns:



4384
4385
4386
4387
# File 'lib/recurly/client/operations.rb', line 4384

def list_invoice_templates(**options)
  path = "/invoice_templates"
  pager(path, **options)
end

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

List a site’s invoices

list_invoices api documentation

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] Inclusively 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] Inclusively 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.

Examples:

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

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



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

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

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

List a site’s items

list_items api documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
items = @client.list_items(params: params)
items.each do |item|
  puts "Item: #{item.code}"
end

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



1910
1911
1912
1913
# File 'lib/recurly/client/operations.rb', line 1910

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

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

List a site’s line items

list_line_items api documentation

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] Inclusively 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] Inclusively 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.

Examples:

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

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



2816
2817
2818
2819
# File 'lib/recurly/client/operations.rb', line 2816

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

#list_measured_unit(**options) ⇒ Pager<Resources::MeasuredUnit>

List a site’s measured units

list_measured_unit api documentation

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] Inclusively 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] Inclusively 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.

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



2083
2084
2085
2086
# File 'lib/recurly/client/operations.rb', line 2083

def list_measured_unit(**options)
  path = "/measured_units"
  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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
add_ons = @client.list_plan_add_ons(
  plan_id: plan_id,
  params: params
)
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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



3073
3074
3075
3076
# File 'lib/recurly/client/operations.rb', line 3073

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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

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

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



2910
2911
2912
2913
# File 'lib/recurly/client/operations.rb', line 2910

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

List an invoice’s related credit or charge invoices

list_related_invoices api documentation

Examples:

params = {
  limit: 200
}
invoices = @client.list_related_invoices(
  invoice_id: invoice_id,
  params: params
)
invoices.each do |invoice|
  puts "Invoice: #{invoice.number}"
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.

  • params (Hash)

    Optional query string parameters:

Returns:



2735
2736
2737
2738
# File 'lib/recurly/client/operations.rb', line 2735

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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
shipping_addresses = @client.list_shipping_addresses(
  account_id: ,
  params: params
)
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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



1154
1155
1156
1157
# File 'lib/recurly/client/operations.rb', line 1154

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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
shipping_methods = @client.list_shipping_methods(
  params: params
)
shipping_methods.each do |shipping_method|
  puts "Shipping Method: #{shipping_method.code}"
end

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



3311
3312
3313
3314
# File 'lib/recurly/client/operations.rb', line 3311

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

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

List sites

list_sites api documentation

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.

     :state [String] Filter by state.

Examples:

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

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



46
47
48
49
# File 'lib/recurly/client/operations.rb', line 46

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

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

List the coupon redemptions for a subscription

list_subscription_coupon_redemptions api documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
coupon_redemptions = @client.list_subscription_coupon_redemptions(
  subscription_id: subscription_id,
  params: params
)
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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



3939
3940
3941
3942
# File 'lib/recurly/client/operations.rb', line 3939

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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
invoices = @client.list_subscription_invoices(
  subscription_id: subscription_id,
  params: params
)
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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



3840
3841
3842
3843
# File 'lib/recurly/client/operations.rb', line 3840

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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

params = {
  limit: 200
}
line_items = @client.list_subscription_line_items(
  subscription_id: subscription_id,
  params: params
)
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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



3892
3893
3894
3895
# File 'lib/recurly/client/operations.rb', line 3892

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 documentation

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] Inclusively 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] Inclusively 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.

Examples:

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

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



3419
3420
3421
3422
# File 'lib/recurly/client/operations.rb', line 3419

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

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

List a site’s transactions

list_transactions api documentation

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] Inclusively 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] Inclusively 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.

Examples:

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

Parameters:

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



4085
4086
4087
4088
# File 'lib/recurly/client/operations.rb', line 4085

def list_transactions(**options)
  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 documentation

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] Inclusively 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] Inclusively 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.

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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



1703
1704
1705
1706
# File 'lib/recurly/client/operations.rb', line 1703

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

#list_usage(subscription_id:, add_on_id:, **options) ⇒ Pager<Resources::Usage>

List a subscription add-on’s usage records

list_usage api documentation

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 +usage_timestamp+ in ascending
order. In descending order updated records will move behind the cursor and could
prevent some records from being returned.

     :begin_time [DateTime] Inclusively filter by begin_time when +sort=usage_timestamp+ or +sort=recorded_timestamp+.
*Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

     :end_time [DateTime] Inclusively filter by end_time when +sort=usage_timestamp+ or +sort=recorded_timestamp+.
*Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC.

     :billing_status [String] Filter by usage record's billing status

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.

  • 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.

  • params (Hash)

    Optional query string parameters: :ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using

Returns:



3979
3980
3981
3982
# File 'lib/recurly/client/operations.rb', line 3979

def list_usage(subscription_id:, add_on_id:, **options)
  path = interpolate_path("/subscriptions/{subscription_id}/add_ons/{add_on_id}/usage", subscription_id: subscription_id, add_on_id: add_on_id)
  pager(path, **options)
end

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

Mark an open invoice as failed

mark_invoice_failed api documentation

Examples:

begin
  invoice = @client.mark_invoice_failed(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.

  • params (Hash)

    Optional query string parameters:

Returns:



2527
2528
2529
2530
# File 'lib/recurly/client/operations.rb', line 2527

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

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

Mark an open invoice as successful

mark_invoice_successful api documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



2550
2551
2552
2553
# File 'lib/recurly/client/operations.rb', line 2550

def mark_invoice_successful(invoice_id:, **options)
  path = interpolate_path("/invoices/{invoice_id}/mark_successful", invoice_id: invoice_id)
  put(path, **options)
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

  • params (Hash)

    Optional query string parameters:

Returns:



3625
3626
3627
3628
# File 'lib/recurly/client/operations.rb', line 3625

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_gift_card(body:, **options) ⇒ Resources::GiftCard

Parameters:

Returns:



4550
4551
4552
4553
# File 'lib/recurly/client/operations.rb', line 4550

def preview_gift_card(body:, **options)
  path = "/gift_cards/preview"
  post(path, body, Requests::GiftCardCreate, **options)
end

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

Preview new invoice for pending line items

preview_invoice api documentation

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

  • params (Hash)

    Optional query string parameters:

Returns:



960
961
962
963
# File 'lib/recurly/client/operations.rb', line 960

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 documentation

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:

Returns:



4230
4231
4232
4233
# File 'lib/recurly/client/operations.rb', line 4230

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

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

Preview a new subscription change

preview_subscription_change api documentation

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

  • params (Hash)

    Optional query string parameters:

Returns:



3785
3786
3787
3788
# File 'lib/recurly/client/operations.rb', line 3785

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

#put_dunning_campaign_bulk_update(dunning_campaign_id:, body:, **options) ⇒ Resources::DunningCampaignsBulkUpdateResponse

Assign a dunning campaign to multiple plans

put_dunning_campaign_bulk_update api documentation

Parameters:

Returns:



4367
4368
4369
4370
# File 'lib/recurly/client/operations.rb', line 4367

def put_dunning_campaign_bulk_update(dunning_campaign_id:, body:, **options)
  path = interpolate_path("/dunning_campaigns/{dunning_campaign_id}/bulk_update", dunning_campaign_id: dunning_campaign_id)
  put(path, body, Requests::DunningCampaignsBulkUpdate, **options)
end

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

Reactivate an inactive account

reactivate_account api documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



351
352
353
354
# File 'lib/recurly/client/operations.rb', line 351

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 documentation

Examples:

begin
  item = @client.reactivate_item(item_id: item_id)
  puts "Reactivated Item #{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:

  • 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.

  • params (Hash)

    Optional query string parameters:

Returns:



2045
2046
2047
2048
# File 'lib/recurly/client/operations.rb', line 2045

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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



3595
3596
3597
3598
# File 'lib/recurly/client/operations.rb', line 3595

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

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.

  • params (Hash)

    Optional query string parameters:

Returns:



4150
4151
4152
4153
# File 'lib/recurly/client/operations.rb', line 4150

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

#record_external_transaction(invoice_id:, body:, **options) ⇒ Resources::Transaction

Record an external payment for a manual invoices.

record_external_transaction api documentation

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::ExternalTransaction)

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

  • params (Hash)

    Optional query string parameters:

Returns:



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

def record_external_transaction(invoice_id:, body:, **options)
  path = interpolate_path("/invoices/{invoice_id}/transactions", invoice_id: invoice_id)
  post(path, body, Requests::ExternalTransaction, **options)
end

#redeem_gift_card(redemption_code:, body:, **options) ⇒ Resources::GiftCard

Parameters:

  • redemption_code (String)

    Gift Card redemption code, e.g., N1A2T8IRXSCMO40V.

  • body (Requests::GiftCardRedeem)

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

  • params (Hash)

    Optional query string parameters:

Returns:



4565
4566
4567
4568
# File 'lib/recurly/client/operations.rb', line 4565

def redeem_gift_card(redemption_code:, body:, **options)
  path = interpolate_path("/gift_cards/{redemption_code}/redeem", redemption_code: redemption_code)
  post(path, body, Requests::GiftCardRedeem, **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

  • params (Hash)

    Optional query string parameters:

Returns:



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

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_a_billing_info(account_id:, billing_info_id:, **options) ⇒ Resources::Empty

Remove an account’s billing information

remove_a_billing_info api documentation

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.

  • billing_info_id (String)

    Billing Info ID. Can ONLY be used for sites utilizing the Wallet feature.

  • params (Hash)

    Optional query string parameters:

Returns:



587
588
589
590
# File 'lib/recurly/client/operations.rb', line 587

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

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

Remove an account’s acquisition data

remove_account_acquisition api documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



328
329
330
331
# File 'lib/recurly/client/operations.rb', line 328

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

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

Remove an account’s billing information

remove_billing_info api documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



451
452
453
454
# File 'lib/recurly/client/operations.rb', line 451

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 documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



711
712
713
714
# File 'lib/recurly/client/operations.rb', line 711

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) ⇒ Resources::Empty

Delete an uninvoiced line item

remove_line_item api documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



2864
2865
2866
2867
# File 'lib/recurly/client/operations.rb', line 2864

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_measured_unit(measured_unit_id:, **options) ⇒ Resources::MeasuredUnit

Parameters:

  • measured_unit_id (String)

    Measured unit ID or name. For ID no prefix is used e.g. e28zov4fw0v2. For name use prefix name-, e.g. name-Storage.

  • params (Hash)

    Optional query string parameters:

Returns:



2140
2141
2142
2143
# File 'lib/recurly/client/operations.rb', line 2140

def remove_measured_unit(measured_unit_id:, **options)
  path = interpolate_path("/measured_units/{measured_unit_id}", measured_unit_id: measured_unit_id)
  delete(path, **options)
end

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

Examples:

begin
  plan = @client.remove_plan(plan_id: plan_id)
  puts "Removed 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.

  • params (Hash)

    Optional query string parameters:

Returns:



3023
3024
3025
3026
# File 'lib/recurly/client/operations.rb', line 3023

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

Examples:

begin
  add_on = @client.remove_plan_add_on(
    plan_id: plan_id,
    add_on_id: add_on_id
  )
  puts "Removed 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.

  • params (Hash)

    Optional query string parameters:

Returns:



3193
3194
3195
3196
# File 'lib/recurly/client/operations.rb', line 3193

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) ⇒ Resources::Empty

Remove an account’s shipping address

remove_shipping_address api documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



1276
1277
1278
1279
# File 'lib/recurly/client/operations.rb', line 1276

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) ⇒ Resources::Empty

Delete the pending subscription change

remove_subscription_change api documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



3770
3771
3772
3773
# File 'lib/recurly/client/operations.rb', line 3770

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

#remove_usage(usage_id:, **options) ⇒ Resources::Empty

Delete a usage record.

remove_usage api documentation

Parameters:

  • usage_id (String)

    Usage Record ID.

  • params (Hash)

    Optional query string parameters:

Returns:



4038
4039
4040
4041
# File 'lib/recurly/client/operations.rb', line 4038

def remove_usage(usage_id:, **options)
  path = interpolate_path("/usage/{usage_id}", usage_id: usage_id)
  delete(path, **options)
end

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

Reopen a closed, manual invoice

reopen_invoice api documentation

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.

  • params (Hash)

    Optional query string parameters:

Returns:



2573
2574
2575
2576
# File 'lib/recurly/client/operations.rb', line 2573

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

#restore_coupon(coupon_id:, body:, **options) ⇒ Resources::Coupon

Restore an inactive coupon

restore_coupon api documentation

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

  • params (Hash)

    Optional query string parameters:

Returns:



1665
1666
1667
1668
# File 'lib/recurly/client/operations.rb', line 1665

def restore_coupon(coupon_id:, body:, **options)
  path = interpolate_path("/coupons/{coupon_id}/restore", coupon_id: coupon_id)
  put(path, body, Requests::CouponUpdate, **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.

  • params (Hash)

    Optional query string parameters:

Returns:



3650
3651
3652
3653
# File 'lib/recurly/client/operations.rb', line 3650

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

#show_external_invoice(external_invoice_id:, **options) ⇒ Resources::ExternalInvoice

Fetch an external invoice

show_external_invoice api documentation

Parameters:

  • external_invoice_id (String)

    External invoice ID, e.g. e28zov4fw0v2.

  • params (Hash)

    Optional query string parameters:

Returns:



4431
4432
4433
4434
# File 'lib/recurly/client/operations.rb', line 4431

def show_external_invoice(external_invoice_id:, **options)
  path = interpolate_path("/external_invoices/{external_invoice_id}", external_invoice_id: external_invoice_id)
  get(path, **options)
end

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

Terminate a subscription

terminate_subscription api documentation

* +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.

     :charge [Boolean] Applicable only if the subscription has usage based add-ons and unbilled usage logged for the current billing cycle. If true, current billing cycle unbilled usage is billed on the final invoice. If false, Recurly will create a negative usage record for current billing cycle usage that will zero out the final invoice line items.

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.

  • params (Hash)

    Optional query string parameters: :refund [String] The type of refund to perform:

Returns:



3544
3545
3546
3547
# File 'lib/recurly/client/operations.rb', line 3544

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

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

Update an account’s billing information

update_a_billing_info api documentation

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.

  • billing_info_id (String)

    Billing Info ID. Can ONLY be used for sites utilizing the Wallet feature.

  • body (Requests::BillingInfoCreate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



572
573
574
575
# File 'lib/recurly/client/operations.rb', line 572

def update_a_billing_info(account_id:, billing_info_id:, body:, **options)
  path = interpolate_path("/accounts/{account_id}/billing_infos/{billing_info_id}", account_id: , billing_info_id: billing_info_id)
  put(path, body, Requests::BillingInfoCreate, **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

  • params (Hash)

    Optional query string parameters:

Returns:



223
224
225
226
# File 'lib/recurly/client/operations.rb', line 223

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 documentation

Examples:

begin
  acquisition_update = {
    campaign: "podcast-marketing",
    channel: "social_media",
    subchannel: "twitter",
    cost: {
      currency: "USD",
      amount: 0.50
    }
  }
  acquisition = @client.(
    account_id: ,
    body: acquisition_update
  )
  puts "Updated AccountAcqusition #{acquisition}"
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::AccountAcquisitionUpdate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



305
306
307
308
# File 'lib/recurly/client/operations.rb', line 305

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

#update_account_external_account(account_id:, external_account_id:, body:, **options) ⇒ Resources::ExternalAccount

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.

  • external_account_id (String)

    External account ID, e.g. s28zov4fw0cb.

  • body (Requests::ExternalAccountUpdate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



808
809
810
811
# File 'lib/recurly/client/operations.rb', line 808

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

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

Set an account’s billing information

update_billing_info api documentation

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

  • params (Hash)

    Optional query string parameters:

Returns:



428
429
430
431
# File 'lib/recurly/client/operations.rb', line 428

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 documentation

Examples:

begin
  coupon_update = {
    name: "New Coupon Name"
  }
  coupon = @client.update_coupon(coupon_id: coupon_id, body: coupon_update)
  puts "Updated 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.

  • body (Requests::CouponUpdate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



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

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_external_product(external_product_id:, body:, **options) ⇒ Resources::ExternalProduct

Update an external product

update_external_product api documentation

Parameters:

Returns:



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

def update_external_product(external_product_id:, body:, **options)
  path = interpolate_path("/external_products/{external_product_id}", external_product_id: external_product_id)
  put(path, body, Requests::ExternalProductUpdate, **options)
end

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

Examples:

begin
  invoice_update = {
    customer_notes: "New Notes",
    terms_and_conditions: "New Terms and Conditions"
  }
  invoice = @client.update_invoice(invoice_id: invoice_id, body: invoice_update)
  puts "Updated 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::InvoiceUpdate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



2430
2431
2432
2433
# File 'lib/recurly/client/operations.rb', line 2430

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

#update_item(item_id:, body:, **options) ⇒ Resources::Item

Update an active item

update_item api documentation

Examples:

begin
  item_update = {
    name: "New Item Name",
    description: "New Item Description"
  }
  item = @client.update_item(
    item_id: item_id,
    body: item_update
  )
  puts "Updated Item #{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:

  • 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

  • params (Hash)

    Optional query string parameters:

Returns:



1999
2000
2001
2002
# File 'lib/recurly/client/operations.rb', line 1999

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_measured_unit(measured_unit_id:, body:, **options) ⇒ Resources::MeasuredUnit

Parameters:

  • measured_unit_id (String)

    Measured unit ID or name. For ID no prefix is used e.g. e28zov4fw0v2. For name use prefix name-, e.g. name-Storage.

  • body (Requests::MeasuredUnitUpdate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



2126
2127
2128
2129
# File 'lib/recurly/client/operations.rb', line 2126

def update_measured_unit(measured_unit_id:, body:, **options)
  path = interpolate_path("/measured_units/{measured_unit_id}", measured_unit_id: measured_unit_id)
  put(path, body, Requests::MeasuredUnitUpdate, **options)
end

#update_plan(plan_id:, body:, **options) ⇒ Resources::Plan

Examples:

begin
  plan_update = {
    name: "Monthly Kombucha Subscription"
  }
  plan = @client.update_plan(plan_id: plan_id, body: plan_update)
  puts "Updated 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.

  • body (Requests::PlanUpdate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



3000
3001
3002
3003
# File 'lib/recurly/client/operations.rb', line 3000

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

Examples:

begin
  add_on_update = {
    name: "A quality grinder for your finest beans"
  }
  add_on = @client.update_plan_add_on(
    plan_id: plan_id,
    add_on_id: add_on_id,
    body: add_on_update
  )
  puts "Updated 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.

  • body (Requests::AddOnUpdate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



3166
3167
3168
3169
# File 'lib/recurly/client/operations.rb', line 3166

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 documentation

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

  • params (Hash)

    Optional query string parameters:

Returns:



1249
1250
1251
1252
# File 'lib/recurly/client/operations.rb', line 1249

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

#update_shipping_method(shipping_method_id:, body:, **options) ⇒ Resources::ShippingMethod

Update an active Shipping Method

update_shipping_method api documentation

Parameters:

  • shipping_method_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.

  • body (Requests::ShippingMethodUpdate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



3354
3355
3356
3357
# File 'lib/recurly/client/operations.rb', line 3354

def update_shipping_method(shipping_method_id:, body:, **options)
  path = interpolate_path("/shipping_methods/{shipping_method_id}", shipping_method_id: shipping_method_id)
  put(path, body, Requests::ShippingMethodUpdate, **options)
end

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

Examples:

begin
  subscription_update = {
    customer_notes: "New Notes",
    terms_and_conditions: "New ToC"
  }
  subscription = @client.update_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

  • params (Hash)

    Optional query string parameters:

Returns:



3508
3509
3510
3511
# File 'lib/recurly/client/operations.rb', line 3508

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

#update_usage(usage_id:, body:, **options) ⇒ Resources::Usage

Update a usage record

update_usage api documentation

Parameters:

  • usage_id (String)

    Usage Record ID.

  • body (Requests::UsageCreate)

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

  • params (Hash)

    Optional query string parameters:

Returns:



4024
4025
4026
4027
# File 'lib/recurly/client/operations.rb', line 4024

def update_usage(usage_id:, body:, **options)
  path = interpolate_path("/usage/{usage_id}", usage_id: usage_id)
  put(path, body, Requests::UsageCreate, **options)
end

#verify_billing_info(account_id:, **options) ⇒ Resources::Transaction

Verify an account’s credit card billing information

verify_billing_info api documentation

Examples:

begin
  transaction = @client.verify_billing_info(account_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:

  • 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.

  • params (Hash)

    Optional query string parameters: :body [Requests::BillingInfoVerify] The Hash representing the JSON request to send to the server. It should conform to the schema of Requests::BillingInfoVerify

Returns:



475
476
477
478
# File 'lib/recurly/client/operations.rb', line 475

def verify_billing_info(account_id:, **options)
  path = interpolate_path("/accounts/{account_id}/billing_info/verify", account_id: )
  post(path, options[:body], Requests::BillingInfoVerify, **options)
end

#verify_billing_info_cvv(account_id:, body:, **options) ⇒ Resources::Transaction

Verify an account’s credit card billing cvv

verify_billing_info_cvv api documentation

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::BillingInfoVerifyCVV)

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

  • params (Hash)

    Optional query string parameters:

Returns:



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

def verify_billing_info_cvv(account_id:, body:, **options)
  path = interpolate_path("/accounts/{account_id}/billing_info/verify_cvv", account_id: )
  post(path, body, Requests::BillingInfoVerifyCVV, **options)
end

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

Void a credit invoice.

void_invoice api documentation

Examples:

begin
  invoice = @client.void_invoice(invoice_id: invoice_id)
  puts "Voided 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.

  • params (Hash)

    Optional query string parameters:

Returns:



2596
2597
2598
2599
# File 'lib/recurly/client/operations.rb', line 2596

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