lib/recurly/client/operations.rb in recurly-3.0.0.beta.5 vs lib/recurly/client/operations.rb in recurly-3.0.0

- old
+ new

@@ -3,18 +3,18 @@ # change to this file, please create a Github issue explaining the changes you # need and we will usher them to the appropriate places. module Recurly class Client def api_version - "v2018-08-09" + "v2019-10-10" end # List sites # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_sites list_sites api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_sites list_sites api documenation} # - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -42,23 +42,24 @@ pager(path, **options) end # Fetch a site # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_site get_site api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_site get_site api documenation} # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Site] A site. - def get_site() + def get_site(site_id:) path = interpolate_path("/sites/{site_id}", site_id: site_id) get(path) end # List a site's accounts # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_accounts list_accounts api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_accounts list_accounts api documenation} # - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -78,31 +79,34 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # - # @param subscriber [String] Filter accounts accounts with or without a subscription in the +active+, + # @param 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. + # @param subscriber [Boolean] Filter for accounts with or without a subscription in the +active+, # +canceled+, or +future+ state. # # @param past_due [String] Filter for accounts with an invoice in the +past_due+ state. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::Account>] A list of the site's accounts. # @example # accounts = @client.list_accounts(limit: 200) # accounts.each do |account| # puts "Account: #{account.code}" # end # def list_accounts(**options) - path = interpolate_path("/sites/{site_id}/accounts", site_id: site_id) + path = interpolate_path("/accounts") pager(path, **options) end # Create an account # - # {https://partner-docs.recurly.com/v2018-08-09#operation/create_account create_account api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/create_account create_account api documenation} # # @param body [Requests::AccountCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AccountCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Account] An account. # @example # begin # account_create = { # code: account_code, @@ -136,20 +140,21 @@ # # 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 # - def create_account(body:) - path = interpolate_path("/sites/{site_id}/accounts", site_id: site_id) - post(path, body, Requests::AccountCreate) + def create_account(body:, **options) + path = interpolate_path("/accounts") + post(path, body, Requests::AccountCreate, **options) end # Fetch an account # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_account get_account api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_account get_account api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Account] An account. # @example # begin # account = @client.get_account(account_id: account_id) # puts "Got Account #{account}" @@ -157,21 +162,22 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_account(account_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}", site_id: site_id, account_id: account_id) - get(path) + def get_account(account_id:, **options) + path = interpolate_path("/accounts/{account_id}", account_id: account_id) + get(path, **options) end # Modify an account # - # {https://partner-docs.recurly.com/v2018-08-09#operation/update_account update_account api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/update_account update_account api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param body [Requests::AccountUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AccountUpdate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Account] An account. # @example # begin # account_update = { # first_name: "Aaron", @@ -186,20 +192,21 @@ # # 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 # - def update_account(account_id:, body:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}", site_id: site_id, account_id: account_id) - put(path, body, Requests::AccountUpdate) + def update_account(account_id:, body:, **options) + path = interpolate_path("/accounts/{account_id}", account_id: account_id) + put(path, body, Requests::AccountUpdate, **options) end # Deactivate an account # - # {https://partner-docs.recurly.com/v2018-08-09#operation/deactivate_account deactivate_account api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/deactivate_account deactivate_account api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Account] An account. # @example # begin # account = @client.deactivate_account(account_id: account_id) # puts "Deactivated Account #{account}" @@ -207,20 +214,21 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def deactivate_account(account_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}", site_id: site_id, account_id: account_id) - delete(path) + def deactivate_account(account_id:, **options) + path = interpolate_path("/accounts/{account_id}", account_id: account_id) + delete(path, **options) end # Fetch an account's acquisition data # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_account_acquisition get_account_acquisition api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_account_acquisition get_account_acquisition api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::AccountAcquisition] An account's acquisition data. # @example # begin # @client.get_account_acquisition(account_id: account_id) # puts "Got AccountAcquisition" @@ -228,52 +236,56 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_account_acquisition(account_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/acquisition", site_id: site_id, account_id: account_id) - get(path) + def get_account_acquisition(account_id:, **options) + path = interpolate_path("/accounts/{account_id}/acquisition", account_id: account_id) + get(path, **options) end # Update an account's acquisition data # - # {https://partner-docs.recurly.com/v2018-08-09#operation/update_account_acquisition update_account_acquisition api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/update_account_acquisition update_account_acquisition api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param body [Requests::AccountAcquisitionUpdatable] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AccountAcquisitionUpdatable} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::AccountAcquisition] An account's updated acquisition data. - def update_account_acquisition(account_id:, body:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/acquisition", site_id: site_id, account_id: account_id) - put(path, body, Requests::AccountAcquisitionUpdatable) + def update_account_acquisition(account_id:, body:, **options) + path = interpolate_path("/accounts/{account_id}/acquisition", account_id: account_id) + put(path, body, Requests::AccountAcquisitionUpdatable, **options) end # Remove an account's acquisition data # - # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_account_acquisition remove_account_acquisition api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/remove_account_acquisition remove_account_acquisition api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). + # @return [Empty] Acquisition data was succesfully deleted. # @example # begin # acquisition = @client.remove_account_acquisition(account_id: 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 # - def remove_account_acquisition(account_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/acquisition", site_id: site_id, account_id: account_id) - delete(path) + def remove_account_acquisition(account_id:, **options) + path = interpolate_path("/accounts/{account_id}/acquisition", account_id: account_id) + delete(path, **options) end # Reactivate an inactive account # - # {https://partner-docs.recurly.com/v2018-08-09#operation/reactivate_account reactivate_account api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/reactivate_account reactivate_account api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Account] An account. # @example # begin # account = @client.reactivate_account(account_id: account_id) # puts "Reactivated account #{account}" @@ -281,20 +293,21 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def reactivate_account(account_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/reactivate", site_id: site_id, account_id: account_id) - put(path) + def reactivate_account(account_id:, **options) + path = interpolate_path("/accounts/{account_id}/reactivate", account_id: account_id) + put(path, **options) end # Fetch an account's balance and past due status # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_account_balance get_account_balance api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_account_balance get_account_balance api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::AccountBalance] An account's balance. # @example # begin # balance = @client.get_account_balance(account_id: account_id) # puts "Got AccountBalance #{balance}" @@ -302,20 +315,21 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_account_balance(account_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/balance", site_id: site_id, account_id: account_id) - get(path) + def get_account_balance(account_id:, **options) + path = interpolate_path("/accounts/{account_id}/balance", account_id: account_id) + get(path, **options) end # Fetch an account's billing information # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_billing_info get_billing_info api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_billing_info get_billing_info api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::BillingInfo] An account's billing information. # @example # begin # billing = @client.get_billing_info(account_id: account_id) # puts "Got BillingInfo #{billing}" @@ -323,21 +337,22 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_billing_info(account_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/billing_info", site_id: site_id, account_id: account_id) - get(path) + def get_billing_info(account_id:, **options) + path = interpolate_path("/accounts/{account_id}/billing_info", account_id: account_id) + get(path, **options) end # Set an account's billing information # - # {https://partner-docs.recurly.com/v2018-08-09#operation/update_billing_info update_billing_info api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/update_billing_info update_billing_info api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param body [Requests::BillingInfoCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::BillingInfoCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::BillingInfo] Updated billing information. # @example # begin # billing_update = { # first_name: "Aaron", @@ -352,41 +367,43 @@ # # 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 # - def update_billing_info(account_id:, body:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/billing_info", site_id: site_id, account_id: account_id) - put(path, body, Requests::BillingInfoCreate) + def update_billing_info(account_id:, body:, **options) + path = interpolate_path("/accounts/{account_id}/billing_info", account_id: account_id) + put(path, body, Requests::BillingInfoCreate, **options) end # Remove an account's billing information # - # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_billing_info remove_billing_info api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/remove_billing_info remove_billing_info api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). + # @return [Empty] Billing information deleted # @example # begin # @client.remove_billing_info(account_id: account_id) # puts "Removed BillingInfo #{account_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 # - def remove_billing_info(account_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/billing_info", site_id: site_id, account_id: account_id) - delete(path) + def remove_billing_info(account_id:, **options) + path = interpolate_path("/accounts/{account_id}/billing_info", account_id: account_id) + delete(path, **options) end # Show the coupon redemptions for an account # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_coupon_redemptions list_account_coupon_redemptions api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_coupon_redemptions list_account_coupon_redemptions api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -404,10 +421,11 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::CouponRedemption>] A list of the the coupon redemptions on an account. # @example # redemptions = @client.list_account_coupon_redemptions( # account_id: account_id, # limit: 200 @@ -415,19 +433,20 @@ # redemptions.each do |redemption| # puts "CouponRedemption: #{redemption.id}" # end # def list_account_coupon_redemptions(account_id:, **options) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/coupon_redemptions", site_id: site_id, account_id: account_id) + path = interpolate_path("/accounts/{account_id}/coupon_redemptions", account_id: account_id) pager(path, **options) end # Show the coupon redemption that is active on an account # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_active_coupon_redemption get_active_coupon_redemption api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_active_coupon_redemption get_active_coupon_redemption api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::CouponRedemption] An active coupon redemption on an account. # @example # begin # redemption = @client.get_active_coupon_redemption(account_id: account_id) # puts "Got CouponRedemption #{redemption}" @@ -435,21 +454,22 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_active_coupon_redemption(account_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/coupon_redemptions/active", site_id: site_id, account_id: account_id) - get(path) + def get_active_coupon_redemption(account_id:, **options) + path = interpolate_path("/accounts/{account_id}/coupon_redemptions/active", account_id: account_id) + get(path, **options) end # Generate an active coupon redemption on an account # - # {https://partner-docs.recurly.com/v2018-08-09#operation/create_coupon_redemption create_coupon_redemption api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/create_coupon_redemption create_coupon_redemption api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param body [Requests::CouponRedemptionCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::CouponRedemptionCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::CouponRedemption] Returns the new coupon redemption. # @example # begin # redemption_create = { # currency: 'USD', @@ -464,20 +484,21 @@ # # 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 # - def create_coupon_redemption(account_id:, body:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/coupon_redemptions/active", site_id: site_id, account_id: account_id) - post(path, body, Requests::CouponRedemptionCreate) + def create_coupon_redemption(account_id:, body:, **options) + path = interpolate_path("/accounts/{account_id}/coupon_redemptions/active", account_id: account_id) + post(path, body, Requests::CouponRedemptionCreate, **options) end # Delete the active coupon redemption from an account # - # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_coupon_redemption remove_coupon_redemption api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/remove_coupon_redemption remove_coupon_redemption api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::CouponRedemption] Coupon redemption deleted. # @example # begin # @client.remove_coupon_redemption(account_id: account_id) # puts "Removed CouponRedemption #{account_id}" @@ -485,18 +506,18 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def remove_coupon_redemption(account_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/coupon_redemptions/active", site_id: site_id, account_id: account_id) - delete(path) + def remove_coupon_redemption(account_id:, **options) + path = interpolate_path("/accounts/{account_id}/coupon_redemptions/active", account_id: account_id) + delete(path, **options) end # List an account's credit payments # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_credit_payments list_account_credit_payments api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_credit_payments list_account_credit_payments api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param limit [Integer] Limit number of records 1-200. # @param order [String] Sort order. # @param sort [String] Sort field. You *really* only want to sort by +updated_at+ in ascending @@ -507,10 +528,11 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::CreditPayment>] A list of the account's credit payments. # @example # payments = @client.list_account_credit_payments( # account_id: account_id, # limit: 200 @@ -518,20 +540,20 @@ # payments.each do |payment| # puts "CreditPayment: #{payment.id}" # end # def list_account_credit_payments(account_id:, **options) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/credit_payments", site_id: site_id, account_id: account_id) + path = interpolate_path("/accounts/{account_id}/credit_payments", account_id: account_id) pager(path, **options) end # List an account's invoices # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_invoices list_account_invoices api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_invoices list_account_invoices api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -557,10 +579,11 @@ # - +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. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::Invoice>] A list of the account's invoices. # @example # invoices = @client.list_account_invoices( # account_id: account_id, # limit: 200 @@ -568,20 +591,21 @@ # invoices.each do |invoice| # puts "Invoice: #{invoice.number}" # end # def list_account_invoices(account_id:, **options) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/invoices", site_id: site_id, account_id: account_id) + path = interpolate_path("/accounts/{account_id}/invoices", account_id: account_id) pager(path, **options) end # Create an invoice for pending line items # - # {https://partner-docs.recurly.com/v2018-08-09#operation/create_invoice create_invoice api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/create_invoice create_invoice api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param body [Requests::InvoiceCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::InvoiceCollection] Returns the new invoices. # @example # begin # invoice_create = { # currency: 'USD', @@ -596,21 +620,22 @@ # # 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 # - def create_invoice(account_id:, body:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/invoices", site_id: site_id, account_id: account_id) - post(path, body, Requests::InvoiceCreate) + def create_invoice(account_id:, body:, **options) + path = interpolate_path("/accounts/{account_id}/invoices", account_id: account_id) + post(path, body, Requests::InvoiceCreate, **options) end # Preview new invoice for pending line items # - # {https://partner-docs.recurly.com/v2018-08-09#operation/preview_invoice preview_invoice api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/preview_invoice preview_invoice api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param body [Requests::InvoiceCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::InvoiceCollection] Returns the invoice previews. # @example # begin # invoice_preview = { # currency: "USD", @@ -625,21 +650,21 @@ # # 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 # - def preview_invoice(account_id:, body:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/invoices/preview", site_id: site_id, account_id: account_id) - post(path, body, Requests::InvoiceCreate) + def preview_invoice(account_id:, body:, **options) + path = interpolate_path("/accounts/{account_id}/invoices/preview", account_id: account_id) + post(path, body, Requests::InvoiceCreate, **options) end # List an account's line items # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_line_items list_account_line_items api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_line_items list_account_line_items api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -662,10 +687,11 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param original [String] Filter by original field. # @param state [String] Filter by state field. # @param type [String] Filter by type field. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::LineItem>] A list of the account's line items. # @example # line_items = @client.list_account_line_items( # account_id: account_id, # limit: 200 @@ -673,20 +699,21 @@ # line_items.each do |line_item| # puts "LineItem: #{line_item.id}" # end # def list_account_line_items(account_id:, **options) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/line_items", site_id: site_id, account_id: account_id) + path = interpolate_path("/accounts/{account_id}/line_items", account_id: account_id) pager(path, **options) end # Create a new line item for the account # - # {https://partner-docs.recurly.com/v2018-08-09#operation/create_line_item create_line_item api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/create_line_item create_line_item api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param body [Requests::LineItemCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::LineItemCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::LineItem] Returns the new line item. # @example # begin # line_item_create = { # currency: 'USD', @@ -702,21 +729,21 @@ # # 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 # - def create_line_item(account_id:, body:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/line_items", site_id: site_id, account_id: account_id) - post(path, body, Requests::LineItemCreate) + def create_line_item(account_id:, body:, **options) + path = interpolate_path("/accounts/{account_id}/line_items", account_id: account_id) + post(path, body, Requests::LineItemCreate, **options) end # Fetch a list of an account's notes # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_notes list_account_notes api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_notes list_account_notes api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -724,28 +751,30 @@ # * 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. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::AccountNote>] A list of an account's notes. # @example # account_notes = @client.list_account_notes(account_id: account_id, limit: 200) # account_notes.each do |note| # puts "AccountNote: #{note.message}" # end # def list_account_notes(account_id:, **options) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/notes", site_id: site_id, account_id: account_id) + path = interpolate_path("/accounts/{account_id}/notes", account_id: account_id) pager(path, **options) end # Fetch an account note # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_account_note get_account_note api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_account_note get_account_note api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param account_note_id [String] Account Note ID. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::AccountNote] An account note. # @example # begin # note = @client.get_account_note( # account_id: account_id, @@ -756,21 +785,21 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_account_note(account_id:, account_note_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/notes/{account_note_id}", site_id: site_id, account_id: account_id, account_note_id: account_note_id) - get(path) + def get_account_note(account_id:, account_note_id:, **options) + path = interpolate_path("/accounts/{account_id}/notes/{account_note_id}", account_id: account_id, account_note_id: account_note_id) + get(path, **options) end # Fetch a list of an account's shipping addresses # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_shipping_addresses list_shipping_addresses api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_shipping_addresses list_shipping_addresses api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -790,10 +819,11 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::ShippingAddress>] A list of an account's shipping addresses. # @example # shipping_addresses = @client.list_shipping_addresses( # account_id: account_id, # limit: 200 @@ -801,32 +831,34 @@ # shipping_addresses.each do |addr| # puts "ShippingAddress: #{addr.nickname} - #{addr.street1}" # end # def list_shipping_addresses(account_id:, **options) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/shipping_addresses", site_id: site_id, account_id: account_id) + path = interpolate_path("/accounts/{account_id}/shipping_addresses", account_id: account_id) pager(path, **options) end # Create a new shipping address for the account # - # {https://partner-docs.recurly.com/v2018-08-09#operation/create_shipping_address create_shipping_address api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/create_shipping_address create_shipping_address api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param body [Requests::ShippingAddressCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ShippingAddressCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::ShippingAddress] Returns the new shipping address. - def create_shipping_address(account_id:, body:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/shipping_addresses", site_id: site_id, account_id: account_id) - post(path, body, Requests::ShippingAddressCreate) + def create_shipping_address(account_id:, body:, **options) + path = interpolate_path("/accounts/{account_id}/shipping_addresses", account_id: account_id) + post(path, body, Requests::ShippingAddressCreate, **options) end # Fetch an account's shipping address # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_shipping_address get_shipping_address api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_shipping_address get_shipping_address api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param shipping_address_id [String] Shipping Address ID. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::ShippingAddress] A shipping address. # @example # begin # address = @client.get_shipping_address( # account_id: account_id, @@ -837,22 +869,23 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_shipping_address(account_id:, shipping_address_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/shipping_addresses/{shipping_address_id}", site_id: site_id, account_id: account_id, shipping_address_id: shipping_address_id) - get(path) + def get_shipping_address(account_id:, shipping_address_id:, **options) + path = interpolate_path("/accounts/{account_id}/shipping_addresses/{shipping_address_id}", account_id: account_id, shipping_address_id: shipping_address_id) + get(path, **options) end # Update an account's shipping address # - # {https://partner-docs.recurly.com/v2018-08-09#operation/update_shipping_address update_shipping_address api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/update_shipping_address update_shipping_address api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param shipping_address_id [String] Shipping Address ID. # @param body [Requests::ShippingAddressUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::ShippingAddressUpdate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::ShippingAddress] The updated shipping address. # @example # begin # address_update = { # first_name: "Aaron", @@ -869,21 +902,23 @@ # # 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 # - def update_shipping_address(account_id:, shipping_address_id:, body:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/shipping_addresses/{shipping_address_id}", site_id: site_id, account_id: account_id, shipping_address_id: shipping_address_id) - put(path, body, Requests::ShippingAddressUpdate) + def update_shipping_address(account_id:, shipping_address_id:, body:, **options) + path = interpolate_path("/accounts/{account_id}/shipping_addresses/{shipping_address_id}", account_id: account_id, shipping_address_id: shipping_address_id) + put(path, body, Requests::ShippingAddressUpdate, **options) end # Remove an account's shipping address # - # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_shipping_address remove_shipping_address api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/remove_shipping_address remove_shipping_address api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). # @param shipping_address_id [String] Shipping Address ID. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). + # @return [Empty] Shipping address deleted. # @example # begin # @client.remove_shipping_address( # account_id: account_id, # shipping_address_id: shipping_address_id @@ -893,21 +928,21 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def remove_shipping_address(account_id:, shipping_address_id:) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/shipping_addresses/{shipping_address_id}", site_id: site_id, account_id: account_id, shipping_address_id: shipping_address_id) - delete(path) + def remove_shipping_address(account_id:, shipping_address_id:, **options) + path = interpolate_path("/accounts/{account_id}/shipping_addresses/{shipping_address_id}", account_id: account_id, shipping_address_id: shipping_address_id) + delete(path, **options) end # List an account's subscriptions # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_subscriptions list_account_subscriptions api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_subscriptions list_account_subscriptions api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -933,10 +968,11 @@ # # - 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. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::Subscription>] A list of the account's subscriptions. # @example # subscriptions = @client.list_account_subscriptions( # account_id: account_id, # limit: 200 @@ -944,20 +980,20 @@ # subscriptions.each do |subscription| # puts "Subscription: #{subscription.uuid}" # end # def list_account_subscriptions(account_id:, **options) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/subscriptions", site_id: site_id, account_id: account_id) + path = interpolate_path("/accounts/{account_id}/subscriptions", account_id: account_id) pager(path, **options) end # List an account's transactions # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_transactions list_account_transactions api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_transactions list_account_transactions api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -979,10 +1015,11 @@ # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param type [String] Filter by type field. The value +payment+ will return both +purchase+ and +capture+ transactions. # @param success [String] Filter by success field. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::Transaction>] A list of the account's transactions. # @example # transactions = @client.list_account_transactions( # account_id: account_id, # limit: 200 @@ -990,20 +1027,20 @@ # transactions.each do |transaction| # puts "Transaction: #{transaction.uuid}" # end # def list_account_transactions(account_id:, **options) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/transactions", site_id: site_id, account_id: account_id) + path = interpolate_path("/accounts/{account_id}/transactions", account_id: account_id) pager(path, **options) end # List an account's child accounts # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_child_accounts list_child_accounts api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_child_accounts list_child_accounts api documenation} # # @param account_id [String] Account ID or code (use prefix: +code-+, e.g. +code-bob+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1023,14 +1060,16 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # - # @param subscriber [String] Filter accounts accounts with or without a subscription in the +active+, + # @param 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. + # @param subscriber [Boolean] Filter for accounts with or without a subscription in the +active+, # +canceled+, or +future+ state. # # @param past_due [String] Filter for accounts with an invoice in the +past_due+ state. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::Account>] A list of an account's child accounts. # @example # child_accounts = @client.list_child_accounts( # account_id: account_id, # limit: 200 @@ -1038,19 +1077,19 @@ # child_accounts.each do |child| # puts "Account: #{child.code}" # end # def list_child_accounts(account_id:, **options) - path = interpolate_path("/sites/{site_id}/accounts/{account_id}/accounts", site_id: site_id, account_id: account_id) + path = interpolate_path("/accounts/{account_id}/accounts", account_id: account_id) pager(path, **options) end # List a site's account acquisition data # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_account_acquisition list_account_acquisition api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_account_acquisition list_account_acquisition api documenation} # - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1070,27 +1109,28 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::AccountAcquisition>] A list of the site's account acquisition data. # @example # acquisitions = @client.list_account_acquisition(limit: 200) # acquisitions.each do |acquisition| # puts "AccountAcquisition: #{acquisition.cost}" # end # def list_account_acquisition(**options) - path = interpolate_path("/sites/{site_id}/acquisitions", site_id: site_id) + path = interpolate_path("/acquisitions") pager(path, **options) end # List a site's coupons # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_coupons list_coupons api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_coupons list_coupons api documenation} # - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1110,27 +1150,29 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::Coupon>] A list of the site's coupons. # @example # coupons = @client.list_coupons(limit: 200) # coupons.each do |coupon| # puts "coupon: #{coupon.code}" # end # def list_coupons(**options) - path = interpolate_path("/sites/{site_id}/coupons", site_id: site_id) + path = interpolate_path("/coupons") pager(path, **options) end # Create a new coupon # - # {https://partner-docs.recurly.com/v2018-08-09#operation/create_coupon create_coupon api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/create_coupon create_coupon api documenation} # # @param body [Requests::CouponCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::CouponCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Coupon] A new coupon. # @example # begin # coupon_create = { # name: "Promotional Coupon", @@ -1151,20 +1193,21 @@ # # 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 # - def create_coupon(body:) - path = interpolate_path("/sites/{site_id}/coupons", site_id: site_id) - post(path, body, Requests::CouponCreate) + def create_coupon(body:, **options) + path = interpolate_path("/coupons") + post(path, body, Requests::CouponCreate, **options) end # Fetch a coupon # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_coupon get_coupon api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_coupon get_coupon api documenation} # # @param coupon_id [String] Coupon ID or code (use prefix: +code-+, e.g. +code-10off+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Coupon] A coupon. # @example # begin # coupon = @client.get_coupon(coupon_id: coupon_id) # puts "Got Coupon #{coupon}" @@ -1172,33 +1215,34 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_coupon(coupon_id:) - path = interpolate_path("/sites/{site_id}/coupons/{coupon_id}", site_id: site_id, coupon_id: coupon_id) - get(path) + def get_coupon(coupon_id:, **options) + path = interpolate_path("/coupons/{coupon_id}", coupon_id: coupon_id) + get(path, **options) end # Update an active coupon # - # {https://partner-docs.recurly.com/v2018-08-09#operation/update_coupon update_coupon api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/update_coupon update_coupon api documenation} # # @param coupon_id [String] Coupon ID or code (use prefix: +code-+, e.g. +code-10off+). # @param body [Requests::CouponUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::CouponUpdate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Coupon] The updated coupon. - def update_coupon(coupon_id:, body:) - path = interpolate_path("/sites/{site_id}/coupons/{coupon_id}", site_id: site_id, coupon_id: coupon_id) - put(path, body, Requests::CouponUpdate) + def update_coupon(coupon_id:, body:, **options) + path = interpolate_path("/coupons/{coupon_id}", coupon_id: coupon_id) + put(path, body, Requests::CouponUpdate, **options) end # List unique coupon codes associated with a bulk coupon # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_unique_coupon_codes list_unique_coupon_codes api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_unique_coupon_codes list_unique_coupon_codes api documenation} # # @param coupon_id [String] Coupon ID or code (use prefix: +code-+, e.g. +code-10off+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1218,19 +1262,20 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::UniqueCouponCode>] A list of unique coupon codes that were generated def list_unique_coupon_codes(coupon_id:, **options) - path = interpolate_path("/sites/{site_id}/coupons/{coupon_id}/unique_coupon_codes", site_id: site_id, coupon_id: coupon_id) + path = interpolate_path("/coupons/{coupon_id}/unique_coupon_codes", coupon_id: coupon_id) pager(path, **options) end # List a site's credit payments # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_credit_payments list_credit_payments api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_credit_payments list_credit_payments api documenation} # # @param limit [Integer] Limit number of records 1-200. # @param order [String] Sort order. # @param 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 @@ -1240,38 +1285,40 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::CreditPayment>] A list of the site's credit payments. # @example # payments = @client.list_credit_payments(limit: 200) # payments.each do |payment| # puts "CreditPayment: #{payment.id}" # end # def list_credit_payments(**options) - path = interpolate_path("/sites/{site_id}/credit_payments", site_id: site_id) + path = interpolate_path("/credit_payments") pager(path, **options) end # Fetch a credit payment # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_credit_payment get_credit_payment api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_credit_payment get_credit_payment api documenation} # # @param credit_payment_id [String] Credit Payment ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::CreditPayment] A credit payment. - def get_credit_payment(credit_payment_id:) - path = interpolate_path("/sites/{site_id}/credit_payments/{credit_payment_id}", site_id: site_id, credit_payment_id: credit_payment_id) - get(path) + 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 # List a site's custom field definitions # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_custom_field_definitions list_custom_field_definitions api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_custom_field_definitions list_custom_field_definitions api documenation} # - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1291,38 +1338,40 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::CustomFieldDefinition>] A list of the site's custom field definitions. # @example # custom_fields = @client.list_custom_field_definitions(limit: 200) # custom_fields.each do |field| # puts "CustomFieldDefinition: #{field.name}" # end # def list_custom_field_definitions(**options) - path = interpolate_path("/sites/{site_id}/custom_field_definitions", site_id: site_id) + path = interpolate_path("/custom_field_definitions") pager(path, **options) end # Fetch an custom field definition # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_custom_field_definition get_custom_field_definition api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_custom_field_definition get_custom_field_definition api documenation} # # @param custom_field_definition_id [String] Custom Field Definition ID + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::CustomFieldDefinition] An custom field definition. - def get_custom_field_definition(custom_field_definition_id:) - path = interpolate_path("/sites/{site_id}/custom_field_definitions/{custom_field_definition_id}", site_id: site_id, custom_field_definition_id: custom_field_definition_id) - get(path) + 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 # List a site's invoices # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_invoices list_invoices api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_invoices list_invoices api documenation} # - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1348,27 +1397,29 @@ # - +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. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::Invoice>] A list of the site's invoices. # @example # invoices = @client.list_invoices(limit: 200) # invoices.each do |invoice| # puts "Invoice: #{invoice.number}" # end # def list_invoices(**options) - path = interpolate_path("/sites/{site_id}/invoices", site_id: site_id) + path = interpolate_path("/invoices") pager(path, **options) end # Fetch an invoice # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_invoice get_invoice api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_invoice get_invoice api documenation} # # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Invoice] An invoice. # @example # begin # invoice = @client.get_invoice(invoice_id: invoice_id) # puts "Got invoice #{invoice}" @@ -1376,32 +1427,34 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_invoice(invoice_id:) - path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}", site_id: site_id, invoice_id: invoice_id) - get(path) + def get_invoice(invoice_id:, **options) + path = interpolate_path("/invoices/{invoice_id}", invoice_id: invoice_id) + get(path, **options) end # Update an invoice # - # {https://partner-docs.recurly.com/v2018-08-09#operation/put_invoice put_invoice api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/put_invoice put_invoice api documenation} # # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+). # @param body [Requests::InvoiceUpdatable] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceUpdatable} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Invoice] An invoice. - def put_invoice(invoice_id:, body:) - path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}", site_id: site_id, invoice_id: invoice_id) - put(path, body, Requests::InvoiceUpdatable) + def put_invoice(invoice_id:, body:, **options) + path = interpolate_path("/invoices/{invoice_id}", invoice_id: invoice_id) + put(path, body, Requests::InvoiceUpdatable, **options) end # Collect a pending or past due, automatic invoice # - # {https://partner-docs.recurly.com/v2018-08-09#operation/collect_invoice collect_invoice api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/collect_invoice collect_invoice api documenation} # # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Invoice] The updated invoice. # @example # begin # invoice = @client.collect_invoice(invoice_id: invoice_id) # puts "Collected invoice #{invoice}" @@ -1409,20 +1462,21 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def collect_invoice(invoice_id:) - path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/collect", site_id: site_id, invoice_id: invoice_id) - put(path) + def collect_invoice(invoice_id:, **options) + path = interpolate_path("/invoices/{invoice_id}/collect", invoice_id: invoice_id) + put(path, **options) end # Mark an open invoice as failed # - # {https://partner-docs.recurly.com/v2018-08-09#operation/fail_invoice fail_invoice api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/fail_invoice fail_invoice api documenation} # # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Invoice] The updated invoice. # @example # begin # invoice = @client.fail_invoice(invoice_id: invoice_id) # puts "Failed invoice #{invoice}" @@ -1430,20 +1484,21 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def fail_invoice(invoice_id:) - path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/mark_failed", site_id: site_id, invoice_id: invoice_id) - put(path) + def fail_invoice(invoice_id:, **options) + path = interpolate_path("/invoices/{invoice_id}/mark_failed", invoice_id: invoice_id) + put(path, **options) end # Mark an open invoice as successful # - # {https://partner-docs.recurly.com/v2018-08-09#operation/mark_invoice_successful mark_invoice_successful api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/mark_invoice_successful mark_invoice_successful api documenation} # # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Invoice] The updated invoice. # @example # begin # invoice = @client.mark_invoice_successful(invoice_id: invoice_id) # puts "Marked invoice sucessful #{invoice}" @@ -1451,20 +1506,21 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def mark_invoice_successful(invoice_id:) - path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/mark_successful", site_id: site_id, invoice_id: invoice_id) - put(path) + def mark_invoice_successful(invoice_id:, **options) + path = interpolate_path("/invoices/{invoice_id}/mark_successful", invoice_id: invoice_id) + put(path, **options) end # Reopen a closed, manual invoice # - # {https://partner-docs.recurly.com/v2018-08-09#operation/reopen_invoice reopen_invoice api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/reopen_invoice reopen_invoice api documenation} # # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Invoice] The updated invoice. # @example # begin # invoice = @client.reopen_invoice(invoice_id: invoice_id) # puts "Reopened invoice #{invoice}" @@ -1472,21 +1528,33 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def reopen_invoice(invoice_id:) - path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/reopen", site_id: site_id, invoice_id: invoice_id) - put(path) + def reopen_invoice(invoice_id:, **options) + path = interpolate_path("/invoices/{invoice_id}/reopen", invoice_id: invoice_id) + put(path, **options) end + # Void a credit invoice. + # + # {https://developers.recurly.com/api/v2019-10-10#operation/void_invoice void_invoice api documenation} + # + # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). + # @return [Resources::Invoice] The updated invoice. + def void_invoice(invoice_id:, **options) + path = interpolate_path("/invoices/{invoice_id}/void", invoice_id: invoice_id) + put(path, **options) + end + # List an invoice's line items # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_invoice_line_items list_invoice_line_items api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_invoice_line_items list_invoice_line_items api documenation} # # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1509,22 +1577,23 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param original [String] Filter by original field. # @param state [String] Filter by state field. # @param type [String] Filter by type field. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::LineItem>] A list of the invoice's line items. def list_invoice_line_items(invoice_id:, **options) - path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/line_items", site_id: site_id, invoice_id: invoice_id) + path = interpolate_path("/invoices/{invoice_id}/line_items", invoice_id: invoice_id) pager(path, **options) end # Show the coupon redemptions applied to an invoice # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_invoice_coupon_redemptions list_invoice_coupon_redemptions api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_invoice_coupon_redemptions list_invoice_coupon_redemptions api documenation} # # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1542,10 +1611,11 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::CouponRedemption>] A list of the the coupon redemptions associated with the invoice. # @example # coupon_redemptions = @client.list_invoice_coupon_redemptions( # invoice_id: invoice_id, # limit: 200 @@ -1553,31 +1623,33 @@ # coupon_redemptions.each do |redemption| # puts "CouponRedemption: #{redemption.id}" # end # def list_invoice_coupon_redemptions(invoice_id:, **options) - path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/coupon_redemptions", site_id: site_id, invoice_id: invoice_id) + path = interpolate_path("/invoices/{invoice_id}/coupon_redemptions", invoice_id: invoice_id) pager(path, **options) end # List an invoice's related credit or charge invoices # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_related_invoices list_related_invoices api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_related_invoices list_related_invoices api documenation} # # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::Invoice>] A list of the credit or charge invoices associated with the invoice. - def list_related_invoices(invoice_id:) - path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/related_invoices", site_id: site_id, invoice_id: invoice_id) - pager(path) + def list_related_invoices(invoice_id:, **options) + path = interpolate_path("/invoices/{invoice_id}/related_invoices", invoice_id: invoice_id) + pager(path, **options) end # Refund an invoice # - # {https://partner-docs.recurly.com/v2018-08-09#operation/refund_invoice refund_invoice api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/refund_invoice refund_invoice api documenation} # # @param invoice_id [String] Invoice ID or number (use prefix: +number-+, e.g. +number-1000+). # @param body [Requests::InvoiceRefund] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::InvoiceRefund} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Invoice] Returns the new credit invoice. # @example # begin # invoice_refund = { # type: "amount", @@ -1592,20 +1664,20 @@ # # 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 # - def refund_invoice(invoice_id:, body:) - path = interpolate_path("/sites/{site_id}/invoices/{invoice_id}/refund", site_id: site_id, invoice_id: invoice_id) - post(path, body, Requests::InvoiceRefund) + 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 # List a site's line items # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_line_items list_line_items api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_line_items list_line_items api documenation} # - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1628,21 +1700,23 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param original [String] Filter by original field. # @param state [String] Filter by state field. # @param type [String] Filter by type field. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::LineItem>] A list of the site's line items. def list_line_items(**options) - path = interpolate_path("/sites/{site_id}/line_items", site_id: site_id) + path = interpolate_path("/line_items") pager(path, **options) end # Fetch a line item # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_line_item get_line_item api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_line_item get_line_item api documenation} # # @param line_item_id [String] Line Item ID. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::LineItem] A line item. # @example # begin # line_item = @client.get_line_item(line_item_id: line_item_id) # puts "Got LineItem #{line_item}" @@ -1650,20 +1724,22 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_line_item(line_item_id:) - path = interpolate_path("/sites/{site_id}/line_items/{line_item_id}", site_id: site_id, line_item_id: line_item_id) - get(path) + 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 # Delete an uninvoiced line item # - # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_line_item remove_line_item api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/remove_line_item remove_line_item api documenation} # # @param line_item_id [String] Line Item ID. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). + # @return [Empty] Line item deleted. # @example # begin # @client.remove_line_item( # line_item_id: line_item_id # ) @@ -1672,20 +1748,20 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def remove_line_item(line_item_id:) - path = interpolate_path("/sites/{site_id}/line_items/{line_item_id}", site_id: site_id, line_item_id: line_item_id) - delete(path) + 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 # List a site's plans # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_plans list_plans api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_plans list_plans api documenation} # - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1706,27 +1782,29 @@ # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param state [String] Filter by state. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::Plan>] A list of plans. # @example # plans = @client.list_plans(limit: 200) # plans.each do |plan| # puts "Plan: #{plan.code}" # end # def list_plans(**options) - path = interpolate_path("/sites/{site_id}/plans", site_id: site_id) + path = interpolate_path("/plans") pager(path, **options) end # Create a plan # - # {https://partner-docs.recurly.com/v2018-08-09#operation/create_plan create_plan api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/create_plan create_plan api documenation} # # @param body [Requests::PlanCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PlanCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Plan] A plan. # @example # begin # plan_create = { # code: plan_code, @@ -1751,20 +1829,21 @@ # # 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 # - def create_plan(body:) - path = interpolate_path("/sites/{site_id}/plans", site_id: site_id) - post(path, body, Requests::PlanCreate) + def create_plan(body:, **options) + path = interpolate_path("/plans") + post(path, body, Requests::PlanCreate, **options) end # Fetch a plan # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_plan get_plan api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_plan get_plan api documenation} # # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Plan] A plan. # @example # begin # plan = @client.get_plan(plan_id: plan_id) # puts "Got plan #{plan}" @@ -1772,44 +1851,46 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_plan(plan_id:) - path = interpolate_path("/sites/{site_id}/plans/{plan_id}", site_id: site_id, plan_id: plan_id) - get(path) + def get_plan(plan_id:, **options) + path = interpolate_path("/plans/{plan_id}", plan_id: plan_id) + get(path, **options) end # Update a plan # - # {https://partner-docs.recurly.com/v2018-08-09#operation/update_plan update_plan api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/update_plan update_plan api documenation} # # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+). # @param body [Requests::PlanUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PlanUpdate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Plan] A plan. - def update_plan(plan_id:, body:) - path = interpolate_path("/sites/{site_id}/plans/{plan_id}", site_id: site_id, plan_id: plan_id) - put(path, body, Requests::PlanUpdate) + def update_plan(plan_id:, body:, **options) + path = interpolate_path("/plans/{plan_id}", plan_id: plan_id) + put(path, body, Requests::PlanUpdate, **options) end # Remove a plan # - # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_plan remove_plan api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/remove_plan remove_plan api documenation} # # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Plan] Plan deleted - def remove_plan(plan_id:) - path = interpolate_path("/sites/{site_id}/plans/{plan_id}", site_id: site_id, plan_id: plan_id) - delete(path) + def remove_plan(plan_id:, **options) + path = interpolate_path("/plans/{plan_id}", plan_id: plan_id) + delete(path, **options) end # List a plan's add-ons # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_plan_add_ons list_plan_add_ons api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_plan_add_ons list_plan_add_ons api documenation} # # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1830,10 +1911,11 @@ # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param state [String] Filter by state. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::AddOn>] A list of add-ons. # @example # add_ons = @client.list_plan_add_ons( # plan_id: plan_id, # limit: 200 @@ -1841,32 +1923,34 @@ # add_ons.each do |add_on| # puts "AddOn: #{add_on.code}" # end # def list_plan_add_ons(plan_id:, **options) - path = interpolate_path("/sites/{site_id}/plans/{plan_id}/add_ons", site_id: site_id, plan_id: plan_id) + path = interpolate_path("/plans/{plan_id}/add_ons", plan_id: plan_id) pager(path, **options) end # Create an add-on # - # {https://partner-docs.recurly.com/v2018-08-09#operation/create_plan_add_on create_plan_add_on api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/create_plan_add_on create_plan_add_on api documenation} # # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+). # @param body [Requests::AddOnCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AddOnCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::AddOn] An add-on. - def create_plan_add_on(plan_id:, body:) - path = interpolate_path("/sites/{site_id}/plans/{plan_id}/add_ons", site_id: site_id, plan_id: plan_id) - post(path, body, Requests::AddOnCreate) + 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 # Fetch a plan's add-on # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_plan_add_on get_plan_add_on api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_plan_add_on get_plan_add_on api documenation} # # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+). # @param add_on_id [String] Add-on ID or code (use prefix: +code-+, e.g. +code-gold+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::AddOn] An add-on. # @example # begin # add_on = @client.get_plan_add_on( # plan_id: plan_id, add_on_id: add_on_id @@ -1876,45 +1960,47 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_plan_add_on(plan_id:, add_on_id:) - path = interpolate_path("/sites/{site_id}/plans/{plan_id}/add_ons/{add_on_id}", site_id: site_id, plan_id: plan_id, add_on_id: add_on_id) - get(path) + 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 # Update an add-on # - # {https://partner-docs.recurly.com/v2018-08-09#operation/update_plan_add_on update_plan_add_on api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/update_plan_add_on update_plan_add_on api documenation} # # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+). # @param add_on_id [String] Add-on ID or code (use prefix: +code-+, e.g. +code-gold+). # @param body [Requests::AddOnUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::AddOnUpdate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::AddOn] An add-on. - def update_plan_add_on(plan_id:, add_on_id:, body:) - path = interpolate_path("/sites/{site_id}/plans/{plan_id}/add_ons/{add_on_id}", site_id: site_id, plan_id: plan_id, add_on_id: add_on_id) - put(path, body, Requests::AddOnUpdate) + 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 # Remove an add-on # - # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_plan_add_on remove_plan_add_on api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/remove_plan_add_on remove_plan_add_on api documenation} # # @param plan_id [String] Plan ID or code (use prefix: +code-+, e.g. +code-gold+). # @param add_on_id [String] Add-on ID or code (use prefix: +code-+, e.g. +code-gold+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::AddOn] Add-on deleted - def remove_plan_add_on(plan_id:, add_on_id:) - path = interpolate_path("/sites/{site_id}/plans/{plan_id}/add_ons/{add_on_id}", site_id: site_id, plan_id: plan_id, add_on_id: add_on_id) - delete(path) + 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 # List a site's add-ons # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_add_ons list_add_ons api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_add_ons list_add_ons api documenation} # - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1935,32 +2021,81 @@ # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param state [String] Filter by state. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::AddOn>] A list of add-ons. def list_add_ons(**options) - path = interpolate_path("/sites/{site_id}/add_ons", site_id: site_id) + path = interpolate_path("/add_ons") pager(path, **options) end # Fetch an add-on # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_add_on get_add_on api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_add_on get_add_on api documenation} # # @param add_on_id [String] Add-on ID or code (use prefix: +code-+, e.g. +code-gold+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::AddOn] An add-on. - def get_add_on(add_on_id:) - path = interpolate_path("/sites/{site_id}/add_ons/{add_on_id}", site_id: site_id, add_on_id: add_on_id) - get(path) + 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 + # List a site's shipping methods + # + # {https://developers.recurly.com/api/v2019-10-10#operation/list_shipping_methods list_shipping_methods api documenation} + # + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using + # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. + # + # *Important notes:* + # + # * The +ids+ parameter cannot be used with any other ordering or filtering + # parameters (+limit+, +order+, +sort+, +begin_time+, +end_time+, etc) + # * Invalid or unknown IDs will be ignored, so you should check that the + # results correspond to your request. + # * Records are returned in an arbitrary order. Since results are all + # returned at once you can sort the records yourself. + # + # @param limit [Integer] Limit number of records 1-200. + # @param order [String] Sort order. + # @param 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. + # + # @param begin_time [DateTime] Filter by begin_time when +sort=created_at+ or +sort=updated_at+. + # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. + # + # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. + # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. + # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). + # @return [Pager<Resources::ShippingMethod>] A list of the site's shipping methods. + def list_shipping_methods(**options) + path = interpolate_path("/shipping_methods") + pager(path, **options) + end + + # Fetch a shipping method + # + # {https://developers.recurly.com/api/v2019-10-10#operation/get_shipping_method get_shipping_method api documenation} + # + # @param id [String] Shipping Method ID or code (use prefix: +code-+, e.g. +code-usps_2-day+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). + # @return [Resources::ShippingMethod] A shipping_method. + def get_shipping_method(id:, **options) + path = interpolate_path("/shipping_methods/{id}", id: id) + get(path, **options) + end + # List a site's subscriptions # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_subscriptions list_subscriptions api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_subscriptions list_subscriptions api documenation} # - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -1986,27 +2121,29 @@ # # - 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. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::Subscription>] A list of the site's subscriptions. # @example # subscriptions = @client.list_subscriptions(limit: 200) # subscriptions.each do |subscription| # puts "Subscription: #{subscription.uuid}" # end # def list_subscriptions(**options) - path = interpolate_path("/sites/{site_id}/subscriptions", site_id: site_id) + path = interpolate_path("/subscriptions") pager(path, **options) end # Create a new subscription # - # {https://partner-docs.recurly.com/v2018-08-09#operation/create_subscription create_subscription api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/create_subscription create_subscription api documenation} # # @param body [Requests::SubscriptionCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Subscription] A subscription. # @example # begin # subscription_create = { # plan_code: plan_code, @@ -2025,20 +2162,21 @@ # # 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 # - def create_subscription(body:) - path = interpolate_path("/sites/{site_id}/subscriptions", site_id: site_id) - post(path, body, Requests::SubscriptionCreate) + def create_subscription(body:, **options) + path = interpolate_path("/subscriptions") + post(path, body, Requests::SubscriptionCreate, **options) end # Fetch a subscription # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_subscription get_subscription api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_subscription get_subscription api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Subscription] A subscription. # @example # begin # subscription = @client.get_subscription( # subscription_id: subscription_id @@ -2048,21 +2186,22 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_subscription(subscription_id:) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}", site_id: site_id, subscription_id: subscription_id) - get(path) + def get_subscription(subscription_id:, **options) + path = interpolate_path("/subscriptions/{subscription_id}", subscription_id: subscription_id) + get(path, **options) end # Modify a subscription # - # {https://partner-docs.recurly.com/v2018-08-09#operation/modify_subscription modify_subscription api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/modify_subscription modify_subscription api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). # @param body [Requests::SubscriptionUpdate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionUpdate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Subscription] A subscription. # @example # begin # subscription_update = { # customer_notes: "New Notes", @@ -2077,18 +2216,18 @@ # # 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 # - def modify_subscription(subscription_id:, body:) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}", site_id: site_id, subscription_id: subscription_id) - put(path, body, Requests::SubscriptionUpdate) + def modify_subscription(subscription_id:, body:, **options) + path = interpolate_path("/subscriptions/{subscription_id}", subscription_id: subscription_id) + put(path, body, Requests::SubscriptionUpdate, **options) end # Terminate a subscription # - # {https://partner-docs.recurly.com/v2018-08-09#operation/terminate_subscription terminate_subscription api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/terminate_subscription terminate_subscription api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). # @param refund [String] The type of refund to perform: # # * +full+ - Performs a full refund of the last invoice for the current subscription term. @@ -2097,10 +2236,11 @@ # # 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. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Subscription] An expired subscription. # @example # begin # subscription = @client.terminate_subscription( # subscription_id: subscription_id, @@ -2111,19 +2251,20 @@ # # just return nil # puts "Resource Not Found" # end # def terminate_subscription(subscription_id:, **options) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}", site_id: site_id, subscription_id: subscription_id) + path = interpolate_path("/subscriptions/{subscription_id}", subscription_id: subscription_id) delete(path, **options) end # Cancel a subscription # - # {https://partner-docs.recurly.com/v2018-08-09#operation/cancel_subscription cancel_subscription api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/cancel_subscription cancel_subscription api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Subscription] A canceled or failed subscription. # @example # begin # subscription = @client.cancel_subscription( # subscription_id: subscription_id @@ -2133,20 +2274,21 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def cancel_subscription(subscription_id:) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/cancel", site_id: site_id, subscription_id: subscription_id) - put(path) + def cancel_subscription(subscription_id:, **options) + path = interpolate_path("/subscriptions/{subscription_id}/cancel", subscription_id: subscription_id) + put(path, **options) end # Reactivate a canceled subscription # - # {https://partner-docs.recurly.com/v2018-08-09#operation/reactivate_subscription reactivate_subscription api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/reactivate_subscription reactivate_subscription api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Subscription] An active subscription. # @example # begin # subscription = @client.reactivate_subscription( # subscription_id: subscription_id @@ -2156,21 +2298,22 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def reactivate_subscription(subscription_id:) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/reactivate", site_id: site_id, subscription_id: subscription_id) - put(path) + def reactivate_subscription(subscription_id:, **options) + path = interpolate_path("/subscriptions/{subscription_id}/reactivate", subscription_id: subscription_id) + put(path, **options) end # Pause subscription # - # {https://partner-docs.recurly.com/v2018-08-09#operation/pause_subscription pause_subscription api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/pause_subscription pause_subscription api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). # @param body [Requests::SubscriptionPause] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionPause} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Subscription] A subscription. # @example # begin # subscription_pause = { # remaining_pause_cycles: 10 @@ -2184,20 +2327,21 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def pause_subscription(subscription_id:, body:) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/pause", site_id: site_id, subscription_id: subscription_id) - put(path, body, Requests::SubscriptionPause) + 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 # Resume subscription # - # {https://partner-docs.recurly.com/v2018-08-09#operation/resume_subscription resume_subscription api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/resume_subscription resume_subscription api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Subscription] A subscription. # @example # begin # subscription = @client.resume_subscription( # subscription_id: subscription_id @@ -2207,20 +2351,21 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def resume_subscription(subscription_id:) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/resume", site_id: site_id, subscription_id: subscription_id) - put(path) + def resume_subscription(subscription_id:, **options) + path = interpolate_path("/subscriptions/{subscription_id}/resume", subscription_id: subscription_id) + put(path, **options) end # Fetch a subscription's pending change # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_subscription_change get_subscription_change api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_subscription_change get_subscription_change api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::SubscriptionChange] A subscription's pending change. # @example # begin # change = @client.get_subscription_change( # subscription_id: subscription_id @@ -2230,21 +2375,22 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_subscription_change(subscription_id:) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/change", site_id: site_id, subscription_id: subscription_id) - get(path) + def get_subscription_change(subscription_id:, **options) + path = interpolate_path("/subscriptions/{subscription_id}/change", subscription_id: subscription_id) + get(path, **options) end # Create a new subscription change # - # {https://partner-docs.recurly.com/v2018-08-09#operation/create_subscription_change create_subscription_change api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/create_subscription_change create_subscription_change api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). # @param body [Requests::SubscriptionChangeCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::SubscriptionChangeCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::SubscriptionChange] A subscription change. # @example # begin # change_create = { # timeframe: "now", @@ -2259,20 +2405,22 @@ # # 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 # - def create_subscription_change(subscription_id:, body:) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/change", site_id: site_id, subscription_id: subscription_id) - post(path, body, Requests::SubscriptionChangeCreate) + 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 # Delete the pending subscription change # - # {https://partner-docs.recurly.com/v2018-08-09#operation/remove_subscription_change remove_subscription_change api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/remove_subscription_change remove_subscription_change api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). + # @return [Empty] Subscription change was deleted. # @example # begin # @client.remove_subscription_change( # subscription_id: subscription_id # ) @@ -2281,21 +2429,21 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def remove_subscription_change(subscription_id:) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/change", site_id: site_id, subscription_id: subscription_id) - delete(path) + def remove_subscription_change(subscription_id:, **options) + path = interpolate_path("/subscriptions/{subscription_id}/change", subscription_id: subscription_id) + delete(path, **options) end # List a subscription's invoices # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_subscription_invoices list_subscription_invoices api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_subscription_invoices list_subscription_invoices api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -2321,10 +2469,11 @@ # - +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. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::Invoice>] A list of the subscription's invoices. # @example # invoices = @client.list_subscription_invoices( # subscription_id: subscription_id, # limit: 200 @@ -2332,20 +2481,20 @@ # invoices.each do |invoice| # puts "Invoice: #{invoice.number}" # end # def list_subscription_invoices(subscription_id:, **options) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/invoices", site_id: site_id, subscription_id: subscription_id) + path = interpolate_path("/subscriptions/{subscription_id}/invoices", subscription_id: subscription_id) pager(path, **options) end # List a subscription's line items # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_subscription_line_items list_subscription_line_items api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_subscription_line_items list_subscription_line_items api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -2368,10 +2517,11 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param original [String] Filter by original field. # @param state [String] Filter by state field. # @param type [String] Filter by type field. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::LineItem>] A list of the subscription's line items. # @example # line_items = @client.list_subscription_line_items( # subscription_id: subscription_id, # limit: 200 @@ -2379,20 +2529,20 @@ # line_items.each do |line_item| # puts "LineItem: #{line_item.id}" # end # def list_subscription_line_items(subscription_id:, **options) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/line_items", site_id: site_id, subscription_id: subscription_id) + path = interpolate_path("/subscriptions/{subscription_id}/line_items", subscription_id: subscription_id) pager(path, **options) end # Show the coupon redemptions for a subscription # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_subscription_coupon_redemptions list_subscription_coupon_redemptions api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_subscription_coupon_redemptions list_subscription_coupon_redemptions api documenation} # # @param subscription_id [String] Subscription ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -2410,10 +2560,11 @@ # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::CouponRedemption>] A list of the the coupon redemptions on a subscription. # @example # coupon_redemptions = @client.list_subscription_coupon_redemptions( # subscription_id: subscription_id, # limit: 200 @@ -2421,19 +2572,19 @@ # coupon_redemptions.each do |redemption| # puts "CouponRedemption: #{redemption.id}" # end # def list_subscription_coupon_redemptions(subscription_id:, **options) - path = interpolate_path("/sites/{site_id}/subscriptions/{subscription_id}/coupon_redemptions", site_id: site_id, subscription_id: subscription_id) + path = interpolate_path("/subscriptions/{subscription_id}/coupon_redemptions", subscription_id: subscription_id) pager(path, **options) end # List a site's transactions # - # {https://partner-docs.recurly.com/v2018-08-09#operation/list_transactions list_transactions api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/list_transactions list_transactions api documenation} # - # @param ids [string] Filter results by their IDs. Up to 200 IDs can be passed at once using + # @param ids [String] Filter results by their IDs. Up to 200 IDs can be passed at once using # commas as separators, e.g. +ids=h1at4d57xlmy,gyqgg0d3v9n1,jrsm5b4yefg6+. # # *Important notes:* # # * The +ids+ parameter cannot be used with any other ordering or filtering @@ -2455,27 +2606,29 @@ # @param end_time [DateTime] Filter by end_time when +sort=created_at+ or +sort=updated_at+. # *Note:* this value is an ISO8601 timestamp. A partial timestamp that does not include a time zone will default to UTC. # # @param type [String] Filter by type field. The value +payment+ will return both +purchase+ and +capture+ transactions. # @param success [String] Filter by success field. + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Pager<Resources::Transaction>] A list of the site's transactions. # @example # transactions = @client.list_transactions(limit: 200) # transactions.each do |transaction| # puts "Transaction: #{transaction.uuid}" # end # def list_transactions(**options) - path = interpolate_path("/sites/{site_id}/transactions", site_id: site_id) + path = interpolate_path("/transactions") pager(path, **options) end # Fetch a transaction # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_transaction get_transaction api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_transaction get_transaction api documenation} # # @param transaction_id [String] Transaction ID or UUID (use prefix: +uuid-+, e.g. +uuid-123457890+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::Transaction] A transaction. # @example # begin # transaction = @client.get_transaction(transaction_id: transaction_id) # puts "Got Transaction #{transaction}" @@ -2483,53 +2636,57 @@ # # If the resource was not found, you may want to alert the user or # # just return nil # puts "Resource Not Found" # end # - def get_transaction(transaction_id:) - path = interpolate_path("/sites/{site_id}/transactions/{transaction_id}", site_id: site_id, transaction_id: transaction_id) - get(path) + def get_transaction(transaction_id:, **options) + path = interpolate_path("/transactions/{transaction_id}", transaction_id: transaction_id) + get(path, **options) end # Fetch a unique coupon code # - # {https://partner-docs.recurly.com/v2018-08-09#operation/get_unique_coupon_code get_unique_coupon_code api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/get_unique_coupon_code get_unique_coupon_code api documenation} # # @param unique_coupon_code_id [String] Unique Coupon Code ID or code (use prefix: +code-+, e.g. +code-abc-8dh2-def+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::UniqueCouponCode] A unique coupon code. - def get_unique_coupon_code(unique_coupon_code_id:) - path = interpolate_path("/sites/{site_id}/unique_coupon_codes/{unique_coupon_code_id}", site_id: site_id, unique_coupon_code_id: unique_coupon_code_id) - get(path) + 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 # Deactivate a unique coupon code # - # {https://partner-docs.recurly.com/v2018-08-09#operation/deactivate_unique_coupon_code deactivate_unique_coupon_code api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/deactivate_unique_coupon_code deactivate_unique_coupon_code api documenation} # # @param unique_coupon_code_id [String] Unique Coupon Code ID or code (use prefix: +code-+, e.g. +code-abc-8dh2-def+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::UniqueCouponCode] A unique coupon code. - def deactivate_unique_coupon_code(unique_coupon_code_id:) - path = interpolate_path("/sites/{site_id}/unique_coupon_codes/{unique_coupon_code_id}", site_id: site_id, unique_coupon_code_id: unique_coupon_code_id) - delete(path) + 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 # Restore a unique coupon code # - # {https://partner-docs.recurly.com/v2018-08-09#operation/reactivate_unique_coupon_code reactivate_unique_coupon_code api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/reactivate_unique_coupon_code reactivate_unique_coupon_code api documenation} # # @param unique_coupon_code_id [String] Unique Coupon Code ID or code (use prefix: +code-+, e.g. +code-abc-8dh2-def+). + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::UniqueCouponCode] A unique coupon code. - def reactivate_unique_coupon_code(unique_coupon_code_id:) - path = interpolate_path("/sites/{site_id}/unique_coupon_codes/{unique_coupon_code_id}/restore", site_id: site_id, unique_coupon_code_id: unique_coupon_code_id) - put(path) + 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 # Create a new purchase # - # {https://partner-docs.recurly.com/v2018-08-09#operation/create_purchase create_purchase api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/create_purchase create_purchase api documenation} # # @param body [Requests::PurchaseCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PurchaseCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::InvoiceCollection] Returns the new invoices # @example # begin # purchase = { # currency: "USD", @@ -2554,20 +2711,21 @@ # # 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 # - def create_purchase(body:) - path = interpolate_path("/sites/{site_id}/purchases", site_id: site_id) - post(path, body, Requests::PurchaseCreate) + def create_purchase(body:, **options) + path = interpolate_path("/purchases") + post(path, body, Requests::PurchaseCreate, **options) end # Preview a new purchase # - # {https://partner-docs.recurly.com/v2018-08-09#operation/preview_purchase preview_purchase api documenation} + # {https://developers.recurly.com/api/v2019-10-10#operation/preview_purchase preview_purchase api documenation} # # @param body [Requests::PurchaseCreate] The Hash representing the JSON request to send to the server. It should conform to the schema of {Requests::PurchaseCreate} + # @param site_id [String] Site ID or subdomain (use prefix: +subdomain-+, e.g. +subdomain-recurly+). # @return [Resources::InvoiceCollection] Returns preview of the new invoices # @example # begin # purchase = { # currency: "USD", @@ -2592,11 +2750,11 @@ # # 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 # - def preview_purchase(body:) - path = interpolate_path("/sites/{site_id}/purchases/preview", site_id: site_id) - post(path, body, Requests::PurchaseCreate) + def preview_purchase(body:, **options) + path = interpolate_path("/purchases/preview") + post(path, body, Requests::PurchaseCreate, **options) end end end