From f1df4a43d45bb3b4231a2bdcf8f55c5391eaa94c Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Wed, 3 Sep 2025 16:54:08 +0000 Subject: [PATCH 01/23] Changes generated by 45e9dd05fecf12cb2551adb7ea722363c77333d4 This commit was automatically created from gocardless/gocardless-pro-ruby-template@45e9dd05fecf12cb2551adb7ea722363c77333d4 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/17440351749 --- Gemfile | 8 ------- lib/gocardless_pro/resources/event.rb | 4 ++++ lib/gocardless_pro/resources/payment.rb | 3 ++- .../services/scenario_simulators_service.rb | 6 ++++++ spec/resources/payment_spec.rb | 17 +++++++++++++++ spec/services/payments_service_spec.rb | 21 +++++++++++++++++++ 6 files changed, 50 insertions(+), 9 deletions(-) diff --git a/Gemfile b/Gemfile index df630a94..851fabc2 100644 --- a/Gemfile +++ b/Gemfile @@ -1,10 +1,2 @@ source 'https://rubygems.org' gemspec - -# We support both pre-1.x and post-1.x Faraday versions, but to ensure compatibility we -# pin this gem against each in separate runs of CI, using the FARADAY_VERSION env var. For -# more details on the values, see .github/workflows/tests.yml in the gocardless-pro-ruby -# repository. -if ENV.key?("FARADAY_VERSION") - gem 'faraday', "~> #{ENV["FARADAY_VERSION"]}" -end diff --git a/lib/gocardless_pro/resources/event.rb b/lib/gocardless_pro/resources/event.rb index fb543c68..fb556b3e 100644 --- a/lib/gocardless_pro/resources/event.rb +++ b/lib/gocardless_pro/resources/event.rb @@ -88,6 +88,10 @@ def mandate @links['mandate'] end + def mandate_request + @links['mandate_request'] + end + def mandate_request_mandate @links['mandate_request_mandate'] end diff --git a/lib/gocardless_pro/resources/payment.rb b/lib/gocardless_pro/resources/payment.rb index 56a82cdc..2cf595dd 100644 --- a/lib/gocardless_pro/resources/payment.rb +++ b/lib/gocardless_pro/resources/payment.rb @@ -19,7 +19,7 @@ module Resources # the state of a payment changes. class Payment attr_reader :amount, :amount_refunded, :charge_date, :created_at, :currency, :description, :faster_ach, :fx, :id, - :metadata, :reference, :retry_if_possible, :status + :metadata, :reference, :retry_if_possible, :scheme, :status # Initialize a payment resource instance # @param object [Hash] an object returned from the API @@ -39,6 +39,7 @@ def initialize(object, response = nil) @metadata = object['metadata'] @reference = object['reference'] @retry_if_possible = object['retry_if_possible'] + @scheme = object['scheme'] @status = object['status'] @response = response end diff --git a/lib/gocardless_pro/services/scenario_simulators_service.rb b/lib/gocardless_pro/services/scenario_simulators_service.rb index 0b7e946b..abe98024 100644 --- a/lib/gocardless_pro/services/scenario_simulators_service.rb +++ b/lib/gocardless_pro/services/scenario_simulators_service.rb @@ -132,6 +132,12 @@ class ScenarioSimulatorsService < BaseService # `failed`. The billing request must be in the `pending` state, with all # actions completed except for `bank_authorisation`. Only billing requests # with a `payment_request` are supported. + #
Restricted: This API is not # available for partner integrations.
class CreditorBankAccount - attr_reader :account_holder_name, :account_number_ending, :account_type, :bank_name, :country_code, :created_at, - :currency, :enabled, :id, :metadata, :verification_status + attr_reader :account_holder_name + attr_reader :account_number_ending + attr_reader :account_type + attr_reader :bank_name + attr_reader :country_code + attr_reader :created_at + attr_reader :currency + attr_reader :enabled + attr_reader :id + attr_reader :metadata + attr_reader :verification_status # Initialize a creditor_bank_account resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/currency_exchange_rate.rb b/lib/gocardless_pro/resources/currency_exchange_rate.rb index 80674827..cae5cf1e 100644 --- a/lib/gocardless_pro/resources/currency_exchange_rate.rb +++ b/lib/gocardless_pro/resources/currency_exchange_rate.rb @@ -12,7 +12,10 @@ module Resources # Currency exchange rates from our foreign exchange provider. class CurrencyExchangeRate - attr_reader :rate, :source, :target, :time + attr_reader :rate + attr_reader :source + attr_reader :target + attr_reader :time # Initialize a currency_exchange_rate resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/customer.rb b/lib/gocardless_pro/resources/customer.rb index 5a264309..ea5f0f7e 100644 --- a/lib/gocardless_pro/resources/customer.rb +++ b/lib/gocardless_pro/resources/customer.rb @@ -15,8 +15,24 @@ module Resources # accounts](#core-endpoints-customer-bank-accounts), which in turn can have # several Direct Debit [mandates](#core-endpoints-mandates). class Customer - attr_reader :address_line1, :address_line2, :address_line3, :city, :company_name, :country_code, :created_at, - :danish_identity_number, :email, :family_name, :given_name, :id, :language, :metadata, :phone_number, :postal_code, :region, :swedish_identity_number + attr_reader :address_line1 + attr_reader :address_line2 + attr_reader :address_line3 + attr_reader :city + attr_reader :company_name + attr_reader :country_code + attr_reader :created_at + attr_reader :danish_identity_number + attr_reader :email + attr_reader :family_name + attr_reader :given_name + attr_reader :id + attr_reader :language + attr_reader :metadata + attr_reader :phone_number + attr_reader :postal_code + attr_reader :region + attr_reader :swedish_identity_number # Initialize a customer resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/customer_bank_account.rb b/lib/gocardless_pro/resources/customer_bank_account.rb index 31fef05e..5f706aef 100644 --- a/lib/gocardless_pro/resources/customer_bank_account.rb +++ b/lib/gocardless_pro/resources/customer_bank_account.rb @@ -28,8 +28,17 @@ module Resources # [bank_details_lookups](#bank-details-lookups-perform-a-bank-details-lookup), # before proceeding with creating the accounts class CustomerBankAccount - attr_reader :account_holder_name, :account_number_ending, :account_type, :bank_account_token, :bank_name, - :country_code, :created_at, :currency, :enabled, :id, :metadata + attr_reader :account_holder_name + attr_reader :account_number_ending + attr_reader :account_type + attr_reader :bank_account_token + attr_reader :bank_name + attr_reader :country_code + attr_reader :created_at + attr_reader :currency + attr_reader :enabled + attr_reader :id + attr_reader :metadata # Initialize a customer_bank_account resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/customer_notification.rb b/lib/gocardless_pro/resources/customer_notification.rb index 522d670d..ea318509 100644 --- a/lib/gocardless_pro/resources/customer_notification.rb +++ b/lib/gocardless_pro/resources/customer_notification.rb @@ -25,7 +25,11 @@ module Resources # href="mailto:help@gocardless.com">get in touch if you would like to # use this API. class CustomerNotification - attr_reader :action_taken, :action_taken_at, :action_taken_by, :id, :type + attr_reader :action_taken + attr_reader :action_taken_at + attr_reader :action_taken_by + attr_reader :id + attr_reader :type # Initialize a customer_notification resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/event.rb b/lib/gocardless_pro/resources/event.rb index 9f5ee32a..868b9285 100644 --- a/lib/gocardless_pro/resources/event.rb +++ b/lib/gocardless_pro/resources/event.rb @@ -17,8 +17,15 @@ module Resources # corresponding event getting included in API responses. See # [here](#event-actions) for a complete list of event types. class Event - attr_reader :action, :created_at, :customer_notifications, :details, :id, :metadata, :resource_metadata, - :resource_type, :source + attr_reader :action + attr_reader :created_at + attr_reader :customer_notifications + attr_reader :details + attr_reader :id + attr_reader :metadata + attr_reader :resource_metadata + attr_reader :resource_type + attr_reader :source # Initialize a event resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/export.rb b/lib/gocardless_pro/resources/export.rb index 69a96ab6..d1f59ea9 100644 --- a/lib/gocardless_pro/resources/export.rb +++ b/lib/gocardless_pro/resources/export.rb @@ -12,7 +12,11 @@ module Resources # File-based exports of data class Export - attr_reader :created_at, :currency, :download_url, :export_type, :id + attr_reader :created_at + attr_reader :currency + attr_reader :download_url + attr_reader :export_type + attr_reader :id # Initialize a export resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/instalment_schedule.rb b/lib/gocardless_pro/resources/instalment_schedule.rb index 80c31981..0f530ff5 100644 --- a/lib/gocardless_pro/resources/instalment_schedule.rb +++ b/lib/gocardless_pro/resources/instalment_schedule.rb @@ -28,7 +28,14 @@ module Resources # of collection. # class InstalmentSchedule - attr_reader :created_at, :currency, :id, :metadata, :name, :payment_errors, :status, :total_amount + attr_reader :created_at + attr_reader :currency + attr_reader :id + attr_reader :metadata + attr_reader :name + attr_reader :payment_errors + attr_reader :status + attr_reader :total_amount # Initialize a instalment_schedule resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/institution.rb b/lib/gocardless_pro/resources/institution.rb index 29bbfc82..420dc830 100644 --- a/lib/gocardless_pro/resources/institution.rb +++ b/lib/gocardless_pro/resources/institution.rb @@ -17,7 +17,14 @@ module Resources # Not all institutions support both Payment Initiation (PIS) and Account # Information (AIS) services. class Institution - attr_reader :autocompletes_collect_bank_account, :country_code, :icon_url, :id, :limits, :logo_url, :name, :status + attr_reader :autocompletes_collect_bank_account + attr_reader :country_code + attr_reader :icon_url + attr_reader :id + attr_reader :limits + attr_reader :logo_url + attr_reader :name + attr_reader :status # Initialize a institution resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/mandate.rb b/lib/gocardless_pro/resources/mandate.rb index 6a6892d7..5ff71f12 100644 --- a/lib/gocardless_pro/resources/mandate.rb +++ b/lib/gocardless_pro/resources/mandate.rb @@ -16,8 +16,20 @@ module Resources # GoCardless will notify you via a [webhook](#appendix-webhooks) whenever # the status of a mandate changes. class Mandate - attr_reader :authorisation_source, :consent_parameters, :consent_type, :created_at, :funds_settlement, :id, - :metadata, :next_possible_charge_date, :next_possible_standard_ach_charge_date, :payments_require_approval, :reference, :scheme, :status, :verified_at + attr_reader :authorisation_source + attr_reader :consent_parameters + attr_reader :consent_type + attr_reader :created_at + attr_reader :funds_settlement + attr_reader :id + attr_reader :metadata + attr_reader :next_possible_charge_date + attr_reader :next_possible_standard_ach_charge_date + attr_reader :payments_require_approval + attr_reader :reference + attr_reader :scheme + attr_reader :status + attr_reader :verified_at # Initialize a mandate resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/mandate_import.rb b/lib/gocardless_pro/resources/mandate_import.rb index 98d08d9d..8dd94ed5 100644 --- a/lib/gocardless_pro/resources/mandate_import.rb +++ b/lib/gocardless_pro/resources/mandate_import.rb @@ -53,7 +53,10 @@ module Resources # href="mailto:help@gocardless.com">get in touch if you would like to # use this API. class MandateImport - attr_reader :created_at, :id, :scheme, :status + attr_reader :created_at + attr_reader :id + attr_reader :scheme + attr_reader :status # Initialize a mandate_import resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/mandate_import_entry.rb b/lib/gocardless_pro/resources/mandate_import_entry.rb index bb9e7f92..e485c9aa 100644 --- a/lib/gocardless_pro/resources/mandate_import_entry.rb +++ b/lib/gocardless_pro/resources/mandate_import_entry.rb @@ -41,7 +41,9 @@ module Resources # href="mailto:help@gocardless.com">get in touch if you would like to # use this API. class MandateImportEntry - attr_reader :created_at, :processing_errors, :record_identifier + attr_reader :created_at + attr_reader :processing_errors + attr_reader :record_identifier # Initialize a mandate_import_entry resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/mandate_pdf.rb b/lib/gocardless_pro/resources/mandate_pdf.rb index bd5428f4..2293032b 100644 --- a/lib/gocardless_pro/resources/mandate_pdf.rb +++ b/lib/gocardless_pro/resources/mandate_pdf.rb @@ -14,7 +14,8 @@ module Resources # compliant](#appendix-compliance-requirements) Direct Debit mandates to # your customers. class MandatePdf - attr_reader :expires_at, :url + attr_reader :expires_at + attr_reader :url # Initialize a mandate_pdf resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/negative_balance_limit.rb b/lib/gocardless_pro/resources/negative_balance_limit.rb index 167e8046..e51e1495 100644 --- a/lib/gocardless_pro/resources/negative_balance_limit.rb +++ b/lib/gocardless_pro/resources/negative_balance_limit.rb @@ -16,7 +16,10 @@ module Resources # changed on a per-creditor basis. # class NegativeBalanceLimit - attr_reader :balance_limit, :created_at, :currency, :id + attr_reader :balance_limit + attr_reader :created_at + attr_reader :currency + attr_reader :id # Initialize a negative_balance_limit resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/outbound_payment.rb b/lib/gocardless_pro/resources/outbound_payment.rb index fafe8c3e..fe5fde5f 100644 --- a/lib/gocardless_pro/resources/outbound_payment.rb +++ b/lib/gocardless_pro/resources/outbound_payment.rb @@ -23,8 +23,18 @@ module Resources # refining our API to ensure it meets your needs and provides the best # experience. class OutboundPayment - attr_reader :amount, :created_at, :currency, :description, :execution_date, :id, :is_withdrawal, :metadata, - :reference, :scheme, :status, :verifications + attr_reader :amount + attr_reader :created_at + attr_reader :currency + attr_reader :description + attr_reader :execution_date + attr_reader :id + attr_reader :is_withdrawal + attr_reader :metadata + attr_reader :reference + attr_reader :scheme + attr_reader :status + attr_reader :verifications # Initialize a outbound_payment resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/payer_authorisation.rb b/lib/gocardless_pro/resources/payer_authorisation.rb index 923dc340..79cce40c 100644 --- a/lib/gocardless_pro/resources/payer_authorisation.rb +++ b/lib/gocardless_pro/resources/payer_authorisation.rb @@ -69,7 +69,13 @@ module Resources # your servers. # class PayerAuthorisation - attr_reader :bank_account, :created_at, :customer, :id, :incomplete_fields, :mandate, :status + attr_reader :bank_account + attr_reader :created_at + attr_reader :customer + attr_reader :id + attr_reader :incomplete_fields + attr_reader :mandate + attr_reader :status # Initialize a payer_authorisation resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/payment.rb b/lib/gocardless_pro/resources/payment.rb index 2cf595dd..52addea2 100644 --- a/lib/gocardless_pro/resources/payment.rb +++ b/lib/gocardless_pro/resources/payment.rb @@ -18,8 +18,20 @@ module Resources # GoCardless will notify you via a [webhook](#appendix-webhooks) whenever # the state of a payment changes. class Payment - attr_reader :amount, :amount_refunded, :charge_date, :created_at, :currency, :description, :faster_ach, :fx, :id, - :metadata, :reference, :retry_if_possible, :scheme, :status + attr_reader :amount + attr_reader :amount_refunded + attr_reader :charge_date + attr_reader :created_at + attr_reader :currency + attr_reader :description + attr_reader :faster_ach + attr_reader :fx + attr_reader :id + attr_reader :metadata + attr_reader :reference + attr_reader :retry_if_possible + attr_reader :scheme + attr_reader :status # Initialize a payment resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/payout.rb b/lib/gocardless_pro/resources/payout.rb index 484d5ef7..b51aea41 100644 --- a/lib/gocardless_pro/resources/payout.rb +++ b/lib/gocardless_pro/resources/payout.rb @@ -17,8 +17,18 @@ module Resources # Payouts are created automatically after a payment has been successfully # collected. class Payout - attr_reader :amount, :arrival_date, :created_at, :currency, :deducted_fees, :fx, :id, :metadata, :payout_type, - :reference, :status, :tax_currency + attr_reader :amount + attr_reader :arrival_date + attr_reader :created_at + attr_reader :currency + attr_reader :deducted_fees + attr_reader :fx + attr_reader :id + attr_reader :metadata + attr_reader :payout_type + attr_reader :reference + attr_reader :status + attr_reader :tax_currency # Initialize a payout resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/payout_item.rb b/lib/gocardless_pro/resources/payout_item.rb index edf120df..d1bdd68e 100644 --- a/lib/gocardless_pro/resources/payout_item.rb +++ b/lib/gocardless_pro/resources/payout_item.rb @@ -33,7 +33,9 @@ module Resources #410 Gone.
#
class PayoutItem
- attr_reader :amount, :taxes, :type
+ attr_reader :amount
+ attr_reader :taxes
+ attr_reader :type
# Initialize a payout_item resource instance
# @param object [Hash] an object returned from the API
diff --git a/lib/gocardless_pro/resources/redirect_flow.rb b/lib/gocardless_pro/resources/redirect_flow.rb
index c4525a49..1b0737f5 100644
--- a/lib/gocardless_pro/resources/redirect_flow.rb
+++ b/lib/gocardless_pro/resources/redirect_flow.rb
@@ -49,8 +49,16 @@ module Resources
# complete an expired redirect flow. For an integrator this is shorter and
# they will expire after 10 minutes.
class RedirectFlow
- attr_reader :confirmation_url, :created_at, :description, :id, :mandate_reference, :metadata, :redirect_url,
- :scheme, :session_token, :success_redirect_url
+ attr_reader :confirmation_url
+ attr_reader :created_at
+ attr_reader :description
+ attr_reader :id
+ attr_reader :mandate_reference
+ attr_reader :metadata
+ attr_reader :redirect_url
+ attr_reader :scheme
+ attr_reader :session_token
+ attr_reader :success_redirect_url
# Initialize a redirect_flow resource instance
# @param object [Hash] an object returned from the API
diff --git a/lib/gocardless_pro/resources/refund.rb b/lib/gocardless_pro/resources/refund.rb
index 7f243f38..244c5b18 100644
--- a/lib/gocardless_pro/resources/refund.rb
+++ b/lib/gocardless_pro/resources/refund.rb
@@ -18,7 +18,14 @@ module Resources
# refund is created, and will update the `amount_refunded` property of the
# payment.
class Refund
- attr_reader :amount, :created_at, :currency, :fx, :id, :metadata, :reference, :status
+ attr_reader :amount
+ attr_reader :created_at
+ attr_reader :currency
+ attr_reader :fx
+ attr_reader :id
+ attr_reader :metadata
+ attr_reader :reference
+ attr_reader :status
# Initialize a refund resource instance
# @param object [Hash] an object returned from the API
diff --git a/lib/gocardless_pro/resources/scheme_identifier.rb b/lib/gocardless_pro/resources/scheme_identifier.rb
index 787052ce..7a638f27 100644
--- a/lib/gocardless_pro/resources/scheme_identifier.rb
+++ b/lib/gocardless_pro/resources/scheme_identifier.rb
@@ -15,8 +15,24 @@ module Resources
# on customers' bank statements.
#
class SchemeIdentifier
- attr_reader :address_line1, :address_line2, :address_line3, :can_specify_mandate_reference, :city, :country_code,
- :created_at, :currency, :email, :id, :minimum_advance_notice, :name, :phone_number, :postal_code, :reference, :region, :scheme, :status
+ attr_reader :address_line1
+ attr_reader :address_line2
+ attr_reader :address_line3
+ attr_reader :can_specify_mandate_reference
+ attr_reader :city
+ attr_reader :country_code
+ attr_reader :created_at
+ attr_reader :currency
+ attr_reader :email
+ attr_reader :id
+ attr_reader :minimum_advance_notice
+ attr_reader :name
+ attr_reader :phone_number
+ attr_reader :postal_code
+ attr_reader :reference
+ attr_reader :region
+ attr_reader :scheme
+ attr_reader :status
# Initialize a scheme_identifier resource instance
# @param object [Hash] an object returned from the API
diff --git a/lib/gocardless_pro/resources/subscription.rb b/lib/gocardless_pro/resources/subscription.rb
index 1f39e7eb..9a9badc9 100644
--- a/lib/gocardless_pro/resources/subscription.rb
+++ b/lib/gocardless_pro/resources/subscription.rb
@@ -68,8 +68,26 @@ module Resources
# - otherwise the charge date will be rolled __forwards__ to the next
# business day.
class Subscription
- attr_reader :amount, :app_fee, :count, :created_at, :currency, :day_of_month, :earliest_charge_date_after_resume,
- :end_date, :id, :interval, :interval_unit, :metadata, :month, :name, :parent_plan_paused, :payment_reference, :retry_if_possible, :start_date, :status, :upcoming_payments
+ attr_reader :amount
+ attr_reader :app_fee
+ attr_reader :count
+ attr_reader :created_at
+ attr_reader :currency
+ attr_reader :day_of_month
+ attr_reader :earliest_charge_date_after_resume
+ attr_reader :end_date
+ attr_reader :id
+ attr_reader :interval
+ attr_reader :interval_unit
+ attr_reader :metadata
+ attr_reader :month
+ attr_reader :name
+ attr_reader :parent_plan_paused
+ attr_reader :payment_reference
+ attr_reader :retry_if_possible
+ attr_reader :start_date
+ attr_reader :status
+ attr_reader :upcoming_payments
# Initialize a subscription resource instance
# @param object [Hash] an object returned from the API
diff --git a/lib/gocardless_pro/resources/tax_rate.rb b/lib/gocardless_pro/resources/tax_rate.rb
index 6df5171f..a727b65f 100644
--- a/lib/gocardless_pro/resources/tax_rate.rb
+++ b/lib/gocardless_pro/resources/tax_rate.rb
@@ -15,7 +15,12 @@ module Resources
# We also maintain a [static list of the tax rates for each
# jurisdiction](#appendix-tax-rates).
class TaxRate
- attr_reader :end_date, :id, :jurisdiction, :percentage, :start_date, :type
+ attr_reader :end_date
+ attr_reader :id
+ attr_reader :jurisdiction
+ attr_reader :percentage
+ attr_reader :start_date
+ attr_reader :type
# Initialize a tax_rate resource instance
# @param object [Hash] an object returned from the API
diff --git a/lib/gocardless_pro/resources/transferred_mandate.rb b/lib/gocardless_pro/resources/transferred_mandate.rb
index d67fd1dd..55b437ae 100644
--- a/lib/gocardless_pro/resources/transferred_mandate.rb
+++ b/lib/gocardless_pro/resources/transferred_mandate.rb
@@ -12,7 +12,9 @@ module Resources
# Mandates that have been transferred using Current Account Switch Service
class TransferredMandate
- attr_reader :encrypted_customer_bank_details, :encrypted_decryption_key, :public_key_id
+ attr_reader :encrypted_customer_bank_details
+ attr_reader :encrypted_decryption_key
+ attr_reader :public_key_id
# Initialize a transferred_mandate resource instance
# @param object [Hash] an object returned from the API
diff --git a/lib/gocardless_pro/resources/verification_detail.rb b/lib/gocardless_pro/resources/verification_detail.rb
index 29e34dd0..df411dd6 100644
--- a/lib/gocardless_pro/resources/verification_detail.rb
+++ b/lib/gocardless_pro/resources/verification_detail.rb
@@ -22,8 +22,15 @@ module Resources
# your
# account.
class VerificationDetail
- attr_reader :address_line1, :address_line2, :address_line3, :city, :company_number, :description, :directors,
- :name, :postal_code
+ attr_reader :address_line1
+ attr_reader :address_line2
+ attr_reader :address_line3
+ attr_reader :city
+ attr_reader :company_number
+ attr_reader :description
+ attr_reader :directors
+ attr_reader :name
+ attr_reader :postal_code
# Initialize a verification_detail resource instance
# @param object [Hash] an object returned from the API
diff --git a/lib/gocardless_pro/resources/webhook.rb b/lib/gocardless_pro/resources/webhook.rb
index f7ca8cc8..691ae816 100644
--- a/lib/gocardless_pro/resources/webhook.rb
+++ b/lib/gocardless_pro/resources/webhook.rb
@@ -12,8 +12,19 @@ module Resources
# Basic description of a webhook
class Webhook
- attr_reader :created_at, :id, :is_test, :request_body, :request_headers, :response_body,
- :response_body_truncated, :response_code, :response_headers, :response_headers_content_truncated, :response_headers_count_truncated, :successful, :url
+ attr_reader :created_at
+ attr_reader :id
+ attr_reader :is_test
+ attr_reader :request_body
+ attr_reader :request_headers
+ attr_reader :response_body
+ attr_reader :response_body_truncated
+ attr_reader :response_code
+ attr_reader :response_headers
+ attr_reader :response_headers_content_truncated
+ attr_reader :response_headers_count_truncated
+ attr_reader :successful
+ attr_reader :url
# Initialize a webhook resource instance
# @param object [Hash] an object returned from the API
diff --git a/lib/gocardless_pro/services/bank_account_details_service.rb b/lib/gocardless_pro/services/bank_account_details_service.rb
index 173b9405..17416554 100644
--- a/lib/gocardless_pro/services/bank_account_details_service.rb
+++ b/lib/gocardless_pro/services/bank_account_details_service.rb
@@ -18,7 +18,7 @@ class BankAccountDetailsService < BaseService
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/bank_account_details/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
diff --git a/lib/gocardless_pro/services/bank_authorisations_service.rb b/lib/gocardless_pro/services/bank_authorisations_service.rb
index 18ef3d42..8412f14c 100644
--- a/lib/gocardless_pro/services/bank_authorisations_service.rb
+++ b/lib/gocardless_pro/services/bank_authorisations_service.rb
@@ -52,7 +52,7 @@ def create(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/bank_authorisations/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
diff --git a/lib/gocardless_pro/services/billing_request_flows_service.rb b/lib/gocardless_pro/services/billing_request_flows_service.rb
index f4ac8f59..66c44119 100644
--- a/lib/gocardless_pro/services/billing_request_flows_service.rb
+++ b/lib/gocardless_pro/services/billing_request_flows_service.rb
@@ -38,7 +38,7 @@ def create(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def initialise(identity, options = {})
path = sub_url('/billing_request_flows/:identity/actions/initialise', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/billing_request_templates_service.rb b/lib/gocardless_pro/services/billing_request_templates_service.rb
index bab056c6..34c77ecf 100644
--- a/lib/gocardless_pro/services/billing_request_templates_service.rb
+++ b/lib/gocardless_pro/services/billing_request_templates_service.rb
@@ -46,7 +46,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/billing_request_templates/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -101,7 +101,7 @@ def create(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/billing_request_templates/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/billing_requests_service.rb b/lib/gocardless_pro/services/billing_requests_service.rb
index 4329974b..3b45d121 100644
--- a/lib/gocardless_pro/services/billing_requests_service.rb
+++ b/lib/gocardless_pro/services/billing_requests_service.rb
@@ -63,7 +63,7 @@ def create(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def collect_customer_details(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/collect_customer_details', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -124,7 +124,7 @@ def collect_customer_details(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def collect_bank_account(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/collect_bank_account', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -165,7 +165,7 @@ def collect_bank_account(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def confirm_payer_details(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/confirm_payer_details', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -205,7 +205,7 @@ def confirm_payer_details(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def fulfil(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/fulfil', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -245,7 +245,7 @@ def fulfil(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def cancel(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/cancel', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -313,7 +313,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/billing_requests/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -337,7 +337,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def notify(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/notify', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -377,7 +377,7 @@ def notify(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def fallback(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/fallback', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -422,7 +422,7 @@ def fallback(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def choose_currency(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/choose_currency', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -461,7 +461,7 @@ def choose_currency(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def select_institution(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/select_institution', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/blocks_service.rb b/lib/gocardless_pro/services/blocks_service.rb
index eca428f8..8d57a98f 100644
--- a/lib/gocardless_pro/services/blocks_service.rb
+++ b/lib/gocardless_pro/services/blocks_service.rb
@@ -52,7 +52,7 @@ def create(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/blocks/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -100,7 +100,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def disable(identity, options = {})
path = sub_url('/blocks/:identity/actions/disable', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -139,7 +139,7 @@ def disable(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def enable(identity, options = {})
path = sub_url('/blocks/:identity/actions/enable', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/creditor_bank_accounts_service.rb b/lib/gocardless_pro/services/creditor_bank_accounts_service.rb
index aefd047a..11becb96 100644
--- a/lib/gocardless_pro/services/creditor_bank_accounts_service.rb
+++ b/lib/gocardless_pro/services/creditor_bank_accounts_service.rb
@@ -81,7 +81,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/creditor_bank_accounts/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -107,7 +107,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def disable(identity, options = {})
path = sub_url('/creditor_bank_accounts/:identity/actions/disable', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/creditors_service.rb b/lib/gocardless_pro/services/creditors_service.rb
index 8fe0999d..f7b1d074 100644
--- a/lib/gocardless_pro/services/creditors_service.rb
+++ b/lib/gocardless_pro/services/creditors_service.rb
@@ -81,7 +81,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/creditors/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -101,7 +101,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/creditors/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/customer_bank_accounts_service.rb b/lib/gocardless_pro/services/customer_bank_accounts_service.rb
index 8c62dbe6..5dbf1673 100644
--- a/lib/gocardless_pro/services/customer_bank_accounts_service.rb
+++ b/lib/gocardless_pro/services/customer_bank_accounts_service.rb
@@ -93,7 +93,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/customer_bank_accounts/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -113,7 +113,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/customer_bank_accounts/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -142,7 +142,7 @@ def update(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def disable(identity, options = {})
path = sub_url('/customer_bank_accounts/:identity/actions/disable', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/customer_notifications_service.rb b/lib/gocardless_pro/services/customer_notifications_service.rb
index ac401752..e2423385 100644
--- a/lib/gocardless_pro/services/customer_notifications_service.rb
+++ b/lib/gocardless_pro/services/customer_notifications_service.rb
@@ -24,7 +24,7 @@ class CustomerNotificationsService < BaseService
# @param options [Hash] parameters as a hash, under a params key.
def handle(identity, options = {})
path = sub_url('/customer_notifications/:identity/actions/handle', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/customers_service.rb b/lib/gocardless_pro/services/customers_service.rb
index e176fa27..3aed5929 100644
--- a/lib/gocardless_pro/services/customers_service.rb
+++ b/lib/gocardless_pro/services/customers_service.rb
@@ -81,7 +81,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/customers/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -101,7 +101,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/customers/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -131,7 +131,7 @@ def update(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def remove(identity, options = {})
path = sub_url('/customers/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = false
diff --git a/lib/gocardless_pro/services/events_service.rb b/lib/gocardless_pro/services/events_service.rb
index 1f0ccb25..bea0c258 100644
--- a/lib/gocardless_pro/services/events_service.rb
+++ b/lib/gocardless_pro/services/events_service.rb
@@ -46,7 +46,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/events/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
diff --git a/lib/gocardless_pro/services/exports_service.rb b/lib/gocardless_pro/services/exports_service.rb
index 06acd6ed..c9584974 100644
--- a/lib/gocardless_pro/services/exports_service.rb
+++ b/lib/gocardless_pro/services/exports_service.rb
@@ -17,7 +17,7 @@ class ExportsService < BaseService
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/exports/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
diff --git a/lib/gocardless_pro/services/instalment_schedules_service.rb b/lib/gocardless_pro/services/instalment_schedules_service.rb
index 2f75dcec..8eab203c 100644
--- a/lib/gocardless_pro/services/instalment_schedules_service.rb
+++ b/lib/gocardless_pro/services/instalment_schedules_service.rb
@@ -147,7 +147,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/instalment_schedules/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -166,7 +166,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/instalment_schedules/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -193,7 +193,7 @@ def update(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def cancel(identity, options = {})
path = sub_url('/instalment_schedules/:identity/actions/cancel', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/institutions_service.rb b/lib/gocardless_pro/services/institutions_service.rb
index 333b4d48..0a154a91 100644
--- a/lib/gocardless_pro/services/institutions_service.rb
+++ b/lib/gocardless_pro/services/institutions_service.rb
@@ -47,7 +47,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def list_for_billing_request(identity, options = {})
path = sub_url('/billing_requests/:identity/institutions', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = false
diff --git a/lib/gocardless_pro/services/mandate_imports_service.rb b/lib/gocardless_pro/services/mandate_imports_service.rb
index d52f6cf3..42476310 100644
--- a/lib/gocardless_pro/services/mandate_imports_service.rb
+++ b/lib/gocardless_pro/services/mandate_imports_service.rb
@@ -56,7 +56,7 @@ def create(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/mandate_imports/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -85,7 +85,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def submit(identity, options = {})
path = sub_url('/mandate_imports/:identity/actions/submit', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -130,7 +130,7 @@ def submit(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def cancel(identity, options = {})
path = sub_url('/mandate_imports/:identity/actions/cancel', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/mandates_service.rb b/lib/gocardless_pro/services/mandates_service.rb
index 74a181fb..6b1cc0dc 100644
--- a/lib/gocardless_pro/services/mandates_service.rb
+++ b/lib/gocardless_pro/services/mandates_service.rb
@@ -82,7 +82,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/mandates/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -102,7 +102,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/mandates/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -131,7 +131,7 @@ def update(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def cancel(identity, options = {})
path = sub_url('/mandates/:identity/actions/cancel', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -181,7 +181,7 @@ def cancel(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def reinstate(identity, options = {})
path = sub_url('/mandates/:identity/actions/reinstate', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/outbound_payments_service.rb b/lib/gocardless_pro/services/outbound_payments_service.rb
index 3df57cd6..d0b00a1b 100644
--- a/lib/gocardless_pro/services/outbound_payments_service.rb
+++ b/lib/gocardless_pro/services/outbound_payments_service.rb
@@ -91,7 +91,7 @@ def withdraw(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def cancel(identity, options = {})
path = sub_url('/outbound_payments/:identity/actions/cancel', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -131,7 +131,7 @@ def cancel(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def approve(identity, options = {})
path = sub_url('/outbound_payments/:identity/actions/approve', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -170,7 +170,7 @@ def approve(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/outbound_payments/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -218,7 +218,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/outbound_payments/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/payer_authorisations_service.rb b/lib/gocardless_pro/services/payer_authorisations_service.rb
index 914aaa19..6322c445 100644
--- a/lib/gocardless_pro/services/payer_authorisations_service.rb
+++ b/lib/gocardless_pro/services/payer_authorisations_service.rb
@@ -18,7 +18,7 @@ class PayerAuthorisationsService < BaseService
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/payer_authorisations/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -85,7 +85,7 @@ def create(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/payer_authorisations/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -111,7 +111,7 @@ def update(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def submit(identity, options = {})
path = sub_url('/payer_authorisations/:identity/actions/submit', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -160,7 +160,7 @@ def submit(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def confirm(identity, options = {})
path = sub_url('/payer_authorisations/:identity/actions/confirm', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/payments_service.rb b/lib/gocardless_pro/services/payments_service.rb
index 133b02e2..af97d5d0 100644
--- a/lib/gocardless_pro/services/payments_service.rb
+++ b/lib/gocardless_pro/services/payments_service.rb
@@ -86,7 +86,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/payments/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -105,7 +105,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/payments/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -133,7 +133,7 @@ def update(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def cancel(identity, options = {})
path = sub_url('/payments/:identity/actions/cancel', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -181,7 +181,7 @@ def cancel(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def retry(identity, options = {})
path = sub_url('/payments/:identity/actions/retry', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/payouts_service.rb b/lib/gocardless_pro/services/payouts_service.rb
index 6a44e491..cf210a20 100644
--- a/lib/gocardless_pro/services/payouts_service.rb
+++ b/lib/gocardless_pro/services/payouts_service.rb
@@ -48,7 +48,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/payouts/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -67,7 +67,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/payouts/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/redirect_flows_service.rb b/lib/gocardless_pro/services/redirect_flows_service.rb
index 17c988fb..b200e2ac 100644
--- a/lib/gocardless_pro/services/redirect_flows_service.rb
+++ b/lib/gocardless_pro/services/redirect_flows_service.rb
@@ -53,7 +53,7 @@ def create(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/redirect_flows/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -81,7 +81,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def complete(identity, options = {})
path = sub_url('/redirect_flows/:identity/actions/complete', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/refunds_service.rb b/lib/gocardless_pro/services/refunds_service.rb
index 82b59d18..19303265 100644
--- a/lib/gocardless_pro/services/refunds_service.rb
+++ b/lib/gocardless_pro/services/refunds_service.rb
@@ -94,7 +94,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/refunds/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -113,7 +113,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/refunds/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/scenario_simulators_service.rb b/lib/gocardless_pro/services/scenario_simulators_service.rb
index abe98024..43c98298 100644
--- a/lib/gocardless_pro/services/scenario_simulators_service.rb
+++ b/lib/gocardless_pro/services/scenario_simulators_service.rb
@@ -147,7 +147,7 @@ class ScenarioSimulatorsService < BaseService
# @param options [Hash] parameters as a hash, under a params key.
def run(identity, options = {})
path = sub_url('/scenario_simulators/:identity/actions/run', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/scheme_identifiers_service.rb b/lib/gocardless_pro/services/scheme_identifiers_service.rb
index 62f8719d..478cc4a7 100644
--- a/lib/gocardless_pro/services/scheme_identifiers_service.rb
+++ b/lib/gocardless_pro/services/scheme_identifiers_service.rb
@@ -120,7 +120,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/scheme_identifiers/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
diff --git a/lib/gocardless_pro/services/subscriptions_service.rb b/lib/gocardless_pro/services/subscriptions_service.rb
index fa98186c..938ff089 100644
--- a/lib/gocardless_pro/services/subscriptions_service.rb
+++ b/lib/gocardless_pro/services/subscriptions_service.rb
@@ -82,7 +82,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/subscriptions/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -124,7 +124,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/subscriptions/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -186,7 +186,7 @@ def update(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def pause(identity, options = {})
path = sub_url('/subscriptions/:identity/actions/pause', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -241,7 +241,7 @@ def pause(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def resume(identity, options = {})
path = sub_url('/subscriptions/:identity/actions/resume', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
@@ -285,7 +285,7 @@ def resume(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def cancel(identity, options = {})
path = sub_url('/subscriptions/:identity/actions/cancel', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/lib/gocardless_pro/services/tax_rates_service.rb b/lib/gocardless_pro/services/tax_rates_service.rb
index 16fe9f2c..95b64583 100644
--- a/lib/gocardless_pro/services/tax_rates_service.rb
+++ b/lib/gocardless_pro/services/tax_rates_service.rb
@@ -46,7 +46,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/tax_rates/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
diff --git a/lib/gocardless_pro/services/transferred_mandates_service.rb b/lib/gocardless_pro/services/transferred_mandates_service.rb
index d9193932..6dac69d2 100644
--- a/lib/gocardless_pro/services/transferred_mandates_service.rb
+++ b/lib/gocardless_pro/services/transferred_mandates_service.rb
@@ -19,7 +19,7 @@ class TransferredMandatesService < BaseService
# @param options [Hash] parameters as a hash, under a params key.
def transferred_mandates(identity, options = {})
path = sub_url('/transferred_mandates/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = false
diff --git a/lib/gocardless_pro/services/webhooks_service.rb b/lib/gocardless_pro/services/webhooks_service.rb
index 9664be04..2de4cd6b 100644
--- a/lib/gocardless_pro/services/webhooks_service.rb
+++ b/lib/gocardless_pro/services/webhooks_service.rb
@@ -46,7 +46,7 @@ def all(options = {})
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/webhooks/:identity', {
- 'identity' => identity
+ 'identity' => identity,
})
options[:retry_failures] = true
@@ -65,7 +65,7 @@ def get(identity, options = {})
# @param options [Hash] parameters as a hash, under a params key.
def retry(identity, options = {})
path = sub_url('/webhooks/:identity/actions/retry', {
- 'identity' => identity
+ 'identity' => identity,
})
params = options.delete(:params) || {}
diff --git a/spec/api_service_spec.rb b/spec/api_service_spec.rb
index d75827b8..697a1462 100644
--- a/spec/api_service_spec.rb
+++ b/spec/api_service_spec.rb
@@ -10,14 +10,14 @@
{
status: 200,
body: '{}',
- headers: { 'Content-Type' => 'application/json' }
+ headers: { 'Content-Type' => 'application/json' },
}
end
it 'uses basic auth' do
- stub = stub_request(:get, 'https://api.example.com/customers')
- .with(headers: { 'Authorization' => 'Bearer secret_token' })
- .to_return(default_response)
+ stub = stub_request(:get, 'https://api.example.com/customers').
+ with(headers: { 'Authorization' => 'Bearer secret_token' }).
+ to_return(default_response)
service.make_request(:get, '/customers')
expect(stub).to have_been_requested
@@ -25,17 +25,17 @@
describe 'making a get request without any parameters' do
it 'is expected to call the correct stub' do
- stub = stub_request(:get, %r{.*api.example.com/customers})
- .to_return(default_response)
+ stub = stub_request(:get, %r{.*api.example.com/customers}).
+ to_return(default_response)
service.make_request(:get, '/customers')
expect(stub).to have_been_requested
end
it "doesn't include an idempotency key" do
- stub = stub_request(:get, %r{.*api.example.com/customers})
- .with { |request| !request.headers.key?('Idempotency-Key') }
- .to_return(default_response)
+ stub = stub_request(:get, %r{.*api.example.com/customers}).
+ with { |request| !request.headers.key?('Idempotency-Key') }.
+ to_return(default_response)
service.make_request(:get, '/customers')
expect(stub).to have_been_requested
@@ -44,17 +44,17 @@
describe 'making a get request with query parameters' do
it 'correctly passes the query parameters' do
- stub = stub_request(:get, %r{.*api.example.com/customers\?a=1&b=2})
- .to_return(default_response)
+ stub = stub_request(:get, %r{.*api.example.com/customers\?a=1&b=2}).
+ to_return(default_response)
service.make_request(:get, '/customers', params: { a: 1, b: 2 })
expect(stub).to have_been_requested
end
it "doesn't include an idempotency key" do
- stub = stub_request(:get, %r{.*api.example.com/customers\?a=1&b=2})
- .with { |request| !request.headers.key?('Idempotency-Key') }
- .to_return(default_response)
+ stub = stub_request(:get, %r{.*api.example.com/customers\?a=1&b=2}).
+ with { |request| !request.headers.key?('Idempotency-Key') }.
+ to_return(default_response)
service.make_request(:get, '/customers', params: { a: 1, b: 2 })
expect(stub).to have_been_requested
@@ -63,13 +63,13 @@
describe 'making a post request with some data' do
it 'passes the data in as the post body' do
- stub = stub_request(:post, %r{.*api.example.com/customers})
- .with(body: { given_name: 'Jack', family_name: 'Franklin' })
- .to_return(default_response)
+ stub = stub_request(:post, %r{.*api.example.com/customers}).
+ with(body: { given_name: 'Jack', family_name: 'Franklin' }).
+ to_return(default_response)
service.make_request(:post, '/customers', params: {
given_name: 'Jack',
- family_name: 'Franklin'
+ family_name: 'Franklin',
})
expect(stub).to have_been_requested
end
@@ -77,16 +77,16 @@
it 'generates a random idempotency key' do
allow(SecureRandom).to receive(:uuid).and_return('random-uuid')
- stub = stub_request(:post, %r{.*api.example.com/customers})
- .with(
+ stub = stub_request(:post, %r{.*api.example.com/customers}).
+ with(
body: { given_name: 'Jack', family_name: 'Franklin' },
headers: { 'Idempotency-Key' => 'random-uuid' }
- )
- .to_return(default_response)
+ ).
+ to_return(default_response)
service.make_request(:post, '/customers', params: {
given_name: 'Jack',
- family_name: 'Franklin'
+ family_name: 'Franklin',
})
expect(stub).to have_been_requested
end
@@ -94,21 +94,21 @@
describe 'making a post request with data and custom header' do
it 'passes the data in as the post body' do
- stub = stub_request(:post, %r{.*api.example.com/customers})
- .with(
+ stub = stub_request(:post, %r{.*api.example.com/customers}).
+ with(
body: { given_name: 'Jack', family_name: 'Franklin' },
headers: { 'Foo' => 'Bar' }
- )
- .to_return(default_response)
+ ).
+ to_return(default_response)
service.make_request(:post, '/customers', {
params: {
given_name: 'Jack',
- family_name: 'Franklin'
+ family_name: 'Franklin',
},
headers: {
- 'Foo' => 'Bar'
- }
+ 'Foo' => 'Bar',
+ },
})
expect(stub).to have_been_requested
end
@@ -116,42 +116,42 @@
it 'merges in a random idempotency key' do
allow(SecureRandom).to receive(:uuid).and_return('random-uuid')
- stub = stub_request(:post, %r{.*api.example.com/customers})
- .with(
+ stub = stub_request(:post, %r{.*api.example.com/customers}).
+ with(
body: { given_name: 'Jack', family_name: 'Franklin' },
headers: { 'Idempotency-Key' => 'random-uuid', 'Foo' => 'Bar' }
- )
- .to_return(default_response)
+ ).
+ to_return(default_response)
service.make_request(:post, '/customers', {
params: {
given_name: 'Jack',
- family_name: 'Franklin'
+ family_name: 'Franklin',
},
headers: {
- 'Foo' => 'Bar'
- }
+ 'Foo' => 'Bar',
+ },
})
expect(stub).to have_been_requested
end
context 'with a custom idempotency key' do
it "doesn't replace it with a randomly-generated idempotency key" do
- stub = stub_request(:post, %r{.*api.example.com/customers})
- .with(
+ stub = stub_request(:post, %r{.*api.example.com/customers}).
+ with(
body: { given_name: 'Jack', family_name: 'Franklin' },
headers: { 'Idempotency-Key' => 'my-custom-idempotency-key' }
- )
- .to_return(default_response)
+ ).
+ to_return(default_response)
service.make_request(:post, '/customers', {
params: {
given_name: 'Jack',
- family_name: 'Franklin'
+ family_name: 'Franklin',
},
headers: {
- 'Idempotency-Key' => 'my-custom-idempotency-key'
- }
+ 'Idempotency-Key' => 'my-custom-idempotency-key',
+ },
})
expect(stub).to have_been_requested
end
@@ -160,25 +160,25 @@
describe 'making a put request with some data' do
it 'passes the data in as the request body' do
- stub = stub_request(:put, %r{.*api.example.com/customers/CU123})
- .with(body: { given_name: 'Jack', family_name: 'Franklin' })
- .to_return(default_response)
+ stub = stub_request(:put, %r{.*api.example.com/customers/CU123}).
+ with(body: { given_name: 'Jack', family_name: 'Franklin' }).
+ to_return(default_response)
service.make_request(:put, '/customers/CU123', params: {
given_name: 'Jack',
- family_name: 'Franklin'
+ family_name: 'Franklin',
})
expect(stub).to have_been_requested
end
it "doesn't include an idempotency key" do
- stub = stub_request(:put, %r{.*api.example.com/customers/CU123})
- .with { |request| !request.headers.key?('Idempotency-Key') }
- .to_return(default_response)
+ stub = stub_request(:put, %r{.*api.example.com/customers/CU123}).
+ with { |request| !request.headers.key?('Idempotency-Key') }.
+ to_return(default_response)
service.make_request(:put, '/customers/CU123', params: {
given_name: 'Jack',
- family_name: 'Franklin'
+ family_name: 'Franklin',
})
expect(stub).to have_been_requested
end
diff --git a/spec/client_spec.rb b/spec/client_spec.rb
index 36739074..67d98136 100644
--- a/spec/client_spec.rb
+++ b/spec/client_spec.rb
@@ -6,7 +6,7 @@
let(:options) do
{
environment: environment,
- token: token
+ token: token,
}
end
diff --git a/spec/error_spec.rb b/spec/error_spec.rb
index 4f0ce833..d7aee3a5 100644
--- a/spec/error_spec.rb
+++ b/spec/error_spec.rb
@@ -13,12 +13,12 @@
'errors' => [
{
'message' => 'must be a number',
- 'field' => 'branch_code'
+ 'field' => 'branch_code',
}, {
'message' => 'is the wrong length (should be 8 characters)',
- 'field' => 'branch_code'
+ 'field' => 'branch_code',
}
- ]
+ ],
}
end
@@ -28,8 +28,8 @@
specify { expect(error.message).to eq('Validation failed') }
specify do
- expect(error.to_s)
- .to eq('branch_code must be a number, '\
+ expect(error.to_s).
+ to eq('branch_code must be a number, '\
'branch_code is the wrong length (should be 8 characters)')
end
specify { expect(error.type).to eq('validation_failed') }
@@ -39,10 +39,10 @@
expect(error.errors).to eq([
{
'message' => 'must be a number',
- 'field' => 'branch_code'
+ 'field' => 'branch_code',
}, {
'message' => 'is the wrong length (should be 8 characters)',
- 'field' => 'branch_code'
+ 'field' => 'branch_code',
}
])
end
diff --git a/spec/middlewares/raise_gocardless_errors_spec.rb b/spec/middlewares/raise_gocardless_errors_spec.rb
index 3b9f8ef5..5adb4e46 100644
--- a/spec/middlewares/raise_gocardless_errors_spec.rb
+++ b/spec/middlewares/raise_gocardless_errors_spec.rb
@@ -23,8 +23,8 @@
let(:status) { 514 }
it 'raises an error' do
- expect { connection.post('https://api.gocardless.com/widgets') }
- .to raise_error(GoCardlessPro::ApiError)
+ expect { connection.post('https://api.gocardless.com/widgets') }.
+ to raise_error(GoCardlessPro::ApiError)
end
end
@@ -32,8 +32,8 @@
let(:status) { 503 }
it 'raises an error' do
- expect { connection.post('https://api.gocardless.com/widgets') }
- .to raise_error(GoCardlessPro::ApiError)
+ expect { connection.post('https://api.gocardless.com/widgets') }.
+ to raise_error(GoCardlessPro::ApiError)
end
end
@@ -41,8 +41,8 @@
let(:status) { 200 }
it "doesn't raise an error" do
- expect { connection.post('https://api.gocardless.com/widgets') }
- .to_not raise_error(GoCardlessPro::ApiError)
+ expect { connection.post('https://api.gocardless.com/widgets') }.
+ to_not raise_error(GoCardlessPro::ApiError)
end
end
@@ -59,8 +59,8 @@
let(:body) { { error: { type: 'validation_failed' } }.to_json }
it 'raises a ValidationError' do
- expect { connection.post('https://api.gocardless.com/widgets') }
- .to raise_error(GoCardlessPro::ValidationError)
+ expect { connection.post('https://api.gocardless.com/widgets') }.
+ to raise_error(GoCardlessPro::ValidationError)
end
end
@@ -69,8 +69,8 @@
let(:body) { { error: { type: 'gocardless' } }.to_json }
it 'raises a GoCardlessError' do
- expect { connection.post('https://api.gocardless.com/widgets') }
- .to raise_error(GoCardlessPro::GoCardlessError)
+ expect { connection.post('https://api.gocardless.com/widgets') }.
+ to raise_error(GoCardlessPro::GoCardlessError)
end
end
@@ -79,8 +79,8 @@
let(:body) { { error: { type: 'invalid_api_usage' } }.to_json }
it 'raises a GoCardlessError' do
- expect { connection.post('https://api.gocardless.com/widgets') }
- .to raise_error(GoCardlessPro::PermissionError)
+ expect { connection.post('https://api.gocardless.com/widgets') }.
+ to raise_error(GoCardlessPro::PermissionError)
end
end
@@ -89,8 +89,8 @@
let(:body) { { error: { type: 'invalid_api_usage' } }.to_json }
it 'raises a GoCardlessError' do
- expect { connection.post('https://api.gocardless.com/widgets') }
- .to raise_error(GoCardlessPro::RateLimitError)
+ expect { connection.post('https://api.gocardless.com/widgets') }.
+ to raise_error(GoCardlessPro::RateLimitError)
end
end
@@ -99,8 +99,8 @@
let(:body) { { error: { type: 'invalid_api_usage' } }.to_json }
it 'raises a GoCardlessError' do
- expect { connection.post('https://api.gocardless.com/widgets') }
- .to raise_error(GoCardlessPro::AuthenticationError)
+ expect { connection.post('https://api.gocardless.com/widgets') }.
+ to raise_error(GoCardlessPro::AuthenticationError)
end
end
@@ -109,8 +109,8 @@
let(:body) { { error: { type: 'invalid_api_usage' } }.to_json }
it 'raises a InvalidApiUsageError' do
- expect { connection.post('https://api.gocardless.com/widgets') }
- .to raise_error(GoCardlessPro::InvalidApiUsageError)
+ expect { connection.post('https://api.gocardless.com/widgets') }.
+ to raise_error(GoCardlessPro::InvalidApiUsageError)
end
end
@@ -119,8 +119,8 @@
let(:body) { { error: { type: 'invalid_state' } }.to_json }
it 'raises an InvalidStateError' do
- expect { connection.post('https://api.gocardless.com/widgets') }
- .to raise_error(GoCardlessPro::InvalidStateError)
+ expect { connection.post('https://api.gocardless.com/widgets') }.
+ to raise_error(GoCardlessPro::InvalidStateError)
end
end
end
diff --git a/spec/resources/balance_spec.rb b/spec/resources/balance_spec.rb
index 97d833b2..7a4de851 100644
--- a/spec/resources/balance_spec.rb
+++ b/spec/resources/balance_spec.rb
@@ -22,14 +22,14 @@
'balance_type' => 'balance_type-input',
'currency' => 'currency-input',
'last_updated_at' => 'last_updated_at-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -66,12 +66,12 @@
'balance_type' => 'balance_type-input',
'currency' => 'currency-input',
'last_updated_at' => 'last_updated_at-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -86,12 +86,12 @@
'balance_type' => 'balance_type-input',
'currency' => 'currency-input',
'last_updated_at' => 'last_updated_at-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/bank_account_detail_spec.rb b/spec/resources/bank_account_detail_spec.rb
index b62624fe..8f25d4bb 100644
--- a/spec/resources/bank_account_detail_spec.rb
+++ b/spec/resources/bank_account_detail_spec.rb
@@ -17,9 +17,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/bank_account_details/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'bank_account_details' => {
@@ -27,8 +27,8 @@
'encrypted_key' => 'encrypted_key-input',
'iv' => 'iv-input',
'protected' => 'protected-input',
- 'tag' => 'tag-input'
- }
+ 'tag' => 'tag-input',
+ },
}.to_json,
headers: response_headers
)
@@ -36,7 +36,7 @@
subject(:get_response) do
client.bank_account_details.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -57,8 +57,8 @@
'encrypted_key' => 'encrypted_key-input',
'iv' => 'iv-input',
'protected' => 'protected-input',
- 'tag' => 'tag-input'
- }
+ 'tag' => 'tag-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/bank_authorisation_spec.rb b/spec/resources/bank_authorisation_spec.rb
index 5d30424a..04985753 100644
--- a/spec/resources/bank_authorisation_spec.rb
+++ b/spec/resources/bank_authorisation_spec.rb
@@ -24,13 +24,13 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/bank_authorisations})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/bank_authorisations}).
+ with(
body: {
'bank_authorisations' => {
@@ -43,11 +43,11 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'bank_authorisations' =>
@@ -62,8 +62,8 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
@@ -85,9 +85,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -114,7 +114,7 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}
end
@@ -129,11 +129,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -142,8 +142,8 @@
let!(:get_stub) do
stub_url = "/bank_authorisations/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'bank_authorisations' => {
@@ -156,8 +156,8 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -179,9 +179,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/bank_authorisations/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'bank_authorisations' => {
@@ -194,8 +194,8 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -203,7 +203,7 @@
subject(:get_response) do
client.bank_authorisations.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -229,8 +229,8 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/bank_details_lookup_spec.rb b/spec/resources/bank_details_lookup_spec.rb
index 0b6d311a..384566ad 100644
--- a/spec/resources/bank_details_lookup_spec.rb
+++ b/spec/resources/bank_details_lookup_spec.rb
@@ -17,23 +17,23 @@
'available_debit_schemes' => 'available_debit_schemes-input',
'bank_name' => 'bank_name-input',
- 'bic' => 'bic-input'
+ 'bic' => 'bic-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/bank_details_lookups})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/bank_details_lookups}).
+ with(
body: {
'bank_details_lookups' => {
'available_debit_schemes' => 'available_debit_schemes-input',
'bank_name' => 'bank_name-input',
- 'bic' => 'bic-input'
- }
+ 'bic' => 'bic-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'bank_details_lookups' =>
@@ -41,8 +41,8 @@
'available_debit_schemes' => 'available_debit_schemes-input',
'bank_name' => 'bank_name-input',
- 'bic' => 'bic-input'
- }
+ 'bic' => 'bic-input',
+ },
}.to_json,
headers: response_headers
@@ -64,9 +64,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -86,7 +86,7 @@
'available_debit_schemes' => 'available_debit_schemes-input',
'bank_name' => 'bank_name-input',
- 'bic' => 'bic-input'
+ 'bic' => 'bic-input',
}
end
@@ -101,11 +101,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
diff --git a/spec/resources/billing_request_flow_spec.rb b/spec/resources/billing_request_flow_spec.rb
index 5bf28cd0..47a1b29c 100644
--- a/spec/resources/billing_request_flow_spec.rb
+++ b/spec/resources/billing_request_flow_spec.rb
@@ -33,13 +33,13 @@
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
'show_success_redirect_button' => 'show_success_redirect_button-input',
- 'skip_success_screen' => 'skip_success_screen-input'
+ 'skip_success_screen' => 'skip_success_screen-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/billing_request_flows})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/billing_request_flows}).
+ with(
body: {
'billing_request_flows' => {
@@ -61,11 +61,11 @@
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
'show_success_redirect_button' => 'show_success_redirect_button-input',
- 'skip_success_screen' => 'skip_success_screen-input'
- }
+ 'skip_success_screen' => 'skip_success_screen-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'billing_request_flows' =>
@@ -89,8 +89,8 @@
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
'show_success_redirect_button' => 'show_success_redirect_button-input',
- 'skip_success_screen' => 'skip_success_screen-input'
- }
+ 'skip_success_screen' => 'skip_success_screen-input',
+ },
}.to_json,
headers: response_headers
@@ -112,9 +112,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -150,7 +150,7 @@
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
'show_success_redirect_button' => 'show_success_redirect_button-input',
- 'skip_success_screen' => 'skip_success_screen-input'
+ 'skip_success_screen' => 'skip_success_screen-input',
}
end
@@ -165,11 +165,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -213,8 +213,8 @@
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
'show_success_redirect_button' => 'show_success_redirect_button-input',
- 'skip_success_screen' => 'skip_success_screen-input'
- }
+ 'skip_success_screen' => 'skip_success_screen-input',
+ },
}.to_json,
headers: response_headers
@@ -237,8 +237,8 @@
let!(:stub) do
# /billing_request_flows/%v/actions/initialise
stub_url = '/billing_request_flows/:identity/actions/initialise'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -263,8 +263,8 @@
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
'show_success_redirect_button' => 'show_success_redirect_button-input',
- 'skip_success_screen' => 'skip_success_screen-input'
- }
+ 'skip_success_screen' => 'skip_success_screen-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/billing_request_spec.rb b/spec/resources/billing_request_spec.rb
index cbf2150f..a5fdf641 100644
--- a/spec/resources/billing_request_spec.rb
+++ b/spec/resources/billing_request_spec.rb
@@ -28,13 +28,13 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/billing_requests})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/billing_requests}).
+ with(
body: {
'billing_requests' => {
@@ -51,11 +51,11 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'billing_requests' =>
@@ -74,8 +74,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -97,9 +97,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -130,7 +130,7 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}
end
@@ -145,11 +145,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -158,8 +158,8 @@
let!(:get_stub) do
stub_url = "/billing_requests/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'billing_requests' => {
@@ -176,8 +176,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -216,8 +216,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -240,8 +240,8 @@
let!(:stub) do
# /billing_requests/%v/actions/collect_customer_details
stub_url = '/billing_requests/:identity/actions/collect_customer_details'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -261,8 +261,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -295,8 +295,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -319,8 +319,8 @@
let!(:stub) do
# /billing_requests/%v/actions/collect_bank_account
stub_url = '/billing_requests/:identity/actions/collect_bank_account'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -340,8 +340,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -374,8 +374,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -398,8 +398,8 @@
let!(:stub) do
# /billing_requests/%v/actions/confirm_payer_details
stub_url = '/billing_requests/:identity/actions/confirm_payer_details'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -419,8 +419,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -453,8 +453,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -477,8 +477,8 @@
let!(:stub) do
# /billing_requests/%v/actions/fulfil
stub_url = '/billing_requests/:identity/actions/fulfil'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -498,8 +498,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -532,8 +532,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -556,8 +556,8 @@
let!(:stub) do
# /billing_requests/%v/actions/cancel
stub_url = '/billing_requests/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -577,8 +577,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -608,14 +608,14 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -681,12 +681,12 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -710,12 +710,12 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -736,9 +736,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/billing_requests/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'billing_requests' => {
@@ -755,8 +755,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -764,7 +764,7 @@
subject(:get_response) do
client.billing_requests.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -794,8 +794,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -854,8 +854,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -878,8 +878,8 @@
let!(:stub) do
# /billing_requests/%v/actions/notify
stub_url = '/billing_requests/:identity/actions/notify'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -899,8 +899,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -933,8 +933,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -957,8 +957,8 @@
let!(:stub) do
# /billing_requests/%v/actions/fallback
stub_url = '/billing_requests/:identity/actions/fallback'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -978,8 +978,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -1012,8 +1012,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -1036,8 +1036,8 @@
let!(:stub) do
# /billing_requests/%v/actions/choose_currency
stub_url = '/billing_requests/:identity/actions/choose_currency'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -1057,8 +1057,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -1091,8 +1091,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -1115,8 +1115,8 @@
let!(:stub) do
# /billing_requests/%v/actions/select_institution
stub_url = '/billing_requests/:identity/actions/select_institution'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -1136,8 +1136,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/billing_request_template_spec.rb b/spec/resources/billing_request_template_spec.rb
index c19b4d71..c052e662 100644
--- a/spec/resources/billing_request_template_spec.rb
+++ b/spec/resources/billing_request_template_spec.rb
@@ -35,14 +35,14 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -122,12 +122,12 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -155,12 +155,12 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -181,9 +181,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/billing_request_templates/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'billing_request_templates' => {
@@ -204,8 +204,8 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -213,7 +213,7 @@
subject(:get_response) do
client.billing_request_templates.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -247,8 +247,8 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -305,13 +305,13 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/billing_request_templates})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/billing_request_templates}).
+ with(
body: {
'billing_request_templates' => {
@@ -332,11 +332,11 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'billing_request_templates' =>
@@ -359,8 +359,8 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
@@ -382,9 +382,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -419,7 +419,7 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}
end
@@ -434,11 +434,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -447,8 +447,8 @@
let!(:get_stub) do
stub_url = "/billing_request_templates/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'billing_request_templates' => {
@@ -469,8 +469,8 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -514,8 +514,8 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/billing_request_with_action_spec.rb b/spec/resources/billing_request_with_action_spec.rb
index 9fe5b90b..cfa32662 100644
--- a/spec/resources/billing_request_with_action_spec.rb
+++ b/spec/resources/billing_request_with_action_spec.rb
@@ -16,30 +16,30 @@
{
'bank_authorisations' => 'bank_authorisations-input',
- 'billing_requests' => 'billing_requests-input'
+ 'billing_requests' => 'billing_requests-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/billing_requests/create_with_actions})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/billing_requests/create_with_actions}).
+ with(
body: {
'billing_request_with_actions' => {
'bank_authorisations' => 'bank_authorisations-input',
- 'billing_requests' => 'billing_requests-input'
- }
+ 'billing_requests' => 'billing_requests-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'billing_request_with_actions' =>
{
'bank_authorisations' => 'bank_authorisations-input',
- 'billing_requests' => 'billing_requests-input'
- }
+ 'billing_requests' => 'billing_requests-input',
+ },
}.to_json,
headers: response_headers
@@ -61,9 +61,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -82,7 +82,7 @@
{
'bank_authorisations' => 'bank_authorisations-input',
- 'billing_requests' => 'billing_requests-input'
+ 'billing_requests' => 'billing_requests-input',
}
end
@@ -97,11 +97,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
diff --git a/spec/resources/block_spec.rb b/spec/resources/block_spec.rb
index b9cb4ee0..a3a39401 100644
--- a/spec/resources/block_spec.rb
+++ b/spec/resources/block_spec.rb
@@ -22,13 +22,13 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/blocks})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/blocks}).
+ with(
body: {
'blocks' => {
@@ -39,11 +39,11 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'blocks' =>
@@ -56,8 +56,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
@@ -79,9 +79,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -106,7 +106,7 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}
end
@@ -121,11 +121,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -134,8 +134,8 @@
let!(:get_stub) do
stub_url = "/blocks/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'blocks' => {
@@ -146,8 +146,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -169,9 +169,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/blocks/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'blocks' => {
@@ -182,8 +182,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -191,7 +191,7 @@
subject(:get_response) do
client.blocks.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -215,8 +215,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -266,14 +266,14 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -321,12 +321,12 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -344,12 +344,12 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -381,8 +381,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
@@ -405,8 +405,8 @@
let!(:stub) do
# /blocks/%v/actions/disable
stub_url = '/blocks/:identity/actions/disable'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -420,8 +420,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -448,8 +448,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
@@ -472,8 +472,8 @@
let!(:stub) do
# /blocks/%v/actions/enable
stub_url = '/blocks/:identity/actions/enable'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -487,8 +487,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -515,14 +515,14 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
@@ -548,8 +548,8 @@
let!(:stub) do
# /blocks/block_by_ref
stub_url = '/blocks/block_by_ref'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -563,8 +563,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/creditor_bank_account_spec.rb b/spec/resources/creditor_bank_account_spec.rb
index 8dbe2886..fb787d2d 100644
--- a/spec/resources/creditor_bank_account_spec.rb
+++ b/spec/resources/creditor_bank_account_spec.rb
@@ -26,13 +26,13 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/creditor_bank_accounts})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/creditor_bank_accounts}).
+ with(
body: {
'creditor_bank_accounts' => {
@@ -47,11 +47,11 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'creditor_bank_accounts' =>
@@ -68,8 +68,8 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
@@ -91,9 +91,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -122,7 +122,7 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}
end
@@ -137,11 +137,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -150,8 +150,8 @@
let!(:get_stub) do
stub_url = "/creditor_bank_accounts/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'creditor_bank_accounts' => {
@@ -166,8 +166,8 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -201,14 +201,14 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -268,12 +268,12 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -295,12 +295,12 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -321,9 +321,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/creditor_bank_accounts/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'creditor_bank_accounts' => {
@@ -338,8 +338,8 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -347,7 +347,7 @@
subject(:get_response) do
client.creditor_bank_accounts.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -375,8 +375,8 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -433,8 +433,8 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
@@ -457,8 +457,8 @@
let!(:stub) do
# /creditor_bank_accounts/%v/actions/disable
stub_url = '/creditor_bank_accounts/:identity/actions/disable'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -476,8 +476,8 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/creditor_spec.rb b/spec/resources/creditor_spec.rb
index 36a1c08f..ee69ab27 100644
--- a/spec/resources/creditor_spec.rb
+++ b/spec/resources/creditor_spec.rb
@@ -35,13 +35,13 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/creditors})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/creditors}).
+ with(
body: {
'creditors' => {
@@ -65,11 +65,11 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'creditors' =>
@@ -95,8 +95,8 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
@@ -118,9 +118,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -158,7 +158,7 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}
end
@@ -173,11 +173,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -186,8 +186,8 @@
let!(:get_stub) do
stub_url = "/creditors/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'creditors' => {
@@ -211,8 +211,8 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -255,14 +255,14 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -347,12 +347,12 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -383,12 +383,12 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -409,9 +409,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/creditors/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'creditors' => {
@@ -435,8 +435,8 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -444,7 +444,7 @@
subject(:get_response) do
client.creditors.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -481,8 +481,8 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -549,8 +549,8 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/currency_exchange_rate_spec.rb b/spec/resources/currency_exchange_rate_spec.rb
index 64e4512a..d0f97eab 100644
--- a/spec/resources/currency_exchange_rate_spec.rb
+++ b/spec/resources/currency_exchange_rate_spec.rb
@@ -21,14 +21,14 @@
'rate' => 'rate-input',
'source' => 'source-input',
'target' => 'target-input',
- 'time' => 'time-input'
+ 'time' => 'time-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -66,12 +66,12 @@
'rate' => 'rate-input',
'source' => 'source-input',
'target' => 'target-input',
- 'time' => 'time-input'
+ 'time' => 'time-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -85,12 +85,12 @@
'rate' => 'rate-input',
'source' => 'source-input',
'target' => 'target-input',
- 'time' => 'time-input'
+ 'time' => 'time-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/customer_bank_account_spec.rb b/spec/resources/customer_bank_account_spec.rb
index c6b2a6d7..2ee9f7d2 100644
--- a/spec/resources/customer_bank_account_spec.rb
+++ b/spec/resources/customer_bank_account_spec.rb
@@ -26,13 +26,13 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/customer_bank_accounts})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/customer_bank_accounts}).
+ with(
body: {
'customer_bank_accounts' => {
@@ -47,11 +47,11 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'customer_bank_accounts' =>
@@ -68,8 +68,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
@@ -91,9 +91,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -122,7 +122,7 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}
end
@@ -137,11 +137,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -150,8 +150,8 @@
let!(:get_stub) do
stub_url = "/customer_bank_accounts/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'customer_bank_accounts' => {
@@ -166,8 +166,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
)
@@ -201,14 +201,14 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -268,12 +268,12 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -295,12 +295,12 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -321,9 +321,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/customer_bank_accounts/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'customer_bank_accounts' => {
@@ -338,8 +338,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
)
@@ -347,7 +347,7 @@
subject(:get_response) do
client.customer_bank_accounts.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -375,8 +375,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
)
@@ -434,8 +434,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
)
@@ -471,8 +471,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
@@ -495,8 +495,8 @@
let!(:stub) do
# /customer_bank_accounts/%v/actions/disable
stub_url = '/customer_bank_accounts/:identity/actions/disable'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -514,8 +514,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/customer_notification_spec.rb b/spec/resources/customer_notification_spec.rb
index 31e4156c..8bf0d3d1 100644
--- a/spec/resources/customer_notification_spec.rb
+++ b/spec/resources/customer_notification_spec.rb
@@ -26,8 +26,8 @@
'action_taken_by' => 'action_taken_by-input',
'id' => 'id-input',
'links' => 'links-input',
- 'type' => 'type-input'
- }
+ 'type' => 'type-input',
+ },
}.to_json,
headers: response_headers
@@ -50,8 +50,8 @@
let!(:stub) do
# /customer_notifications/%v/actions/handle
stub_url = '/customer_notifications/:identity/actions/handle'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -63,8 +63,8 @@
'action_taken_by' => 'action_taken_by-input',
'id' => 'id-input',
'links' => 'links-input',
- 'type' => 'type-input'
- }
+ 'type' => 'type-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/customer_spec.rb b/spec/resources/customer_spec.rb
index 2c0154d8..6f866229 100644
--- a/spec/resources/customer_spec.rb
+++ b/spec/resources/customer_spec.rb
@@ -32,13 +32,13 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/customers})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/customers}).
+ with(
body: {
'customers' => {
@@ -59,11 +59,11 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'customers' =>
@@ -86,8 +86,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
@@ -109,9 +109,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -146,7 +146,7 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}
end
@@ -161,11 +161,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -174,8 +174,8 @@
let!(:get_stub) do
stub_url = "/customers/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'customers' => {
@@ -196,8 +196,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
)
@@ -237,14 +237,14 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -322,12 +322,12 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -355,12 +355,12 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -381,9 +381,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/customers/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'customers' => {
@@ -404,8 +404,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
)
@@ -413,7 +413,7 @@
subject(:get_response) do
client.customers.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -447,8 +447,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
)
@@ -512,8 +512,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
)
@@ -555,8 +555,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
@@ -579,8 +579,8 @@
let!(:stub) do
# /customers/%v
stub_url = '/customers/:identity'.gsub(':identity', resource_id)
- stub_request(:delete, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:delete, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -604,8 +604,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/event_spec.rb b/spec/resources/event_spec.rb
index 70f76af6..02a44975 100644
--- a/spec/resources/event_spec.rb
+++ b/spec/resources/event_spec.rb
@@ -27,14 +27,14 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
+ 'source' => 'source-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -86,12 +86,12 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
+ 'source' => 'source-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -111,12 +111,12 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
+ 'source' => 'source-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -137,9 +137,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/events/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'events' => {
@@ -152,8 +152,8 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
- }
+ 'source' => 'source-input',
+ },
}.to_json,
headers: response_headers
)
@@ -161,7 +161,7 @@
subject(:get_response) do
client.events.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -187,8 +187,8 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
- }
+ 'source' => 'source-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/export_spec.rb b/spec/resources/export_spec.rb
index b54a7f29..701e942f 100644
--- a/spec/resources/export_spec.rb
+++ b/spec/resources/export_spec.rb
@@ -17,9 +17,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/exports/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'exports' => {
@@ -27,8 +27,8 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}.to_json,
headers: response_headers
)
@@ -36,7 +36,7 @@
subject(:get_response) do
client.exports.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -57,8 +57,8 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}.to_json,
headers: response_headers
)
@@ -105,14 +105,14 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
+ 'id' => 'id-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -151,12 +151,12 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
+ 'id' => 'id-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -171,12 +171,12 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
+ 'id' => 'id-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/instalment_schedule_spec.rb b/spec/resources/instalment_schedule_spec.rb
index b997690d..c7b40293 100644
--- a/spec/resources/instalment_schedule_spec.rb
+++ b/spec/resources/instalment_schedule_spec.rb
@@ -23,13 +23,13 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/instalment_schedules})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).
+ with(
body: {
'instalment_schedules' => {
@@ -41,11 +41,11 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'instalment_schedules' =>
@@ -59,8 +59,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
@@ -82,9 +82,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -110,7 +110,7 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}
end
@@ -125,11 +125,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -138,8 +138,8 @@
let!(:get_stub) do
stub_url = "/instalment_schedules/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'instalment_schedules' => {
@@ -151,8 +151,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
)
@@ -180,13 +180,13 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/instalment_schedules})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).
+ with(
body: {
'instalment_schedules' => {
@@ -198,11 +198,11 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'instalment_schedules' =>
@@ -216,8 +216,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
@@ -239,9 +239,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -267,7 +267,7 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}
end
@@ -282,11 +282,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -295,8 +295,8 @@
let!(:get_stub) do
stub_url = "/instalment_schedules/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'instalment_schedules' => {
@@ -308,8 +308,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
)
@@ -340,14 +340,14 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -398,12 +398,12 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -422,12 +422,12 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -448,9 +448,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/instalment_schedules/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'instalment_schedules' => {
@@ -462,8 +462,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
)
@@ -471,7 +471,7 @@
subject(:get_response) do
client.instalment_schedules.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -496,8 +496,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
)
@@ -552,8 +552,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
)
@@ -586,8 +586,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
@@ -610,8 +610,8 @@
let!(:stub) do
# /instalment_schedules/%v/actions/cancel
stub_url = '/instalment_schedules/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -626,8 +626,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/institution_spec.rb b/spec/resources/institution_spec.rb
index eb88a6d2..bb926067 100644
--- a/spec/resources/institution_spec.rb
+++ b/spec/resources/institution_spec.rb
@@ -25,14 +25,14 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -80,12 +80,12 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -103,12 +103,12 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -140,14 +140,14 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
@@ -175,8 +175,8 @@
let!(:stub) do
# /billing_requests/%v/institutions
stub_url = '/billing_requests/:identity/institutions'.gsub(':identity', resource_id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -190,8 +190,8 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/logo_spec.rb b/spec/resources/logo_spec.rb
index 289a2c80..4e20624b 100644
--- a/spec/resources/logo_spec.rb
+++ b/spec/resources/logo_spec.rb
@@ -15,28 +15,28 @@
let(:new_resource) do
{
- 'id' => 'id-input'
+ 'id' => 'id-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/branding/logos})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/branding/logos}).
+ with(
body: {
'logos' => {
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'logos' =>
{
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}.to_json,
headers: response_headers
@@ -58,9 +58,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -78,7 +78,7 @@
let(:new_resource) do
{
- 'id' => 'id-input'
+ 'id' => 'id-input',
}
end
@@ -93,11 +93,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
diff --git a/spec/resources/mandate_import_entry_spec.rb b/spec/resources/mandate_import_entry_spec.rb
index 07dbc1a3..f4877a24 100644
--- a/spec/resources/mandate_import_entry_spec.rb
+++ b/spec/resources/mandate_import_entry_spec.rb
@@ -18,24 +18,24 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/mandate_import_entries})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/mandate_import_entries}).
+ with(
body: {
'mandate_import_entries' => {
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
- }
+ 'record_identifier' => 'record_identifier-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'mandate_import_entries' =>
@@ -44,8 +44,8 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
- }
+ 'record_identifier' => 'record_identifier-input',
+ },
}.to_json,
headers: response_headers
@@ -67,9 +67,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -90,7 +90,7 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}
end
@@ -105,11 +105,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -135,14 +135,14 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -178,12 +178,12 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -197,12 +197,12 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/mandate_import_spec.rb b/spec/resources/mandate_import_spec.rb
index c86ba3f5..93322b44 100644
--- a/spec/resources/mandate_import_spec.rb
+++ b/spec/resources/mandate_import_spec.rb
@@ -19,13 +19,13 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/mandate_imports})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/mandate_imports}).
+ with(
body: {
'mandate_imports' => {
@@ -33,11 +33,11 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'mandate_imports' =>
@@ -47,8 +47,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -70,9 +70,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -94,7 +94,7 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
@@ -109,11 +109,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -122,8 +122,8 @@
let!(:get_stub) do
stub_url = "/mandate_imports/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'mandate_imports' => {
@@ -131,8 +131,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -154,9 +154,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/mandate_imports/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'mandate_imports' => {
@@ -164,8 +164,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -173,7 +173,7 @@
subject(:get_response) do
client.mandate_imports.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -194,8 +194,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -245,8 +245,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -269,8 +269,8 @@
let!(:stub) do
# /mandate_imports/%v/actions/submit
stub_url = '/mandate_imports/:identity/actions/submit'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -281,8 +281,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -306,8 +306,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -330,8 +330,8 @@
let!(:stub) do
# /mandate_imports/%v/actions/cancel
stub_url = '/mandate_imports/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -342,8 +342,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/mandate_pdf_spec.rb b/spec/resources/mandate_pdf_spec.rb
index 526cefaf..4d500f97 100644
--- a/spec/resources/mandate_pdf_spec.rb
+++ b/spec/resources/mandate_pdf_spec.rb
@@ -16,30 +16,30 @@
{
'expires_at' => 'expires_at-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/mandate_pdfs})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/mandate_pdfs}).
+ with(
body: {
'mandate_pdfs' => {
'expires_at' => 'expires_at-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'mandate_pdfs' =>
{
'expires_at' => 'expires_at-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
@@ -61,9 +61,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -82,7 +82,7 @@
{
'expires_at' => 'expires_at-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}
end
@@ -97,11 +97,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
diff --git a/spec/resources/mandate_spec.rb b/spec/resources/mandate_spec.rb
index 022be389..bba878a2 100644
--- a/spec/resources/mandate_spec.rb
+++ b/spec/resources/mandate_spec.rb
@@ -29,13 +29,13 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/mandates})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/mandates}).
+ with(
body: {
'mandates' => {
@@ -53,11 +53,11 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'mandates' =>
@@ -77,8 +77,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
@@ -100,9 +100,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -134,7 +134,7 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}
end
@@ -149,11 +149,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -162,8 +162,8 @@
let!(:get_stub) do
stub_url = "/mandates/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'mandates' => {
@@ -181,8 +181,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -219,14 +219,14 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -293,12 +293,12 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -323,12 +323,12 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -349,9 +349,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/mandates/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'mandates' => {
@@ -369,8 +369,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -378,7 +378,7 @@
subject(:get_response) do
client.mandates.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -409,8 +409,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -471,8 +471,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -511,8 +511,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
@@ -535,8 +535,8 @@
let!(:stub) do
# /mandates/%v/actions/cancel
stub_url = '/mandates/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -557,8 +557,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -592,8 +592,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
@@ -616,8 +616,8 @@
let!(:stub) do
# /mandates/%v/actions/reinstate
stub_url = '/mandates/:identity/actions/reinstate'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -638,8 +638,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/negative_balance_limit_spec.rb b/spec/resources/negative_balance_limit_spec.rb
index 7f0e321b..78d0f8e1 100644
--- a/spec/resources/negative_balance_limit_spec.rb
+++ b/spec/resources/negative_balance_limit_spec.rb
@@ -22,14 +22,14 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -68,12 +68,12 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -88,12 +88,12 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/outbound_payment_spec.rb b/spec/resources/outbound_payment_spec.rb
index bca96355..130ff166 100644
--- a/spec/resources/outbound_payment_spec.rb
+++ b/spec/resources/outbound_payment_spec.rb
@@ -27,13 +27,13 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/outbound_payments})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/outbound_payments}).
+ with(
body: {
'outbound_payments' => {
@@ -49,11 +49,11 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'outbound_payments' =>
@@ -71,8 +71,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
@@ -94,9 +94,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -126,7 +126,7 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}
end
@@ -141,11 +141,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -154,8 +154,8 @@
let!(:get_stub) do
stub_url = "/outbound_payments/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'outbound_payments' => {
@@ -171,8 +171,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -210,8 +210,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
@@ -232,8 +232,8 @@
let!(:stub) do
# /outbound_payments/withdrawal
stub_url = '/outbound_payments/withdrawal'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -252,8 +252,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -285,8 +285,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
@@ -309,8 +309,8 @@
let!(:stub) do
# /outbound_payments/%v/actions/cancel
stub_url = '/outbound_payments/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -329,8 +329,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -362,8 +362,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
@@ -386,8 +386,8 @@
let!(:stub) do
# /outbound_payments/%v/actions/approve
stub_url = '/outbound_payments/:identity/actions/approve'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -406,8 +406,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -423,9 +423,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/outbound_payments/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'outbound_payments' => {
@@ -441,8 +441,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -450,7 +450,7 @@
subject(:get_response) do
client.outbound_payments.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -479,8 +479,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -535,14 +535,14 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -605,12 +605,12 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -633,12 +633,12 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -676,8 +676,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/payer_authorisation_spec.rb b/spec/resources/payer_authorisation_spec.rb
index 9c4c6214..d12f790e 100644
--- a/spec/resources/payer_authorisation_spec.rb
+++ b/spec/resources/payer_authorisation_spec.rb
@@ -17,9 +17,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/payer_authorisations/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'payer_authorisations' => {
@@ -30,8 +30,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -39,7 +39,7 @@
subject(:get_response) do
client.payer_authorisations.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -63,8 +63,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -111,13 +111,13 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/payer_authorisations})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/payer_authorisations}).
+ with(
body: {
'payer_authorisations' => {
@@ -128,11 +128,11 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'payer_authorisations' =>
@@ -145,8 +145,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -168,9 +168,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -195,7 +195,7 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
@@ -210,11 +210,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -223,8 +223,8 @@
let!(:get_stub) do
stub_url = "/payer_authorisations/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'payer_authorisations' => {
@@ -235,8 +235,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -270,8 +270,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -303,8 +303,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -327,8 +327,8 @@
let!(:stub) do
# /payer_authorisations/%v/actions/submit
stub_url = '/payer_authorisations/:identity/actions/submit'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -342,8 +342,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -370,8 +370,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -394,8 +394,8 @@
let!(:stub) do
# /payer_authorisations/%v/actions/confirm
stub_url = '/payer_authorisations/:identity/actions/confirm'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -409,8 +409,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/payer_theme_spec.rb b/spec/resources/payer_theme_spec.rb
index 5eec7d5f..f5d03815 100644
--- a/spec/resources/payer_theme_spec.rb
+++ b/spec/resources/payer_theme_spec.rb
@@ -15,28 +15,28 @@
let(:new_resource) do
{
- 'id' => 'id-input'
+ 'id' => 'id-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/branding/payer_themes})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/branding/payer_themes}).
+ with(
body: {
'payer_themes' => {
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'payer_themes' =>
{
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}.to_json,
headers: response_headers
@@ -58,9 +58,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -78,7 +78,7 @@
let(:new_resource) do
{
- 'id' => 'id-input'
+ 'id' => 'id-input',
}
end
@@ -93,11 +93,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
diff --git a/spec/resources/payment_spec.rb b/spec/resources/payment_spec.rb
index c005c174..c3a518b6 100644
--- a/spec/resources/payment_spec.rb
+++ b/spec/resources/payment_spec.rb
@@ -29,13 +29,13 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/payments})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/payments}).
+ with(
body: {
'payments' => {
@@ -53,11 +53,11 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'payments' =>
@@ -77,8 +77,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -100,9 +100,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -134,7 +134,7 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
@@ -149,11 +149,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -162,8 +162,8 @@
let!(:get_stub) do
stub_url = "/payments/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'payments' => {
@@ -181,8 +181,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -219,14 +219,14 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -293,12 +293,12 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -323,12 +323,12 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -349,9 +349,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/payments/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'payments' => {
@@ -369,8 +369,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -378,7 +378,7 @@
subject(:get_response) do
client.payments.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -409,8 +409,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -471,8 +471,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -511,8 +511,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -535,8 +535,8 @@
let!(:stub) do
# /payments/%v/actions/cancel
stub_url = '/payments/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -557,8 +557,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -592,8 +592,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -616,8 +616,8 @@
let!(:stub) do
# /payments/%v/actions/retry
stub_url = '/payments/:identity/actions/retry'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -638,8 +638,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/payout_item_spec.rb b/spec/resources/payout_item_spec.rb
index f6a79f6b..37c87182 100644
--- a/spec/resources/payout_item_spec.rb
+++ b/spec/resources/payout_item_spec.rb
@@ -21,14 +21,14 @@
'amount' => 'amount-input',
'links' => 'links-input',
'taxes' => 'taxes-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -62,12 +62,12 @@
'amount' => 'amount-input',
'links' => 'links-input',
'taxes' => 'taxes-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -81,12 +81,12 @@
'amount' => 'amount-input',
'links' => 'links-input',
'taxes' => 'taxes-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/payout_spec.rb b/spec/resources/payout_spec.rb
index c2f9b8ff..bf01f263 100644
--- a/spec/resources/payout_spec.rb
+++ b/spec/resources/payout_spec.rb
@@ -30,14 +30,14 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
+ 'tax_currency' => 'tax_currency-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -98,12 +98,12 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
+ 'tax_currency' => 'tax_currency-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -126,12 +126,12 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
+ 'tax_currency' => 'tax_currency-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -152,9 +152,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/payouts/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'payouts' => {
@@ -170,8 +170,8 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
- }
+ 'tax_currency' => 'tax_currency-input',
+ },
}.to_json,
headers: response_headers
)
@@ -179,7 +179,7 @@
subject(:get_response) do
client.payouts.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -208,8 +208,8 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
- }
+ 'tax_currency' => 'tax_currency-input',
+ },
}.to_json,
headers: response_headers
)
@@ -268,8 +268,8 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
- }
+ 'tax_currency' => 'tax_currency-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/redirect_flow_spec.rb b/spec/resources/redirect_flow_spec.rb
index 8c277bcd..620653c8 100644
--- a/spec/resources/redirect_flow_spec.rb
+++ b/spec/resources/redirect_flow_spec.rb
@@ -25,13 +25,13 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
+ 'success_redirect_url' => 'success_redirect_url-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/redirect_flows})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/redirect_flows}).
+ with(
body: {
'redirect_flows' => {
@@ -45,11 +45,11 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'redirect_flows' =>
@@ -65,8 +65,8 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}.to_json,
headers: response_headers
@@ -88,9 +88,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -118,7 +118,7 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
+ 'success_redirect_url' => 'success_redirect_url-input',
}
end
@@ -133,11 +133,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -146,8 +146,8 @@
let!(:get_stub) do
stub_url = "/redirect_flows/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'redirect_flows' => {
@@ -161,8 +161,8 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -184,9 +184,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/redirect_flows/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'redirect_flows' => {
@@ -200,8 +200,8 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -209,7 +209,7 @@
subject(:get_response) do
client.redirect_flows.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -236,8 +236,8 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -293,8 +293,8 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}.to_json,
headers: response_headers
@@ -317,8 +317,8 @@
let!(:stub) do
# /redirect_flows/%v/actions/complete
stub_url = '/redirect_flows/:identity/actions/complete'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -335,8 +335,8 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/refund_spec.rb b/spec/resources/refund_spec.rb
index 773714f9..e4ce1217 100644
--- a/spec/resources/refund_spec.rb
+++ b/spec/resources/refund_spec.rb
@@ -23,13 +23,13 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/refunds})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/refunds}).
+ with(
body: {
'refunds' => {
@@ -41,11 +41,11 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'refunds' =>
@@ -59,8 +59,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -82,9 +82,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -110,7 +110,7 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
@@ -125,11 +125,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -138,8 +138,8 @@
let!(:get_stub) do
stub_url = "/refunds/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'refunds' => {
@@ -151,8 +151,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -183,14 +183,14 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -239,12 +239,12 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -263,12 +263,12 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -289,9 +289,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/refunds/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'refunds' => {
@@ -303,8 +303,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -312,7 +312,7 @@
subject(:get_response) do
client.refunds.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -337,8 +337,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -393,8 +393,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/scenario_simulator_spec.rb b/spec/resources/scenario_simulator_spec.rb
index f5595e7f..1614879d 100644
--- a/spec/resources/scenario_simulator_spec.rb
+++ b/spec/resources/scenario_simulator_spec.rb
@@ -21,8 +21,8 @@
body: {
'scenario_simulators' => {
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}.to_json,
headers: response_headers
@@ -45,16 +45,16 @@
let!(:stub) do
# /scenario_simulators/%v/actions/run
stub_url = '/scenario_simulators/:identity/actions/run'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
body: {
'scenario_simulators' => {
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/scheme_identifier_spec.rb b/spec/resources/scheme_identifier_spec.rb
index fc0beb4b..0d03264b 100644
--- a/spec/resources/scheme_identifier_spec.rb
+++ b/spec/resources/scheme_identifier_spec.rb
@@ -32,13 +32,13 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/scheme_identifiers})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/scheme_identifiers}).
+ with(
body: {
'scheme_identifiers' => {
@@ -59,11 +59,11 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'scheme_identifiers' =>
@@ -86,8 +86,8 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -109,9 +109,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -146,7 +146,7 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
@@ -161,11 +161,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -174,8 +174,8 @@
let!(:get_stub) do
stub_url = "/scheme_identifiers/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'scheme_identifiers' => {
@@ -196,8 +196,8 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -237,14 +237,14 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -324,12 +324,12 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -357,12 +357,12 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -383,9 +383,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/scheme_identifiers/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'scheme_identifiers' => {
@@ -406,8 +406,8 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -415,7 +415,7 @@
subject(:get_response) do
client.scheme_identifiers.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -449,8 +449,8 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/subscription_spec.rb b/spec/resources/subscription_spec.rb
index dbb008a9..afeca8dc 100644
--- a/spec/resources/subscription_spec.rb
+++ b/spec/resources/subscription_spec.rb
@@ -35,13 +35,13 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/subscriptions})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/subscriptions}).
+ with(
body: {
'subscriptions' => {
@@ -65,11 +65,11 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'subscriptions' =>
@@ -95,8 +95,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
@@ -118,9 +118,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -158,7 +158,7 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}
end
@@ -173,11 +173,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -186,8 +186,8 @@
let!(:get_stub) do
stub_url = "/subscriptions/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'subscriptions' => {
@@ -211,8 +211,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
@@ -255,14 +255,14 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -347,12 +347,12 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -383,12 +383,12 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -409,9 +409,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/subscriptions/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'subscriptions' => {
@@ -435,8 +435,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
@@ -444,7 +444,7 @@
subject(:get_response) do
client.subscriptions.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -481,8 +481,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
@@ -549,8 +549,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
@@ -595,8 +595,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
@@ -619,8 +619,8 @@
let!(:stub) do
# /subscriptions/%v/actions/pause
stub_url = '/subscriptions/:identity/actions/pause'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -647,8 +647,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
@@ -688,8 +688,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
@@ -712,8 +712,8 @@
let!(:stub) do
# /subscriptions/%v/actions/resume
stub_url = '/subscriptions/:identity/actions/resume'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -740,8 +740,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
@@ -781,8 +781,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
@@ -805,8 +805,8 @@
let!(:stub) do
# /subscriptions/%v/actions/cancel
stub_url = '/subscriptions/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -833,8 +833,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/tax_rate_spec.rb b/spec/resources/tax_rate_spec.rb
index d3065541..0bb8e832 100644
--- a/spec/resources/tax_rate_spec.rb
+++ b/spec/resources/tax_rate_spec.rb
@@ -23,14 +23,14 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -72,12 +72,12 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -93,12 +93,12 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -119,9 +119,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/tax_rates/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'tax_rates' => {
@@ -130,8 +130,8 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
- }
+ 'type' => 'type-input',
+ },
}.to_json,
headers: response_headers
)
@@ -139,7 +139,7 @@
subject(:get_response) do
client.tax_rates.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -161,8 +161,8 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
- }
+ 'type' => 'type-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/transferred_mandate_spec.rb b/spec/resources/transferred_mandate_spec.rb
index 91f9d19f..54f75625 100644
--- a/spec/resources/transferred_mandate_spec.rb
+++ b/spec/resources/transferred_mandate_spec.rb
@@ -24,8 +24,8 @@
'encrypted_customer_bank_details' => 'encrypted_customer_bank_details-input',
'encrypted_decryption_key' => 'encrypted_decryption_key-input',
'links' => 'links-input',
- 'public_key_id' => 'public_key_id-input'
- }
+ 'public_key_id' => 'public_key_id-input',
+ },
}.to_json,
headers: response_headers
@@ -48,8 +48,8 @@
let!(:stub) do
# /transferred_mandates/%v
stub_url = '/transferred_mandates/:identity'.gsub(':identity', resource_id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -59,8 +59,8 @@
'encrypted_customer_bank_details' => 'encrypted_customer_bank_details-input',
'encrypted_decryption_key' => 'encrypted_decryption_key-input',
'links' => 'links-input',
- 'public_key_id' => 'public_key_id-input'
- }
+ 'public_key_id' => 'public_key_id-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/verification_detail_spec.rb b/spec/resources/verification_detail_spec.rb
index e4cf45db..bf3a507a 100644
--- a/spec/resources/verification_detail_spec.rb
+++ b/spec/resources/verification_detail_spec.rb
@@ -24,13 +24,13 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/verification_details})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/verification_details}).
+ with(
body: {
'verification_details' => {
@@ -43,11 +43,11 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
- }
+ 'postal_code' => 'postal_code-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'verification_details' =>
@@ -62,8 +62,8 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
- }
+ 'postal_code' => 'postal_code-input',
+ },
}.to_json,
headers: response_headers
@@ -85,9 +85,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -114,7 +114,7 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}
end
@@ -129,11 +129,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -165,14 +165,14 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -226,12 +226,12 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -251,12 +251,12 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/webhook_spec.rb b/spec/resources/webhook_spec.rb
index 47cf7d13..8171013d 100644
--- a/spec/resources/webhook_spec.rb
+++ b/spec/resources/webhook_spec.rb
@@ -30,14 +30,14 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
)
@@ -100,12 +100,12 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -128,12 +128,12 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -154,9 +154,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/webhooks/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'webhooks' => {
@@ -172,8 +172,8 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -181,7 +181,7 @@
subject(:get_response) do
client.webhooks.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -210,8 +210,8 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -269,8 +269,8 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
@@ -293,8 +293,8 @@
let!(:stub) do
# /webhooks/%v/actions/retry
stub_url = '/webhooks/:identity/actions/retry'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -313,8 +313,8 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/balances_service_spec.rb b/spec/services/balances_service_spec.rb
index 24e4a458..76cbe1d0 100644
--- a/spec/services/balances_service_spec.rb
+++ b/spec/services/balances_service_spec.rb
@@ -21,14 +21,14 @@
'balance_type' => 'balance_type-input',
'currency' => 'currency-input',
'last_updated_at' => 'last_updated_at-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -62,19 +62,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/balances})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/balances}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/balances})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/balances}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -93,12 +93,12 @@
'balance_type' => 'balance_type-input',
'currency' => 'currency-input',
'last_updated_at' => 'last_updated_at-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -113,12 +113,12 @@
'balance_type' => 'balance_type-input',
'currency' => 'currency-input',
'last_updated_at' => 'last_updated_at-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -142,19 +142,19 @@
'balance_type' => 'balance_type-input',
'currency' => 'currency-input',
'last_updated_at' => 'last_updated_at-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/balances\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/balances\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'balances' => [{
@@ -162,12 +162,12 @@
'balance_type' => 'balance_type-input',
'currency' => 'currency-input',
'last_updated_at' => 'last_updated_at-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -187,18 +187,18 @@
'balance_type' => 'balance_type-input',
'currency' => 'currency-input',
'last_updated_at' => 'last_updated_at-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/balances\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/balances\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -210,12 +210,12 @@
'balance_type' => 'balance_type-input',
'currency' => 'currency-input',
'last_updated_at' => 'last_updated_at-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/bank_account_details_service_spec.rb b/spec/services/bank_account_details_service_spec.rb
index 0974aef0..709d65bf 100644
--- a/spec/services/bank_account_details_service_spec.rb
+++ b/spec/services/bank_account_details_service_spec.rb
@@ -17,9 +17,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/bank_account_details/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'bank_account_details' => {
@@ -27,8 +27,8 @@
'encrypted_key' => 'encrypted_key-input',
'iv' => 'iv-input',
'protected' => 'protected-input',
- 'tag' => 'tag-input'
- }
+ 'tag' => 'tag-input',
+ },
}.to_json,
headers: response_headers
)
@@ -36,7 +36,7 @@
subject(:get_response) do
client.bank_account_details.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -57,8 +57,8 @@
'encrypted_key' => 'encrypted_key-input',
'iv' => 'iv-input',
'protected' => 'protected-input',
- 'tag' => 'tag-input'
- }
+ 'tag' => 'tag-input',
+ },
}.to_json,
headers: response_headers
)
@@ -97,8 +97,8 @@
it 'retries timeouts' do
stub_url = '/bank_account_details/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -107,11 +107,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/bank_account_details/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -126,20 +126,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
diff --git a/spec/services/bank_authorisations_service_spec.rb b/spec/services/bank_authorisations_service_spec.rb
index f2da9c90..f80a3bb4 100644
--- a/spec/services/bank_authorisations_service_spec.rb
+++ b/spec/services/bank_authorisations_service_spec.rb
@@ -24,13 +24,13 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/bank_authorisations})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/bank_authorisations}).
+ with(
body: {
'bank_authorisations' => {
@@ -43,11 +43,11 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'bank_authorisations' =>
@@ -62,8 +62,8 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
@@ -78,19 +78,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/bank_authorisations})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/bank_authorisations}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/bank_authorisations})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/bank_authorisations}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -108,9 +108,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -137,7 +137,7 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}
end
@@ -152,11 +152,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -165,8 +165,8 @@
let!(:get_stub) do
stub_url = "/bank_authorisations/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'bank_authorisations' => {
@@ -179,8 +179,8 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -203,8 +203,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -218,9 +218,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/bank_authorisations/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'bank_authorisations' => {
@@ -233,8 +233,8 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -242,7 +242,7 @@
subject(:get_response) do
client.bank_authorisations.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -268,8 +268,8 @@
'links' => 'links-input',
'qr_code_url' => 'qr_code_url-input',
'redirect_uri' => 'redirect_uri-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -308,8 +308,8 @@
it 'retries timeouts' do
stub_url = '/bank_authorisations/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -318,11 +318,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/bank_authorisations/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -337,20 +337,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
diff --git a/spec/services/bank_details_lookups_service_spec.rb b/spec/services/bank_details_lookups_service_spec.rb
index 4fc1a81a..a5c166c9 100644
--- a/spec/services/bank_details_lookups_service_spec.rb
+++ b/spec/services/bank_details_lookups_service_spec.rb
@@ -17,23 +17,23 @@
'available_debit_schemes' => 'available_debit_schemes-input',
'bank_name' => 'bank_name-input',
- 'bic' => 'bic-input'
+ 'bic' => 'bic-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/bank_details_lookups})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/bank_details_lookups}).
+ with(
body: {
'bank_details_lookups' => {
'available_debit_schemes' => 'available_debit_schemes-input',
'bank_name' => 'bank_name-input',
- 'bic' => 'bic-input'
- }
+ 'bic' => 'bic-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'bank_details_lookups' =>
@@ -41,8 +41,8 @@
'available_debit_schemes' => 'available_debit_schemes-input',
'bank_name' => 'bank_name-input',
- 'bic' => 'bic-input'
- }
+ 'bic' => 'bic-input',
+ },
}.to_json,
headers: response_headers
@@ -57,19 +57,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/bank_details_lookups})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/bank_details_lookups}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/bank_details_lookups})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/bank_details_lookups}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -87,9 +87,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -109,7 +109,7 @@
'available_debit_schemes' => 'available_debit_schemes-input',
'bank_name' => 'bank_name-input',
- 'bic' => 'bic-input'
+ 'bic' => 'bic-input',
}
end
@@ -124,11 +124,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
diff --git a/spec/services/billing_request_flows_service_spec.rb b/spec/services/billing_request_flows_service_spec.rb
index bec481e7..55f25ab4 100644
--- a/spec/services/billing_request_flows_service_spec.rb
+++ b/spec/services/billing_request_flows_service_spec.rb
@@ -33,13 +33,13 @@
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
'show_success_redirect_button' => 'show_success_redirect_button-input',
- 'skip_success_screen' => 'skip_success_screen-input'
+ 'skip_success_screen' => 'skip_success_screen-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/billing_request_flows})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/billing_request_flows}).
+ with(
body: {
'billing_request_flows' => {
@@ -61,11 +61,11 @@
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
'show_success_redirect_button' => 'show_success_redirect_button-input',
- 'skip_success_screen' => 'skip_success_screen-input'
- }
+ 'skip_success_screen' => 'skip_success_screen-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'billing_request_flows' =>
@@ -89,8 +89,8 @@
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
'show_success_redirect_button' => 'show_success_redirect_button-input',
- 'skip_success_screen' => 'skip_success_screen-input'
- }
+ 'skip_success_screen' => 'skip_success_screen-input',
+ },
}.to_json,
headers: response_headers
@@ -105,19 +105,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/billing_request_flows})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/billing_request_flows}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/billing_request_flows})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/billing_request_flows}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -135,9 +135,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -173,7 +173,7 @@
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
'show_success_redirect_button' => 'show_success_redirect_button-input',
- 'skip_success_screen' => 'skip_success_screen-input'
+ 'skip_success_screen' => 'skip_success_screen-input',
}
end
@@ -188,11 +188,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -236,8 +236,8 @@
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
'show_success_redirect_button' => 'show_success_redirect_button-input',
- 'skip_success_screen' => 'skip_success_screen-input'
- }
+ 'skip_success_screen' => 'skip_success_screen-input',
+ },
}.to_json,
headers: response_headers
@@ -253,8 +253,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/billing_request_flows/:identity/actions/initialise'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -271,8 +271,8 @@
let!(:stub) do
# /billing_request_flows/%v/actions/initialise
stub_url = '/billing_request_flows/:identity/actions/initialise'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -297,8 +297,8 @@
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
'show_success_redirect_button' => 'show_success_redirect_button-input',
- 'skip_success_screen' => 'skip_success_screen-input'
- }
+ 'skip_success_screen' => 'skip_success_screen-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/billing_request_templates_service_spec.rb b/spec/services/billing_request_templates_service_spec.rb
index c1bcec27..d35918e5 100644
--- a/spec/services/billing_request_templates_service_spec.rb
+++ b/spec/services/billing_request_templates_service_spec.rb
@@ -34,14 +34,14 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -105,19 +105,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/billing_request_templates})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/billing_request_templates}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/billing_request_templates})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/billing_request_templates}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -149,12 +149,12 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -182,12 +182,12 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -224,19 +224,19 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/billing_request_templates\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/billing_request_templates\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'billing_request_templates' => [{
@@ -257,12 +257,12 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -295,18 +295,18 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/billing_request_templates\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/billing_request_templates\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -331,12 +331,12 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -357,9 +357,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/billing_request_templates/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'billing_request_templates' => {
@@ -380,8 +380,8 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -389,7 +389,7 @@
subject(:get_response) do
client.billing_request_templates.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -423,8 +423,8 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -463,8 +463,8 @@
it 'retries timeouts' do
stub_url = '/billing_request_templates/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -473,11 +473,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/billing_request_templates/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -492,20 +492,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -536,13 +536,13 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/billing_request_templates})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/billing_request_templates}).
+ with(
body: {
'billing_request_templates' => {
@@ -563,11 +563,11 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'billing_request_templates' =>
@@ -590,8 +590,8 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
@@ -606,19 +606,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/billing_request_templates})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/billing_request_templates}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/billing_request_templates})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/billing_request_templates}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -636,9 +636,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -673,7 +673,7 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}
end
@@ -688,11 +688,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -701,8 +701,8 @@
let!(:get_stub) do
stub_url = "/billing_request_templates/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'billing_request_templates' => {
@@ -723,8 +723,8 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -747,8 +747,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -784,8 +784,8 @@
'payment_request_metadata' => 'payment_request_metadata-input',
'payment_request_scheme' => 'payment_request_scheme-input',
'redirect_uri' => 'redirect_uri-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -801,8 +801,8 @@
it 'retries timeouts' do
stub_url = '/billing_request_templates/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -810,11 +810,11 @@
it 'retries 5XX errors' do
stub_url = '/billing_request_templates/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
diff --git a/spec/services/billing_request_with_actions_service_spec.rb b/spec/services/billing_request_with_actions_service_spec.rb
index ab6e486d..5ad359ff 100644
--- a/spec/services/billing_request_with_actions_service_spec.rb
+++ b/spec/services/billing_request_with_actions_service_spec.rb
@@ -16,30 +16,30 @@
{
'bank_authorisations' => 'bank_authorisations-input',
- 'billing_requests' => 'billing_requests-input'
+ 'billing_requests' => 'billing_requests-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/billing_requests/create_with_actions})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/billing_requests/create_with_actions}).
+ with(
body: {
'billing_request_with_actions' => {
'bank_authorisations' => 'bank_authorisations-input',
- 'billing_requests' => 'billing_requests-input'
- }
+ 'billing_requests' => 'billing_requests-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'billing_request_with_actions' =>
{
'bank_authorisations' => 'bank_authorisations-input',
- 'billing_requests' => 'billing_requests-input'
- }
+ 'billing_requests' => 'billing_requests-input',
+ },
}.to_json,
headers: response_headers
@@ -54,19 +54,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/billing_requests/create_with_actions})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/billing_requests/create_with_actions}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/billing_requests/create_with_actions})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/billing_requests/create_with_actions}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -84,9 +84,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -105,7 +105,7 @@
{
'bank_authorisations' => 'bank_authorisations-input',
- 'billing_requests' => 'billing_requests-input'
+ 'billing_requests' => 'billing_requests-input',
}
end
@@ -120,11 +120,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
diff --git a/spec/services/billing_requests_service_spec.rb b/spec/services/billing_requests_service_spec.rb
index 9619ea36..0c2236e8 100644
--- a/spec/services/billing_requests_service_spec.rb
+++ b/spec/services/billing_requests_service_spec.rb
@@ -28,13 +28,13 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/billing_requests})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/billing_requests}).
+ with(
body: {
'billing_requests' => {
@@ -51,11 +51,11 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'billing_requests' =>
@@ -74,8 +74,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -90,19 +90,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/billing_requests})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/billing_requests}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/billing_requests})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/billing_requests}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -120,9 +120,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -153,7 +153,7 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}
end
@@ -168,11 +168,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -181,8 +181,8 @@
let!(:get_stub) do
stub_url = "/billing_requests/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'billing_requests' => {
@@ -199,8 +199,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -223,8 +223,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -255,8 +255,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -272,8 +272,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/billing_requests/:identity/actions/collect_customer_details'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -290,8 +290,8 @@
let!(:stub) do
# /billing_requests/%v/actions/collect_customer_details
stub_url = '/billing_requests/:identity/actions/collect_customer_details'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -311,8 +311,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -345,8 +345,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -362,8 +362,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/billing_requests/:identity/actions/collect_bank_account'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -380,8 +380,8 @@
let!(:stub) do
# /billing_requests/%v/actions/collect_bank_account
stub_url = '/billing_requests/:identity/actions/collect_bank_account'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -401,8 +401,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -435,8 +435,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -452,8 +452,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/billing_requests/:identity/actions/confirm_payer_details'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -470,8 +470,8 @@
let!(:stub) do
# /billing_requests/%v/actions/confirm_payer_details
stub_url = '/billing_requests/:identity/actions/confirm_payer_details'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -491,8 +491,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -525,8 +525,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -542,8 +542,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/billing_requests/:identity/actions/fulfil'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -560,8 +560,8 @@
let!(:stub) do
# /billing_requests/%v/actions/fulfil
stub_url = '/billing_requests/:identity/actions/fulfil'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -581,8 +581,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -615,8 +615,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -632,8 +632,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/billing_requests/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -650,8 +650,8 @@
let!(:stub) do
# /billing_requests/%v/actions/cancel
stub_url = '/billing_requests/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -671,8 +671,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -701,14 +701,14 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -762,19 +762,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/billing_requests})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/billing_requests}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/billing_requests})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/billing_requests}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -802,12 +802,12 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -831,12 +831,12 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -869,19 +869,19 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/billing_requests\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/billing_requests\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'billing_requests' => [{
@@ -898,12 +898,12 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -932,18 +932,18 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/billing_requests\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/billing_requests\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -964,12 +964,12 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
+ 'subscription_request' => 'subscription_request-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -990,9 +990,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/billing_requests/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'billing_requests' => {
@@ -1009,8 +1009,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -1018,7 +1018,7 @@
subject(:get_response) do
client.billing_requests.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -1048,8 +1048,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -1088,8 +1088,8 @@
it 'retries timeouts' do
stub_url = '/billing_requests/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -1098,11 +1098,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/billing_requests/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -1117,20 +1117,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -1163,8 +1163,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -1180,8 +1180,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/billing_requests/:identity/actions/notify'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -1198,8 +1198,8 @@
let!(:stub) do
# /billing_requests/%v/actions/notify
stub_url = '/billing_requests/:identity/actions/notify'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -1219,8 +1219,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -1253,8 +1253,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -1270,8 +1270,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/billing_requests/:identity/actions/fallback'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -1288,8 +1288,8 @@
let!(:stub) do
# /billing_requests/%v/actions/fallback
stub_url = '/billing_requests/:identity/actions/fallback'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -1309,8 +1309,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -1343,8 +1343,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -1360,8 +1360,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/billing_requests/:identity/actions/choose_currency'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -1378,8 +1378,8 @@
let!(:stub) do
# /billing_requests/%v/actions/choose_currency
stub_url = '/billing_requests/:identity/actions/choose_currency'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -1399,8 +1399,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
@@ -1433,8 +1433,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
@@ -1450,8 +1450,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/billing_requests/:identity/actions/select_institution'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -1468,8 +1468,8 @@
let!(:stub) do
# /billing_requests/%v/actions/select_institution
stub_url = '/billing_requests/:identity/actions/select_institution'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -1489,8 +1489,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- 'subscription_request' => 'subscription_request-input'
- }
+ 'subscription_request' => 'subscription_request-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/blocks_service_spec.rb b/spec/services/blocks_service_spec.rb
index 698858ab..422e0280 100644
--- a/spec/services/blocks_service_spec.rb
+++ b/spec/services/blocks_service_spec.rb
@@ -22,13 +22,13 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/blocks})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/blocks}).
+ with(
body: {
'blocks' => {
@@ -39,11 +39,11 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'blocks' =>
@@ -56,8 +56,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
@@ -72,19 +72,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/blocks})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/blocks}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/blocks})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/blocks}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -102,9 +102,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -129,7 +129,7 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}
end
@@ -144,11 +144,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -157,8 +157,8 @@
let!(:get_stub) do
stub_url = "/blocks/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'blocks' => {
@@ -169,8 +169,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -193,8 +193,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -208,9 +208,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/blocks/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'blocks' => {
@@ -221,8 +221,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -230,7 +230,7 @@
subject(:get_response) do
client.blocks.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -254,8 +254,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -294,8 +294,8 @@
it 'retries timeouts' do
stub_url = '/blocks/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -304,11 +304,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/blocks/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -323,20 +323,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -359,14 +359,14 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -408,19 +408,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/blocks})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/blocks}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/blocks})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/blocks}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -442,12 +442,12 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -465,12 +465,12 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -497,19 +497,19 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/blocks\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/blocks\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'blocks' => [{
@@ -520,12 +520,12 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -548,18 +548,18 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/blocks\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/blocks\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -574,12 +574,12 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -611,8 +611,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
@@ -628,8 +628,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/blocks/:identity/actions/disable'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -646,8 +646,8 @@
let!(:stub) do
# /blocks/%v/actions/disable
stub_url = '/blocks/:identity/actions/disable'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -661,8 +661,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -689,8 +689,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
@@ -706,8 +706,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/blocks/:identity/actions/enable'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -724,8 +724,8 @@
let!(:stub) do
# /blocks/%v/actions/enable
stub_url = '/blocks/:identity/actions/enable'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -739,8 +739,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -767,14 +767,14 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
+ 'updated_at' => 'updated_at-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
@@ -795,8 +795,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/blocks/block_by_ref'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -811,8 +811,8 @@
let!(:stub) do
# /blocks/block_by_ref
stub_url = '/blocks/block_by_ref'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -826,8 +826,8 @@
'reason_description' => 'reason_description-input',
'reason_type' => 'reason_type-input',
'resource_reference' => 'resource_reference-input',
- 'updated_at' => 'updated_at-input'
- }
+ 'updated_at' => 'updated_at-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/creditor_bank_accounts_service_spec.rb b/spec/services/creditor_bank_accounts_service_spec.rb
index dc2eae61..dcb788a8 100644
--- a/spec/services/creditor_bank_accounts_service_spec.rb
+++ b/spec/services/creditor_bank_accounts_service_spec.rb
@@ -26,13 +26,13 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/creditor_bank_accounts})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/creditor_bank_accounts}).
+ with(
body: {
'creditor_bank_accounts' => {
@@ -47,11 +47,11 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'creditor_bank_accounts' =>
@@ -68,8 +68,8 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
@@ -84,19 +84,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/creditor_bank_accounts})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/creditor_bank_accounts}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/creditor_bank_accounts})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/creditor_bank_accounts}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -114,9 +114,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -145,7 +145,7 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}
end
@@ -160,11 +160,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -173,8 +173,8 @@
let!(:get_stub) do
stub_url = "/creditor_bank_accounts/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'creditor_bank_accounts' => {
@@ -189,8 +189,8 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -213,8 +213,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -239,14 +239,14 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -296,19 +296,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/creditor_bank_accounts})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/creditor_bank_accounts}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/creditor_bank_accounts})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/creditor_bank_accounts}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -334,12 +334,12 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -361,12 +361,12 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -397,19 +397,19 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/creditor_bank_accounts\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/creditor_bank_accounts\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'creditor_bank_accounts' => [{
@@ -424,12 +424,12 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -456,18 +456,18 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/creditor_bank_accounts\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/creditor_bank_accounts\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -486,12 +486,12 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -512,9 +512,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/creditor_bank_accounts/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'creditor_bank_accounts' => {
@@ -529,8 +529,8 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -538,7 +538,7 @@
subject(:get_response) do
client.creditor_bank_accounts.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -566,8 +566,8 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -606,8 +606,8 @@
it 'retries timeouts' do
stub_url = '/creditor_bank_accounts/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -616,11 +616,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/creditor_bank_accounts/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -635,20 +635,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -679,8 +679,8 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
@@ -696,8 +696,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/creditor_bank_accounts/:identity/actions/disable'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -714,8 +714,8 @@
let!(:stub) do
# /creditor_bank_accounts/%v/actions/disable
stub_url = '/creditor_bank_accounts/:identity/actions/disable'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -733,8 +733,8 @@
'id' => 'id-input',
'links' => 'links-input',
'metadata' => 'metadata-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/creditors_service_spec.rb b/spec/services/creditors_service_spec.rb
index 53e7f4d7..7a857a2c 100644
--- a/spec/services/creditors_service_spec.rb
+++ b/spec/services/creditors_service_spec.rb
@@ -35,13 +35,13 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/creditors})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/creditors}).
+ with(
body: {
'creditors' => {
@@ -65,11 +65,11 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'creditors' =>
@@ -95,8 +95,8 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
@@ -111,19 +111,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/creditors})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/creditors}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/creditors})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/creditors}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -141,9 +141,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -181,7 +181,7 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}
end
@@ -196,11 +196,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -209,8 +209,8 @@
let!(:get_stub) do
stub_url = "/creditors/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'creditors' => {
@@ -234,8 +234,8 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -258,8 +258,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -293,14 +293,14 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -366,19 +366,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/creditors})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/creditors}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/creditors})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/creditors}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -413,12 +413,12 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -449,12 +449,12 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -494,19 +494,19 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/creditors\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/creditors\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'creditors' => [{
@@ -530,12 +530,12 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -571,18 +571,18 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/creditors\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/creditors\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -610,12 +610,12 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
+ 'verification_status' => 'verification_status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -636,9 +636,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/creditors/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'creditors' => {
@@ -662,8 +662,8 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -671,7 +671,7 @@
subject(:get_response) do
client.creditors.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -708,8 +708,8 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -748,8 +748,8 @@
it 'retries timeouts' do
stub_url = '/creditors/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -758,11 +758,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/creditors/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -777,20 +777,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -831,8 +831,8 @@
'postal_code' => 'postal_code-input',
'region' => 'region-input',
'scheme_identifiers' => 'scheme_identifiers-input',
- 'verification_status' => 'verification_status-input'
- }
+ 'verification_status' => 'verification_status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -848,8 +848,8 @@
it 'retries timeouts' do
stub_url = '/creditors/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -857,11 +857,11 @@
it 'retries 5XX errors' do
stub_url = '/creditors/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
diff --git a/spec/services/currency_exchange_rates_service_spec.rb b/spec/services/currency_exchange_rates_service_spec.rb
index 7544f15d..5b7c2108 100644
--- a/spec/services/currency_exchange_rates_service_spec.rb
+++ b/spec/services/currency_exchange_rates_service_spec.rb
@@ -20,14 +20,14 @@
'rate' => 'rate-input',
'source' => 'source-input',
'target' => 'target-input',
- 'time' => 'time-input'
+ 'time' => 'time-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -63,19 +63,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/currency_exchange_rates})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/currency_exchange_rates}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/currency_exchange_rates})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/currency_exchange_rates}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -93,12 +93,12 @@
'rate' => 'rate-input',
'source' => 'source-input',
'target' => 'target-input',
- 'time' => 'time-input'
+ 'time' => 'time-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -112,12 +112,12 @@
'rate' => 'rate-input',
'source' => 'source-input',
'target' => 'target-input',
- 'time' => 'time-input'
+ 'time' => 'time-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -140,31 +140,31 @@
'rate' => 'rate-input',
'source' => 'source-input',
'target' => 'target-input',
- 'time' => 'time-input'
+ 'time' => 'time-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/currency_exchange_rates\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/currency_exchange_rates\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'currency_exchange_rates' => [{
'rate' => 'rate-input',
'source' => 'source-input',
'target' => 'target-input',
- 'time' => 'time-input'
+ 'time' => 'time-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -183,18 +183,18 @@
'rate' => 'rate-input',
'source' => 'source-input',
'target' => 'target-input',
- 'time' => 'time-input'
+ 'time' => 'time-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/currency_exchange_rates\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/currency_exchange_rates\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -205,12 +205,12 @@
'rate' => 'rate-input',
'source' => 'source-input',
'target' => 'target-input',
- 'time' => 'time-input'
+ 'time' => 'time-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/customer_bank_accounts_service_spec.rb b/spec/services/customer_bank_accounts_service_spec.rb
index 63b403e4..47599ee6 100644
--- a/spec/services/customer_bank_accounts_service_spec.rb
+++ b/spec/services/customer_bank_accounts_service_spec.rb
@@ -26,13 +26,13 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/customer_bank_accounts})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/customer_bank_accounts}).
+ with(
body: {
'customer_bank_accounts' => {
@@ -47,11 +47,11 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'customer_bank_accounts' =>
@@ -68,8 +68,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
@@ -84,19 +84,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/customer_bank_accounts})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/customer_bank_accounts}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/customer_bank_accounts})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/customer_bank_accounts}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -114,9 +114,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -145,7 +145,7 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}
end
@@ -160,11 +160,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -173,8 +173,8 @@
let!(:get_stub) do
stub_url = "/customer_bank_accounts/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'customer_bank_accounts' => {
@@ -189,8 +189,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
)
@@ -213,8 +213,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -239,14 +239,14 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -296,19 +296,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/customer_bank_accounts})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/customer_bank_accounts}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/customer_bank_accounts})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/customer_bank_accounts}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -334,12 +334,12 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -361,12 +361,12 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -397,19 +397,19 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/customer_bank_accounts\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/customer_bank_accounts\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'customer_bank_accounts' => [{
@@ -424,12 +424,12 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -456,18 +456,18 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/customer_bank_accounts\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/customer_bank_accounts\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -486,12 +486,12 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
+ 'metadata' => 'metadata-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -512,9 +512,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/customer_bank_accounts/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'customer_bank_accounts' => {
@@ -529,8 +529,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
)
@@ -538,7 +538,7 @@
subject(:get_response) do
client.customer_bank_accounts.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -566,8 +566,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
)
@@ -606,8 +606,8 @@
it 'retries timeouts' do
stub_url = '/customer_bank_accounts/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -616,11 +616,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/customer_bank_accounts/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -635,20 +635,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -680,8 +680,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
)
@@ -697,8 +697,8 @@
it 'retries timeouts' do
stub_url = '/customer_bank_accounts/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -706,11 +706,11 @@
it 'retries 5XX errors' do
stub_url = '/customer_bank_accounts/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -742,8 +742,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
@@ -759,8 +759,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/customer_bank_accounts/:identity/actions/disable'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -777,8 +777,8 @@
let!(:stub) do
# /customer_bank_accounts/%v/actions/disable
stub_url = '/customer_bank_accounts/:identity/actions/disable'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -796,8 +796,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input'
- }
+ 'metadata' => 'metadata-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/customer_notifications_service_spec.rb b/spec/services/customer_notifications_service_spec.rb
index f4c17144..afc461d2 100644
--- a/spec/services/customer_notifications_service_spec.rb
+++ b/spec/services/customer_notifications_service_spec.rb
@@ -26,8 +26,8 @@
'action_taken_by' => 'action_taken_by-input',
'id' => 'id-input',
'links' => 'links-input',
- 'type' => 'type-input'
- }
+ 'type' => 'type-input',
+ },
}.to_json,
headers: response_headers
@@ -43,8 +43,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/customer_notifications/:identity/actions/handle'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -61,8 +61,8 @@
let!(:stub) do
# /customer_notifications/%v/actions/handle
stub_url = '/customer_notifications/:identity/actions/handle'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -74,8 +74,8 @@
'action_taken_by' => 'action_taken_by-input',
'id' => 'id-input',
'links' => 'links-input',
- 'type' => 'type-input'
- }
+ 'type' => 'type-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/customers_service_spec.rb b/spec/services/customers_service_spec.rb
index 96ead4f0..ab8f41f4 100644
--- a/spec/services/customers_service_spec.rb
+++ b/spec/services/customers_service_spec.rb
@@ -32,13 +32,13 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/customers})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/customers}).
+ with(
body: {
'customers' => {
@@ -59,11 +59,11 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'customers' =>
@@ -86,8 +86,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
@@ -102,19 +102,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/customers})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/customers}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/customers})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/customers}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -132,9 +132,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -169,7 +169,7 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}
end
@@ -184,11 +184,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -197,8 +197,8 @@
let!(:get_stub) do
stub_url = "/customers/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'customers' => {
@@ -219,8 +219,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
)
@@ -243,8 +243,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -275,14 +275,14 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -344,19 +344,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/customers})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/customers}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/customers})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/customers}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -388,12 +388,12 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -421,12 +421,12 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -463,19 +463,19 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/customers\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/customers\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'customers' => [{
@@ -496,12 +496,12 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -534,18 +534,18 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/customers\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/customers\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -570,12 +570,12 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
+ 'swedish_identity_number' => 'swedish_identity_number-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -596,9 +596,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/customers/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'customers' => {
@@ -619,8 +619,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
)
@@ -628,7 +628,7 @@
subject(:get_response) do
client.customers.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -662,8 +662,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
)
@@ -702,8 +702,8 @@
it 'retries timeouts' do
stub_url = '/customers/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -712,11 +712,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/customers/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -731,20 +731,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -782,8 +782,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
)
@@ -799,8 +799,8 @@
it 'retries timeouts' do
stub_url = '/customers/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -808,11 +808,11 @@
it 'retries 5XX errors' do
stub_url = '/customers/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -850,8 +850,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
@@ -867,8 +867,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/customers/:identity'.gsub(':identity', resource_id)
- stub = stub_request(:delete, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:delete, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { delete_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -885,8 +885,8 @@
let!(:stub) do
# /customers/%v
stub_url = '/customers/:identity'.gsub(':identity', resource_id)
- stub_request(:delete, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:delete, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -910,8 +910,8 @@
'phone_number' => 'phone_number-input',
'postal_code' => 'postal_code-input',
'region' => 'region-input',
- 'swedish_identity_number' => 'swedish_identity_number-input'
- }
+ 'swedish_identity_number' => 'swedish_identity_number-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/events_service_spec.rb b/spec/services/events_service_spec.rb
index 6926d919..db1beb37 100644
--- a/spec/services/events_service_spec.rb
+++ b/spec/services/events_service_spec.rb
@@ -26,14 +26,14 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
+ 'source' => 'source-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -77,19 +77,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/events})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/events}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/events})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/events}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -113,12 +113,12 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
+ 'source' => 'source-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -138,12 +138,12 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
+ 'source' => 'source-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -172,19 +172,19 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
+ 'source' => 'source-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/events\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/events\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'events' => [{
@@ -197,12 +197,12 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
+ 'source' => 'source-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -227,18 +227,18 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
+ 'source' => 'source-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/events\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/events\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -255,12 +255,12 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
+ 'source' => 'source-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -281,9 +281,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/events/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'events' => {
@@ -296,8 +296,8 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
- }
+ 'source' => 'source-input',
+ },
}.to_json,
headers: response_headers
)
@@ -305,7 +305,7 @@
subject(:get_response) do
client.events.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -331,8 +331,8 @@
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
'resource_type' => 'resource_type-input',
- 'source' => 'source-input'
- }
+ 'source' => 'source-input',
+ },
}.to_json,
headers: response_headers
)
@@ -371,8 +371,8 @@
it 'retries timeouts' do
stub_url = '/events/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -381,11 +381,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/events/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -400,20 +400,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
diff --git a/spec/services/exports_service_spec.rb b/spec/services/exports_service_spec.rb
index 239b8a62..081b4aa4 100644
--- a/spec/services/exports_service_spec.rb
+++ b/spec/services/exports_service_spec.rb
@@ -17,9 +17,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/exports/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'exports' => {
@@ -27,8 +27,8 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}.to_json,
headers: response_headers
)
@@ -36,7 +36,7 @@
subject(:get_response) do
client.exports.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -57,8 +57,8 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}.to_json,
headers: response_headers
)
@@ -97,8 +97,8 @@
it 'retries timeouts' do
stub_url = '/exports/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -107,11 +107,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/exports/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -126,20 +126,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -159,14 +159,14 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
+ 'id' => 'id-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -202,19 +202,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/exports})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/exports}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/exports})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/exports}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -233,12 +233,12 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
+ 'id' => 'id-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -253,12 +253,12 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
+ 'id' => 'id-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -282,19 +282,19 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
+ 'id' => 'id-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/exports\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/exports\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'exports' => [{
@@ -302,12 +302,12 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
+ 'id' => 'id-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -327,18 +327,18 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
+ 'id' => 'id-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/exports\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/exports\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -350,12 +350,12 @@
'currency' => 'currency-input',
'download_url' => 'download_url-input',
'export_type' => 'export_type-input',
- 'id' => 'id-input'
+ 'id' => 'id-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/instalment_schedules_service_spec.rb b/spec/services/instalment_schedules_service_spec.rb
index e7398b05..12c42d1d 100644
--- a/spec/services/instalment_schedules_service_spec.rb
+++ b/spec/services/instalment_schedules_service_spec.rb
@@ -23,13 +23,13 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/instalment_schedules})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).
+ with(
body: {
'instalment_schedules' => {
@@ -41,11 +41,11 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'instalment_schedules' =>
@@ -59,8 +59,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
@@ -75,19 +75,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/instalment_schedules})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/instalment_schedules})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -105,9 +105,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -133,7 +133,7 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}
end
@@ -148,11 +148,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -161,8 +161,8 @@
let!(:get_stub) do
stub_url = "/instalment_schedules/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'instalment_schedules' => {
@@ -174,8 +174,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
)
@@ -198,8 +198,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -219,13 +219,13 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/instalment_schedules})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).
+ with(
body: {
'instalment_schedules' => {
@@ -237,11 +237,11 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'instalment_schedules' =>
@@ -255,8 +255,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
@@ -271,19 +271,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/instalment_schedules})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/instalment_schedules})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/instalment_schedules}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -301,9 +301,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -329,7 +329,7 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}
end
@@ -344,11 +344,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -357,8 +357,8 @@
let!(:get_stub) do
stub_url = "/instalment_schedules/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'instalment_schedules' => {
@@ -370,8 +370,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
)
@@ -394,8 +394,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -417,14 +417,14 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -468,19 +468,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -503,12 +503,12 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -527,12 +527,12 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -560,19 +560,19 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'instalment_schedules' => [{
@@ -584,12 +584,12 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -613,18 +613,18 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/instalment_schedules\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -640,12 +640,12 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
+ 'total_amount' => 'total_amount-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -666,9 +666,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/instalment_schedules/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'instalment_schedules' => {
@@ -680,8 +680,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
)
@@ -689,7 +689,7 @@
subject(:get_response) do
client.instalment_schedules.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -714,8 +714,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
)
@@ -754,8 +754,8 @@
it 'retries timeouts' do
stub_url = '/instalment_schedules/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -764,11 +764,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/instalment_schedules/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -783,20 +783,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -825,8 +825,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
)
@@ -842,8 +842,8 @@
it 'retries timeouts' do
stub_url = '/instalment_schedules/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -851,11 +851,11 @@
it 'retries 5XX errors' do
stub_url = '/instalment_schedules/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -884,8 +884,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
@@ -901,8 +901,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/instalment_schedules/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -919,8 +919,8 @@
let!(:stub) do
# /instalment_schedules/%v/actions/cancel
stub_url = '/instalment_schedules/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -935,8 +935,8 @@
'name' => 'name-input',
'payment_errors' => 'payment_errors-input',
'status' => 'status-input',
- 'total_amount' => 'total_amount-input'
- }
+ 'total_amount' => 'total_amount-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/institutions_service_spec.rb b/spec/services/institutions_service_spec.rb
index 59365ee7..a2ce6840 100644
--- a/spec/services/institutions_service_spec.rb
+++ b/spec/services/institutions_service_spec.rb
@@ -24,14 +24,14 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -73,19 +73,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/institutions})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/institutions}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/institutions})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/institutions}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -107,12 +107,12 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -130,12 +130,12 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -162,19 +162,19 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/institutions\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/institutions\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'institutions' => [{
@@ -185,12 +185,12 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -213,18 +213,18 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/institutions\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/institutions\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -239,12 +239,12 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -276,14 +276,14 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json,
headers: response_headers
@@ -304,8 +304,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/billing_requests/:identity/institutions'.gsub(':identity', resource_id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { get_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -322,8 +322,8 @@
let!(:stub) do
# /billing_requests/%v/institutions
stub_url = '/billing_requests/:identity/institutions'.gsub(':identity', resource_id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -337,8 +337,8 @@
'limits' => 'limits-input',
'logo_url' => 'logo_url-input',
'name' => 'name-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/logos_service_spec.rb b/spec/services/logos_service_spec.rb
index 895ba01d..e8dcded6 100644
--- a/spec/services/logos_service_spec.rb
+++ b/spec/services/logos_service_spec.rb
@@ -15,28 +15,28 @@
let(:new_resource) do
{
- 'id' => 'id-input'
+ 'id' => 'id-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/branding/logos})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/branding/logos}).
+ with(
body: {
'logos' => {
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'logos' =>
{
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}.to_json,
headers: response_headers
@@ -51,19 +51,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/branding/logos})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/branding/logos}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/branding/logos})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/branding/logos}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -81,9 +81,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -101,7 +101,7 @@
let(:new_resource) do
{
- 'id' => 'id-input'
+ 'id' => 'id-input',
}
end
@@ -116,11 +116,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
diff --git a/spec/services/mandate_import_entries_service_spec.rb b/spec/services/mandate_import_entries_service_spec.rb
index c54fc8cd..874af5d4 100644
--- a/spec/services/mandate_import_entries_service_spec.rb
+++ b/spec/services/mandate_import_entries_service_spec.rb
@@ -18,24 +18,24 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/mandate_import_entries})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/mandate_import_entries}).
+ with(
body: {
'mandate_import_entries' => {
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
- }
+ 'record_identifier' => 'record_identifier-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'mandate_import_entries' =>
@@ -44,8 +44,8 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
- }
+ 'record_identifier' => 'record_identifier-input',
+ },
}.to_json,
headers: response_headers
@@ -60,19 +60,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/mandate_import_entries})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/mandate_import_entries}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/mandate_import_entries})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/mandate_import_entries}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -90,9 +90,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -113,7 +113,7 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}
end
@@ -128,11 +128,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -157,14 +157,14 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -198,19 +198,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/mandate_import_entries})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/mandate_import_entries}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/mandate_import_entries})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/mandate_import_entries}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -228,12 +228,12 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -247,12 +247,12 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -275,31 +275,31 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/mandate_import_entries\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/mandate_import_entries\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'mandate_import_entries' => [{
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -318,18 +318,18 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/mandate_import_entries\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/mandate_import_entries\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -340,12 +340,12 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
'processing_errors' => 'processing_errors-input',
- 'record_identifier' => 'record_identifier-input'
+ 'record_identifier' => 'record_identifier-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/mandate_imports_service_spec.rb b/spec/services/mandate_imports_service_spec.rb
index 6d40a1a9..f8aff6e3 100644
--- a/spec/services/mandate_imports_service_spec.rb
+++ b/spec/services/mandate_imports_service_spec.rb
@@ -19,13 +19,13 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/mandate_imports})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/mandate_imports}).
+ with(
body: {
'mandate_imports' => {
@@ -33,11 +33,11 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'mandate_imports' =>
@@ -47,8 +47,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -63,19 +63,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/mandate_imports})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/mandate_imports}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/mandate_imports})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/mandate_imports}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -93,9 +93,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -117,7 +117,7 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
@@ -132,11 +132,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -145,8 +145,8 @@
let!(:get_stub) do
stub_url = "/mandate_imports/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'mandate_imports' => {
@@ -154,8 +154,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -178,8 +178,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -193,9 +193,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/mandate_imports/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'mandate_imports' => {
@@ -203,8 +203,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -212,7 +212,7 @@
subject(:get_response) do
client.mandate_imports.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -233,8 +233,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -273,8 +273,8 @@
it 'retries timeouts' do
stub_url = '/mandate_imports/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -283,11 +283,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/mandate_imports/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -302,20 +302,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -339,8 +339,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -356,8 +356,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/mandate_imports/:identity/actions/submit'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -374,8 +374,8 @@
let!(:stub) do
# /mandate_imports/%v/actions/submit
stub_url = '/mandate_imports/:identity/actions/submit'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -386,8 +386,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -411,8 +411,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -428,8 +428,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/mandate_imports/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -446,8 +446,8 @@
let!(:stub) do
# /mandate_imports/%v/actions/cancel
stub_url = '/mandate_imports/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -458,8 +458,8 @@
'id' => 'id-input',
'links' => 'links-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/mandate_pdfs_service_spec.rb b/spec/services/mandate_pdfs_service_spec.rb
index 87c738d0..0a908e9c 100644
--- a/spec/services/mandate_pdfs_service_spec.rb
+++ b/spec/services/mandate_pdfs_service_spec.rb
@@ -16,30 +16,30 @@
{
'expires_at' => 'expires_at-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/mandate_pdfs})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/mandate_pdfs}).
+ with(
body: {
'mandate_pdfs' => {
'expires_at' => 'expires_at-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'mandate_pdfs' =>
{
'expires_at' => 'expires_at-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
@@ -54,19 +54,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/mandate_pdfs})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/mandate_pdfs}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/mandate_pdfs})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/mandate_pdfs}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -84,9 +84,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -105,7 +105,7 @@
{
'expires_at' => 'expires_at-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}
end
@@ -120,11 +120,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
diff --git a/spec/services/mandates_service_spec.rb b/spec/services/mandates_service_spec.rb
index 84a2ea56..5120f1ab 100644
--- a/spec/services/mandates_service_spec.rb
+++ b/spec/services/mandates_service_spec.rb
@@ -29,13 +29,13 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/mandates})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/mandates}).
+ with(
body: {
'mandates' => {
@@ -53,11 +53,11 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'mandates' =>
@@ -77,8 +77,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
@@ -93,19 +93,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/mandates})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/mandates}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/mandates})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/mandates}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -123,9 +123,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -157,7 +157,7 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}
end
@@ -172,11 +172,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -185,8 +185,8 @@
let!(:get_stub) do
stub_url = "/mandates/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'mandates' => {
@@ -204,8 +204,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -228,8 +228,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -257,14 +257,14 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -318,19 +318,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/mandates})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/mandates}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/mandates})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/mandates}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -359,12 +359,12 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -389,12 +389,12 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -428,19 +428,19 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/mandates\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/mandates\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'mandates' => [{
@@ -458,12 +458,12 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -493,18 +493,18 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/mandates\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/mandates\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -526,12 +526,12 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
+ 'verified_at' => 'verified_at-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -552,9 +552,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/mandates/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'mandates' => {
@@ -572,8 +572,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -581,7 +581,7 @@
subject(:get_response) do
client.mandates.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -612,8 +612,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -652,8 +652,8 @@
it 'retries timeouts' do
stub_url = '/mandates/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -662,11 +662,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/mandates/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -681,20 +681,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -729,8 +729,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -746,8 +746,8 @@
it 'retries timeouts' do
stub_url = '/mandates/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -755,11 +755,11 @@
it 'retries 5XX errors' do
stub_url = '/mandates/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -794,8 +794,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
@@ -811,8 +811,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/mandates/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -829,8 +829,8 @@
let!(:stub) do
# /mandates/%v/actions/cancel
stub_url = '/mandates/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -851,8 +851,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
)
@@ -886,8 +886,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
@@ -903,8 +903,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/mandates/:identity/actions/reinstate'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -921,8 +921,8 @@
let!(:stub) do
# /mandates/%v/actions/reinstate
stub_url = '/mandates/:identity/actions/reinstate'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -943,8 +943,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input'
- }
+ 'verified_at' => 'verified_at-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/negative_balance_limits_service_spec.rb b/spec/services/negative_balance_limits_service_spec.rb
index bb53bb82..bc13c41d 100644
--- a/spec/services/negative_balance_limits_service_spec.rb
+++ b/spec/services/negative_balance_limits_service_spec.rb
@@ -21,14 +21,14 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -64,19 +64,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/negative_balance_limits})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/negative_balance_limits}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/negative_balance_limits})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/negative_balance_limits}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -95,12 +95,12 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -115,12 +115,12 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -144,19 +144,19 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/negative_balance_limits\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/negative_balance_limits\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'negative_balance_limits' => [{
@@ -164,12 +164,12 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -189,18 +189,18 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/negative_balance_limits\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/negative_balance_limits\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -212,12 +212,12 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input'
+ 'links' => 'links-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/outbound_payments_service_spec.rb b/spec/services/outbound_payments_service_spec.rb
index bc47b953..d5af3ba5 100644
--- a/spec/services/outbound_payments_service_spec.rb
+++ b/spec/services/outbound_payments_service_spec.rb
@@ -27,13 +27,13 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/outbound_payments})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/outbound_payments}).
+ with(
body: {
'outbound_payments' => {
@@ -49,11 +49,11 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'outbound_payments' =>
@@ -71,8 +71,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
@@ -87,19 +87,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/outbound_payments})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/outbound_payments}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/outbound_payments})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/outbound_payments}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -117,9 +117,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -149,7 +149,7 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}
end
@@ -164,11 +164,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -177,8 +177,8 @@
let!(:get_stub) do
stub_url = "/outbound_payments/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'outbound_payments' => {
@@ -194,8 +194,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -218,8 +218,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -249,8 +249,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
@@ -266,8 +266,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/outbound_payments/withdrawal'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -282,8 +282,8 @@
let!(:stub) do
# /outbound_payments/withdrawal
stub_url = '/outbound_payments/withdrawal'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -302,8 +302,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -335,8 +335,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
@@ -352,8 +352,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/outbound_payments/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -370,8 +370,8 @@
let!(:stub) do
# /outbound_payments/%v/actions/cancel
stub_url = '/outbound_payments/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -390,8 +390,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -423,8 +423,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
@@ -440,8 +440,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/outbound_payments/:identity/actions/approve'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -458,8 +458,8 @@
let!(:stub) do
# /outbound_payments/%v/actions/approve
stub_url = '/outbound_payments/:identity/actions/approve'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -478,8 +478,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -495,9 +495,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/outbound_payments/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'outbound_payments' => {
@@ -513,8 +513,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -522,7 +522,7 @@
subject(:get_response) do
client.outbound_payments.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -551,8 +551,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -591,8 +591,8 @@
it 'retries timeouts' do
stub_url = '/outbound_payments/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -601,11 +601,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/outbound_payments/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -620,20 +620,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -661,14 +661,14 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -720,19 +720,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/outbound_payments})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/outbound_payments}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/outbound_payments})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/outbound_payments}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -759,12 +759,12 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -787,12 +787,12 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -824,19 +824,19 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/outbound_payments\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/outbound_payments\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'outbound_payments' => [{
@@ -852,12 +852,12 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -885,18 +885,18 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/outbound_payments\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/outbound_payments\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -916,12 +916,12 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
+ 'verifications' => 'verifications-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -959,8 +959,8 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verifications' => 'verifications-input'
- }
+ 'verifications' => 'verifications-input',
+ },
}.to_json,
headers: response_headers
)
@@ -976,8 +976,8 @@
it 'retries timeouts' do
stub_url = '/outbound_payments/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -985,11 +985,11 @@
it 'retries 5XX errors' do
stub_url = '/outbound_payments/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
diff --git a/spec/services/payer_authorisations_service_spec.rb b/spec/services/payer_authorisations_service_spec.rb
index ed21a90d..591b614d 100644
--- a/spec/services/payer_authorisations_service_spec.rb
+++ b/spec/services/payer_authorisations_service_spec.rb
@@ -17,9 +17,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/payer_authorisations/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'payer_authorisations' => {
@@ -30,8 +30,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -39,7 +39,7 @@
subject(:get_response) do
client.payer_authorisations.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -63,8 +63,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -103,8 +103,8 @@
it 'retries timeouts' do
stub_url = '/payer_authorisations/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -113,11 +113,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/payer_authorisations/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -132,20 +132,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -166,13 +166,13 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/payer_authorisations})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/payer_authorisations}).
+ with(
body: {
'payer_authorisations' => {
@@ -183,11 +183,11 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'payer_authorisations' =>
@@ -200,8 +200,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -216,19 +216,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/payer_authorisations})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/payer_authorisations}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/payer_authorisations})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/payer_authorisations}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -246,9 +246,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -273,7 +273,7 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
@@ -288,11 +288,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -301,8 +301,8 @@
let!(:get_stub) do
stub_url = "/payer_authorisations/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'payer_authorisations' => {
@@ -313,8 +313,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -337,8 +337,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -364,8 +364,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -381,8 +381,8 @@
it 'retries timeouts' do
stub_url = '/payer_authorisations/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -390,11 +390,11 @@
it 'retries 5XX errors' do
stub_url = '/payer_authorisations/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -422,8 +422,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -439,8 +439,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/payer_authorisations/:identity/actions/submit'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -457,8 +457,8 @@
let!(:stub) do
# /payer_authorisations/%v/actions/submit
stub_url = '/payer_authorisations/:identity/actions/submit'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -472,8 +472,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -500,8 +500,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -517,8 +517,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/payer_authorisations/:identity/actions/confirm'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -535,8 +535,8 @@
let!(:stub) do
# /payer_authorisations/%v/actions/confirm
stub_url = '/payer_authorisations/:identity/actions/confirm'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -550,8 +550,8 @@
'incomplete_fields' => 'incomplete_fields-input',
'links' => 'links-input',
'mandate' => 'mandate-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/payer_themes_service_spec.rb b/spec/services/payer_themes_service_spec.rb
index 45130052..905a8f24 100644
--- a/spec/services/payer_themes_service_spec.rb
+++ b/spec/services/payer_themes_service_spec.rb
@@ -15,28 +15,28 @@
let(:new_resource) do
{
- 'id' => 'id-input'
+ 'id' => 'id-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/branding/payer_themes})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/branding/payer_themes}).
+ with(
body: {
'payer_themes' => {
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'payer_themes' =>
{
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}.to_json,
headers: response_headers
@@ -51,19 +51,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/branding/payer_themes})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/branding/payer_themes}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/branding/payer_themes})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/branding/payer_themes}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -81,9 +81,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -101,7 +101,7 @@
let(:new_resource) do
{
- 'id' => 'id-input'
+ 'id' => 'id-input',
}
end
@@ -116,11 +116,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
diff --git a/spec/services/payments_service_spec.rb b/spec/services/payments_service_spec.rb
index 689852cd..58449365 100644
--- a/spec/services/payments_service_spec.rb
+++ b/spec/services/payments_service_spec.rb
@@ -29,13 +29,13 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/payments})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/payments}).
+ with(
body: {
'payments' => {
@@ -53,11 +53,11 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'payments' =>
@@ -77,8 +77,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -93,19 +93,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/payments})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/payments}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/payments})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/payments}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -123,9 +123,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -157,7 +157,7 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
@@ -172,11 +172,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -185,8 +185,8 @@
let!(:get_stub) do
stub_url = "/payments/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'payments' => {
@@ -204,8 +204,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -228,8 +228,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -257,14 +257,14 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -318,19 +318,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/payments})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/payments}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/payments})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/payments}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -359,12 +359,12 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -389,12 +389,12 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -428,19 +428,19 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payments\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payments\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'payments' => [{
@@ -458,12 +458,12 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -493,18 +493,18 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payments\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payments\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -526,12 +526,12 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -552,9 +552,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/payments/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'payments' => {
@@ -572,8 +572,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -581,7 +581,7 @@
subject(:get_response) do
client.payments.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -612,8 +612,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -652,8 +652,8 @@
it 'retries timeouts' do
stub_url = '/payments/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -662,11 +662,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/payments/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -681,20 +681,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -729,8 +729,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -746,8 +746,8 @@
it 'retries timeouts' do
stub_url = '/payments/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -755,11 +755,11 @@
it 'retries 5XX errors' do
stub_url = '/payments/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -794,8 +794,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -811,8 +811,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/payments/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -829,8 +829,8 @@
let!(:stub) do
# /payments/%v/actions/cancel
stub_url = '/payments/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -851,8 +851,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -886,8 +886,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -903,8 +903,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/payments/:identity/actions/retry'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -921,8 +921,8 @@
let!(:stub) do
# /payments/%v/actions/retry
stub_url = '/payments/:identity/actions/retry'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -943,8 +943,8 @@
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/payout_items_service_spec.rb b/spec/services/payout_items_service_spec.rb
index ef699c55..7101753d 100644
--- a/spec/services/payout_items_service_spec.rb
+++ b/spec/services/payout_items_service_spec.rb
@@ -20,14 +20,14 @@
'amount' => 'amount-input',
'links' => 'links-input',
'taxes' => 'taxes-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -59,19 +59,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/payout_items})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/payout_items}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/payout_items})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/payout_items}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -89,12 +89,12 @@
'amount' => 'amount-input',
'links' => 'links-input',
'taxes' => 'taxes-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -108,12 +108,12 @@
'amount' => 'amount-input',
'links' => 'links-input',
'taxes' => 'taxes-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -136,31 +136,31 @@
'amount' => 'amount-input',
'links' => 'links-input',
'taxes' => 'taxes-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payout_items\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payout_items\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'payout_items' => [{
'amount' => 'amount-input',
'links' => 'links-input',
'taxes' => 'taxes-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -179,18 +179,18 @@
'amount' => 'amount-input',
'links' => 'links-input',
'taxes' => 'taxes-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payout_items\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payout_items\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -201,12 +201,12 @@
'amount' => 'amount-input',
'links' => 'links-input',
'taxes' => 'taxes-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/payouts_service_spec.rb b/spec/services/payouts_service_spec.rb
index 66b69a0a..91730b29 100644
--- a/spec/services/payouts_service_spec.rb
+++ b/spec/services/payouts_service_spec.rb
@@ -29,14 +29,14 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
+ 'tax_currency' => 'tax_currency-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -86,19 +86,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/payouts})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/payouts}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/payouts})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/payouts}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -125,12 +125,12 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
+ 'tax_currency' => 'tax_currency-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -153,12 +153,12 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
+ 'tax_currency' => 'tax_currency-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -190,19 +190,19 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
+ 'tax_currency' => 'tax_currency-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payouts\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payouts\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'payouts' => [{
@@ -218,12 +218,12 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
+ 'tax_currency' => 'tax_currency-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -251,18 +251,18 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
+ 'tax_currency' => 'tax_currency-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payouts\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payouts\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -282,12 +282,12 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
+ 'tax_currency' => 'tax_currency-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -308,9 +308,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/payouts/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'payouts' => {
@@ -326,8 +326,8 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
- }
+ 'tax_currency' => 'tax_currency-input',
+ },
}.to_json,
headers: response_headers
)
@@ -335,7 +335,7 @@
subject(:get_response) do
client.payouts.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -364,8 +364,8 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
- }
+ 'tax_currency' => 'tax_currency-input',
+ },
}.to_json,
headers: response_headers
)
@@ -404,8 +404,8 @@
it 'retries timeouts' do
stub_url = '/payouts/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -414,11 +414,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/payouts/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -433,20 +433,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -479,8 +479,8 @@
'payout_type' => 'payout_type-input',
'reference' => 'reference-input',
'status' => 'status-input',
- 'tax_currency' => 'tax_currency-input'
- }
+ 'tax_currency' => 'tax_currency-input',
+ },
}.to_json,
headers: response_headers
)
@@ -496,8 +496,8 @@
it 'retries timeouts' do
stub_url = '/payouts/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -505,11 +505,11 @@
it 'retries 5XX errors' do
stub_url = '/payouts/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
diff --git a/spec/services/redirect_flows_service_spec.rb b/spec/services/redirect_flows_service_spec.rb
index b462068f..3ccf3d2e 100644
--- a/spec/services/redirect_flows_service_spec.rb
+++ b/spec/services/redirect_flows_service_spec.rb
@@ -25,13 +25,13 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
+ 'success_redirect_url' => 'success_redirect_url-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/redirect_flows})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/redirect_flows}).
+ with(
body: {
'redirect_flows' => {
@@ -45,11 +45,11 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'redirect_flows' =>
@@ -65,8 +65,8 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}.to_json,
headers: response_headers
@@ -81,19 +81,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/redirect_flows})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/redirect_flows}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/redirect_flows})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/redirect_flows}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -111,9 +111,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -141,7 +141,7 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
+ 'success_redirect_url' => 'success_redirect_url-input',
}
end
@@ -156,11 +156,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -169,8 +169,8 @@
let!(:get_stub) do
stub_url = "/redirect_flows/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'redirect_flows' => {
@@ -184,8 +184,8 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -208,8 +208,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -223,9 +223,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/redirect_flows/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'redirect_flows' => {
@@ -239,8 +239,8 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -248,7 +248,7 @@
subject(:get_response) do
client.redirect_flows.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -275,8 +275,8 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -315,8 +315,8 @@
it 'retries timeouts' do
stub_url = '/redirect_flows/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -325,11 +325,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/redirect_flows/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -344,20 +344,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -387,8 +387,8 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}.to_json,
headers: response_headers
@@ -404,8 +404,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/redirect_flows/:identity/actions/complete'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -422,8 +422,8 @@
let!(:stub) do
# /redirect_flows/%v/actions/complete
stub_url = '/redirect_flows/:identity/actions/complete'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -440,8 +440,8 @@
'redirect_url' => 'redirect_url-input',
'scheme' => 'scheme-input',
'session_token' => 'session_token-input',
- 'success_redirect_url' => 'success_redirect_url-input'
- }
+ 'success_redirect_url' => 'success_redirect_url-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/refunds_service_spec.rb b/spec/services/refunds_service_spec.rb
index 82942cf5..79d1161d 100644
--- a/spec/services/refunds_service_spec.rb
+++ b/spec/services/refunds_service_spec.rb
@@ -23,13 +23,13 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/refunds})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/refunds}).
+ with(
body: {
'refunds' => {
@@ -41,11 +41,11 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'refunds' =>
@@ -59,8 +59,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -75,19 +75,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/refunds})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/refunds}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/refunds})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/refunds}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -105,9 +105,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -133,7 +133,7 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
@@ -148,11 +148,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -161,8 +161,8 @@
let!(:get_stub) do
stub_url = "/refunds/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'refunds' => {
@@ -174,8 +174,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -198,8 +198,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -221,14 +221,14 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -270,19 +270,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/refunds})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/refunds}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/refunds})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/refunds}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -305,12 +305,12 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -329,12 +329,12 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -362,19 +362,19 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/refunds\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/refunds\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'refunds' => [{
@@ -386,12 +386,12 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -415,18 +415,18 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/refunds\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/refunds\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -442,12 +442,12 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -468,9 +468,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/refunds/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'refunds' => {
@@ -482,8 +482,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -491,7 +491,7 @@
subject(:get_response) do
client.refunds.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -516,8 +516,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -556,8 +556,8 @@
it 'retries timeouts' do
stub_url = '/refunds/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -566,11 +566,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/refunds/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -585,20 +585,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -627,8 +627,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'reference' => 'reference-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -644,8 +644,8 @@
it 'retries timeouts' do
stub_url = '/refunds/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -653,11 +653,11 @@
it 'retries 5XX errors' do
stub_url = '/refunds/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
diff --git a/spec/services/scenario_simulators_service_spec.rb b/spec/services/scenario_simulators_service_spec.rb
index beb129b8..e4180350 100644
--- a/spec/services/scenario_simulators_service_spec.rb
+++ b/spec/services/scenario_simulators_service_spec.rb
@@ -21,8 +21,8 @@
body: {
'scenario_simulators' => {
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}.to_json,
headers: response_headers
@@ -38,8 +38,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/scenario_simulators/:identity/actions/run'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -56,16 +56,16 @@
let!(:stub) do
# /scenario_simulators/%v/actions/run
stub_url = '/scenario_simulators/:identity/actions/run'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
body: {
'scenario_simulators' => {
- 'id' => 'id-input'
- }
+ 'id' => 'id-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/scheme_identifiers_service_spec.rb b/spec/services/scheme_identifiers_service_spec.rb
index 337aea94..e5f39b2a 100644
--- a/spec/services/scheme_identifiers_service_spec.rb
+++ b/spec/services/scheme_identifiers_service_spec.rb
@@ -32,13 +32,13 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/scheme_identifiers})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/scheme_identifiers}).
+ with(
body: {
'scheme_identifiers' => {
@@ -59,11 +59,11 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'scheme_identifiers' =>
@@ -86,8 +86,8 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
@@ -102,19 +102,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/scheme_identifiers})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/scheme_identifiers}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/scheme_identifiers})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/scheme_identifiers}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -132,9 +132,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -169,7 +169,7 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}
end
@@ -184,11 +184,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -197,8 +197,8 @@
let!(:get_stub) do
stub_url = "/scheme_identifiers/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'scheme_identifiers' => {
@@ -219,8 +219,8 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -243,8 +243,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -275,14 +275,14 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -346,19 +346,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/scheme_identifiers})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/scheme_identifiers}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/scheme_identifiers})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/scheme_identifiers}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -390,12 +390,12 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -423,12 +423,12 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -465,19 +465,19 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/scheme_identifiers\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/scheme_identifiers\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'scheme_identifiers' => [{
@@ -498,12 +498,12 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -536,18 +536,18 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/scheme_identifiers\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/scheme_identifiers\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -572,12 +572,12 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
+ 'status' => 'status-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -598,9 +598,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/scheme_identifiers/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'scheme_identifiers' => {
@@ -621,8 +621,8 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -630,7 +630,7 @@
subject(:get_response) do
client.scheme_identifiers.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -664,8 +664,8 @@
'reference' => 'reference-input',
'region' => 'region-input',
'scheme' => 'scheme-input',
- 'status' => 'status-input'
- }
+ 'status' => 'status-input',
+ },
}.to_json,
headers: response_headers
)
@@ -704,8 +704,8 @@
it 'retries timeouts' do
stub_url = '/scheme_identifiers/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -714,11 +714,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/scheme_identifiers/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -733,20 +733,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
diff --git a/spec/services/subscriptions_service_spec.rb b/spec/services/subscriptions_service_spec.rb
index f9473768..060f5535 100644
--- a/spec/services/subscriptions_service_spec.rb
+++ b/spec/services/subscriptions_service_spec.rb
@@ -35,13 +35,13 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/subscriptions})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/subscriptions}).
+ with(
body: {
'subscriptions' => {
@@ -65,11 +65,11 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'subscriptions' =>
@@ -95,8 +95,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
@@ -111,19 +111,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/subscriptions})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/subscriptions}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/subscriptions})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/subscriptions}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -141,9 +141,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -181,7 +181,7 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}
end
@@ -196,11 +196,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -209,8 +209,8 @@
let!(:get_stub) do
stub_url = "/subscriptions/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return(
body: {
'subscriptions' => {
@@ -234,8 +234,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
@@ -258,8 +258,8 @@
end
it 'raises an IdempotencyConflict error' do
- expect { post_create_response }
- .to raise_error(GoCardlessPro::IdempotencyConflict)
+ expect { post_create_response }.
+ to raise_error(GoCardlessPro::IdempotencyConflict)
end
end
end
@@ -293,14 +293,14 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -366,19 +366,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/subscriptions})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/subscriptions}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/subscriptions})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/subscriptions}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -413,12 +413,12 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -449,12 +449,12 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -494,19 +494,19 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/subscriptions\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/subscriptions\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'subscriptions' => [{
@@ -530,12 +530,12 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -571,18 +571,18 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/subscriptions\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/subscriptions\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -610,12 +610,12 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
+ 'upcoming_payments' => 'upcoming_payments-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -636,9 +636,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/subscriptions/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'subscriptions' => {
@@ -662,8 +662,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
@@ -671,7 +671,7 @@
subject(:get_response) do
client.subscriptions.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -708,8 +708,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
@@ -748,8 +748,8 @@
it 'retries timeouts' do
stub_url = '/subscriptions/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -758,11 +758,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/subscriptions/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -777,20 +777,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -831,8 +831,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
@@ -848,8 +848,8 @@
it 'retries timeouts' do
stub_url = '/subscriptions/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -857,11 +857,11 @@
it 'retries 5XX errors' do
stub_url = '/subscriptions/:identity'.gsub(':identity', id)
- stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:put, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
put_update_response
expect(stub).to have_been_requested.twice
@@ -902,8 +902,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
@@ -919,8 +919,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/subscriptions/:identity/actions/pause'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -937,8 +937,8 @@
let!(:stub) do
# /subscriptions/%v/actions/pause
stub_url = '/subscriptions/:identity/actions/pause'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -965,8 +965,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
@@ -1006,8 +1006,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
@@ -1023,8 +1023,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/subscriptions/:identity/actions/resume'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -1041,8 +1041,8 @@
let!(:stub) do
# /subscriptions/%v/actions/resume
stub_url = '/subscriptions/:identity/actions/resume'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -1069,8 +1069,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
@@ -1110,8 +1110,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
@@ -1127,8 +1127,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/subscriptions/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -1145,8 +1145,8 @@
let!(:stub) do
# /subscriptions/%v/actions/cancel
stub_url = '/subscriptions/:identity/actions/cancel'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -1173,8 +1173,8 @@
'retry_if_possible' => 'retry_if_possible-input',
'start_date' => 'start_date-input',
'status' => 'status-input',
- 'upcoming_payments' => 'upcoming_payments-input'
- }
+ 'upcoming_payments' => 'upcoming_payments-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/tax_rates_service_spec.rb b/spec/services/tax_rates_service_spec.rb
index f3a8758f..7ac82a93 100644
--- a/spec/services/tax_rates_service_spec.rb
+++ b/spec/services/tax_rates_service_spec.rb
@@ -22,14 +22,14 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -67,19 +67,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/tax_rates})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/tax_rates}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/tax_rates})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/tax_rates}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -99,12 +99,12 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -120,12 +120,12 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -150,19 +150,19 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/tax_rates\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/tax_rates\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'tax_rates' => [{
@@ -171,12 +171,12 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -197,18 +197,18 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/tax_rates\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/tax_rates\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -221,12 +221,12 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
+ 'type' => 'type-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -247,9 +247,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/tax_rates/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'tax_rates' => {
@@ -258,8 +258,8 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
- }
+ 'type' => 'type-input',
+ },
}.to_json,
headers: response_headers
)
@@ -267,7 +267,7 @@
subject(:get_response) do
client.tax_rates.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -289,8 +289,8 @@
'jurisdiction' => 'jurisdiction-input',
'percentage' => 'percentage-input',
'start_date' => 'start_date-input',
- 'type' => 'type-input'
- }
+ 'type' => 'type-input',
+ },
}.to_json,
headers: response_headers
)
@@ -329,8 +329,8 @@
it 'retries timeouts' do
stub_url = '/tax_rates/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -339,11 +339,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/tax_rates/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -358,20 +358,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
diff --git a/spec/services/transferred_mandates_service_spec.rb b/spec/services/transferred_mandates_service_spec.rb
index 3f2f369c..3d78d3f4 100644
--- a/spec/services/transferred_mandates_service_spec.rb
+++ b/spec/services/transferred_mandates_service_spec.rb
@@ -24,8 +24,8 @@
'encrypted_customer_bank_details' => 'encrypted_customer_bank_details-input',
'encrypted_decryption_key' => 'encrypted_decryption_key-input',
'links' => 'links-input',
- 'public_key_id' => 'public_key_id-input'
- }
+ 'public_key_id' => 'public_key_id-input',
+ },
}.to_json,
headers: response_headers
@@ -41,8 +41,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/transferred_mandates/:identity'.gsub(':identity', resource_id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { get_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -59,8 +59,8 @@
let!(:stub) do
# /transferred_mandates/%v
stub_url = '/transferred_mandates/:identity'.gsub(':identity', resource_id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -70,8 +70,8 @@
'encrypted_customer_bank_details' => 'encrypted_customer_bank_details-input',
'encrypted_decryption_key' => 'encrypted_decryption_key-input',
'links' => 'links-input',
- 'public_key_id' => 'public_key_id-input'
- }
+ 'public_key_id' => 'public_key_id-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/verification_details_service_spec.rb b/spec/services/verification_details_service_spec.rb
index ab0fe04f..f3ce3d14 100644
--- a/spec/services/verification_details_service_spec.rb
+++ b/spec/services/verification_details_service_spec.rb
@@ -24,13 +24,13 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/verification_details})
- .with(
+ stub_request(:post, %r{.*api.gocardless.com/verification_details}).
+ with(
body: {
'verification_details' => {
@@ -43,11 +43,11 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
- }
+ 'postal_code' => 'postal_code-input',
+ },
}
- )
- .to_return(
+ ).
+ to_return(
body: {
'verification_details' =>
@@ -62,8 +62,8 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
- }
+ 'postal_code' => 'postal_code-input',
+ },
}.to_json,
headers: response_headers
@@ -78,19 +78,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/verification_details})
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/verification_details}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:post, %r{.*api.gocardless.com/verification_details})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/verification_details}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
post_create_response
expect(stub).to have_been_requested.twice
@@ -108,9 +108,9 @@
type: 'validation_failed',
code: 422,
errors: [
- { message: 'test error message', field: 'test_field' }
- ]
- }
+ { message: 'test error message', field: 'test_field' },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 422
@@ -137,7 +137,7 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}
end
@@ -152,11 +152,11 @@
message: 'A resource has already been created with this idempotency key',
reason: 'idempotent_creation_conflict',
links: {
- conflicting_resource_id: id
- }
- }
- ]
- }
+ conflicting_resource_id: id,
+ },
+ },
+ ],
+ },
}.to_json,
headers: response_headers,
status: 409
@@ -187,14 +187,14 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -240,19 +240,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/verification_details})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/verification_details}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/verification_details})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/verification_details}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -276,12 +276,12 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -301,12 +301,12 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -335,19 +335,19 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/verification_details\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/verification_details\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'verification_details' => [{
@@ -360,12 +360,12 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -390,18 +390,18 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/verification_details\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/verification_details\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -418,12 +418,12 @@
'directors' => 'directors-input',
'links' => 'links-input',
'name' => 'name-input',
- 'postal_code' => 'postal_code-input'
+ 'postal_code' => 'postal_code-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/services/webhooks_service_spec.rb b/spec/services/webhooks_service_spec.rb
index 32b5ccc8..76b705b4 100644
--- a/spec/services/webhooks_service_spec.rb
+++ b/spec/services/webhooks_service_spec.rb
@@ -29,14 +29,14 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123'
- }
- }
+ after: 'ABC123',
+ },
+ },
}.to_json
end
@@ -88,19 +88,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:get, %r{.*api.gocardless.com/webhooks})
- .to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/webhooks}).
+ to_timeout.then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
end
it 'retries 5XX errors' do
- stub = stub_request(:get, %r{.*api.gocardless.com/webhooks})
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers, body: body })
+ stub = stub_request(:get, %r{.*api.gocardless.com/webhooks}).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers, body: body })
get_list_response
expect(stub).to have_been_requested.twice
@@ -127,12 +127,12 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
@@ -155,12 +155,12 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -192,19 +192,19 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/webhooks\?after=AB345})
- .to_timeout.then
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/webhooks\?after=AB345}).
+ to_timeout.then.
+ to_return(
body: {
'webhooks' => [{
@@ -220,12 +220,12 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -253,18 +253,18 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1
- }
+ limit: 1,
+ },
}.to_json,
headers: response_headers
)
- second_response_stub = stub_request(:get, %r{.*api.gocardless.com/webhooks\?after=AB345})
- .to_return(
+ second_response_stub = stub_request(:get, %r{.*api.gocardless.com/webhooks\?after=AB345}).
+ to_return(
status: 502,
body: 'Response from Cloudflare',
headers: { 'Content-Type' => 'text/html' }
@@ -284,12 +284,12 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
+ 'url' => 'url-input',
}],
meta: {
limit: 2,
- cursors: {}
- }
+ cursors: {},
+ },
}.to_json,
headers: response_headers
)
@@ -310,9 +310,9 @@
context 'passing in a custom header' do
let!(:stub) do
stub_url = '/webhooks/:identity'.gsub(':identity', id)
- stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .with(headers: { 'Foo' => 'Bar' })
- .to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ with(headers: { 'Foo' => 'Bar' }).
+ to_return(
body: {
'webhooks' => {
@@ -328,8 +328,8 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -337,7 +337,7 @@
subject(:get_response) do
client.webhooks.get(id, headers: {
- 'Foo' => 'Bar'
+ 'Foo' => 'Bar',
})
end
@@ -366,8 +366,8 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
)
@@ -406,8 +406,8 @@
it 'retries timeouts' do
stub_url = '/webhooks/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_timeout.then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -416,11 +416,11 @@
it 'retries 5XX errors, other than 500s' do
stub_url = '/webhooks/:identity'.gsub(':identity', id)
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 502,
- headers: { 'Content-Type' => 'text/html' },
- body: 'Response from Cloudflare' })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 502,
+ headers: { 'Content-Type' => 'text/html' },
+ body: 'Response from Cloudflare' }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -435,20 +435,20 @@
'documentation_url' => 'https://developer.gocardless.com/#gocardless',
'errors' => [{
'message' => 'Internal server error',
- 'reason' => 'internal_server_error'
+ 'reason' => 'internal_server_error',
}],
'type' => 'gocardless',
'code' => 500,
'request_id' => 'dummy_request_id',
- 'id' => 'dummy_exception_id'
- }
+ 'id' => 'dummy_exception_id',
+ },
}
- stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/)
- .to_return({ status: 500,
- headers: response_headers,
- body: gocardless_error.to_json })
- .then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/).
+ to_return({ status: 500,
+ headers: response_headers,
+ body: gocardless_error.to_json }).
+ then.to_return({ status: 200, headers: response_headers })
get_response
expect(stub).to have_been_requested.twice
@@ -480,8 +480,8 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
@@ -497,8 +497,8 @@
describe 'retry behaviour' do
it "doesn't retry errors" do
stub_url = '/webhooks/:identity/actions/retry'.gsub(':identity', resource_id)
- stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .to_timeout
+ stub = stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ to_timeout
expect { post_response }.to raise_error(Faraday::ConnectionFailed)
expect(stub).to have_been_requested
@@ -515,8 +515,8 @@
let!(:stub) do
# /webhooks/%v/actions/retry
stub_url = '/webhooks/:identity/actions/retry'.gsub(':identity', resource_id)
- stub_request(:post, /.*api.gocardless.com#{stub_url}/)
- .with(
+ stub_request(:post, /.*api.gocardless.com#{stub_url}/).
+ with(
body: { foo: 'bar' },
headers: { 'Foo' => 'Bar' }
).to_return(
@@ -535,8 +535,8 @@
'response_headers_content_truncated' => 'response_headers_content_truncated-input',
'response_headers_count_truncated' => 'response_headers_count_truncated-input',
'successful' => 'successful-input',
- 'url' => 'url-input'
- }
+ 'url' => 'url-input',
+ },
}.to_json,
headers: response_headers
)
diff --git a/spec/webhook_spec.rb b/spec/webhook_spec.rb
index aa370a22..37a1a45f 100644
--- a/spec/webhook_spec.rb
+++ b/spec/webhook_spec.rb
@@ -6,7 +6,7 @@
{
request_body: request_body,
signature_header: signature_header,
- webhook_endpoint_secret: webhook_endpoint_secret
+ webhook_endpoint_secret: webhook_endpoint_secret,
}
end
@@ -40,8 +40,8 @@
expect(events.first.links.subscription).to eq('SB0003JJQ2MR06')
expect(events.first.details['origin']).to eq('api')
expect(events.first.details['cause']).to eq('subscription_created')
- expect(events.first.details['description'])
- .to eq('Subscription created via the API.')
+ expect(events.first.details['description']).
+ to eq('Subscription created via the API.')
expect(events.first.metadata).to eq({})
expect(events.last.id).to eq('EV00BD05TB8K63')
@@ -51,8 +51,8 @@
expect(events.last.links.mandate).to eq('MD000AMA19XGEC')
expect(events.last.details['origin']).to eq('api')
expect(events.last.details['cause']).to eq('mandate_created')
- expect(events.last.details['description'])
- .to eq('Mandate created via the API.')
+ expect(events.last.details['description']).
+ to eq('Mandate created via the API.')
expect(events.last.metadata).to eq({})
end
end
@@ -61,9 +61,9 @@
let(:webhook_endpoint_secret) { 'foo' }
it 'raises an InvalidSignatureError' do
- expect { described_class.parse(options) }
- .to raise_error(described_class::InvalidSignatureError,
- /doesn't appear to be a genuine webhook from GoCardless/)
+ expect { described_class.parse(options) }.
+ to raise_error(described_class::InvalidSignatureError,
+ /doesn't appear to be a genuine webhook from GoCardless/)
end
end
@@ -71,9 +71,9 @@
before { options.delete(:request_body) }
it 'raises an ArgumentError' do
- expect { described_class.signature_valid?(options) }
- .to raise_error(ArgumentError,
- 'request_body must be provided and must be a string')
+ expect { described_class.signature_valid?(options) }.
+ to raise_error(ArgumentError,
+ 'request_body must be provided and must be a string')
end
end
@@ -81,9 +81,9 @@
let(:request_body) { StringIO.new }
it 'raises an ArgumentError' do
- expect { described_class.signature_valid?(options) }
- .to raise_error(ArgumentError,
- 'request_body must be provided and must be a string')
+ expect { described_class.signature_valid?(options) }.
+ to raise_error(ArgumentError,
+ 'request_body must be provided and must be a string')
end
end
end
@@ -103,9 +103,9 @@
before { options.delete(:request_body) }
it 'raises an ArgumentError' do
- expect { described_class.signature_valid?(options) }
- .to raise_error(ArgumentError,
- 'request_body must be provided and must be a string')
+ expect { described_class.signature_valid?(options) }.
+ to raise_error(ArgumentError,
+ 'request_body must be provided and must be a string')
end
end
@@ -113,9 +113,9 @@
let(:request_body) { StringIO.new }
it 'raises an ArgumentError' do
- expect { described_class.signature_valid?(options) }
- .to raise_error(ArgumentError,
- 'request_body must be provided and must be a string')
+ expect { described_class.signature_valid?(options) }.
+ to raise_error(ArgumentError,
+ 'request_body must be provided and must be a string')
end
end
end
From f4997964cf5b255021d92fcd5bd7fa6192d87d58 Mon Sep 17 00:00:00 2001
From: "gocardless-ci-robot[bot]"
<123969075+gocardless-ci-robot[bot]@users.noreply.github.com>
Date: Fri, 19 Sep 2025 14:10:45 +0000
Subject: [PATCH 05/23] Changes generated by
8687df04d38915918d40915e2f864f689e366cc2
This commit was automatically created from gocardless/gocardless-pro-ruby-template@8687df04d38915918d40915e2f864f689e366cc2
by the `push-files` action.
Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/17860676883
---
README.md | 12 ------------
1 file changed, 12 deletions(-)
diff --git a/README.md b/README.md
index cd3fbc05..c5e1f620 100644
--- a/README.md
+++ b/README.md
@@ -260,18 +260,6 @@ OAuth simply provides a means by which you obtain an access token - once you hav
We recommend using the [oauth2](https://github.com/intridea/oauth2) gem to handle the authorisation process and gain a token. For an example of this in action, see our [open-source OAuth demo app](https://github.com/gocardless/oauth-demo/blob/master/app.rb#L46).
-## Supporting Ruby < 2.0.0
-The client only supports Ruby >= 2.0.0 out of the box due to our use of
-Enumerable::Lazy for lazy loading of paginated API resources.
-
-If you wish to use this gem with a previous ruby version, you should be able to
-do so with the [backports](https://github.com/marcandre/backports) gem:
-
-1. Add backports to your Gemfile
- ```gem 'backports'```
-2. Require lazy enumerables
- ```require 'backports/2.0.0/enumerable/lazy.rb'```
-
## Contributing
This client is auto-generated from Crank, a toolchain that we hope to open source soon. For now, issues should be reported on this repository. __Please do not modify the source code yourself, your changes will be overriden!__
From 3315f7b731c80f07e2a27db3d8b04b66be310aa6 Mon Sep 17 00:00:00 2001
From: "gocardless-ci-robot[bot]"
<123969075+gocardless-ci-robot[bot]@users.noreply.github.com>
Date: Tue, 7 Oct 2025 08:28:41 +0000
Subject: [PATCH 06/23] Changes generated by
84ea52be6ede9040bdcdabbc5d07ea107f464e51
This commit was automatically created from gocardless/gocardless-pro-ruby-template@84ea52be6ede9040bdcdabbc5d07ea107f464e51
by the `push-files` action.
Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/18306683504
---
.../services/bank_account_details_service.rb | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
diff --git a/lib/gocardless_pro/services/bank_account_details_service.rb b/lib/gocardless_pro/services/bank_account_details_service.rb
index 17416554..a9ddec76 100644
--- a/lib/gocardless_pro/services/bank_account_details_service.rb
+++ b/lib/gocardless_pro/services/bank_account_details_service.rb
@@ -11,7 +11,12 @@ module Services
# Service for making requests to the BankAccountDetail endpoints
class BankAccountDetailsService < BaseService
# Returns bank account details in the flattened JSON Web Encryption format
- # described in RFC 7516
+ # described in RFC 7516.
+ #
+ # You must specify a `Gc-Key-Id` header when using this endpoint. See [Public
+ # Key
+ # Setup](https://developer.gocardless.com/gc-embed/bank-details-access#public_key_setup)
+ # for more details.
# Example URL: /bank_account_details/:identity
#
# @param identity # Unique identifier, beginning with "BA".
From 94c62e7b5ffcffe4dd344d3f8f109a1096271cb1 Mon Sep 17 00:00:00 2001
From: "gocardless-ci-robot[bot]"
<123969075+gocardless-ci-robot[bot]@users.noreply.github.com>
Date: Fri, 10 Oct 2025 10:56:33 +0000
Subject: [PATCH 07/23] Changes generated by
2c4ddcfddd93d20a3bc45f069005eab5671cfc0b
This commit was automatically created from gocardless/gocardless-pro-ruby-template@2c4ddcfddd93d20a3bc45f069005eab5671cfc0b
by the `push-files` action.
Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/18404369944
---
lib/gocardless_pro/resources/event.rb | 2 +-
lib/gocardless_pro/resources/mandate.rb | 4 ++--
lib/gocardless_pro/resources/outbound_payment.rb | 5 +++--
lib/gocardless_pro/resources/payer_authorisation.rb | 2 +-
lib/gocardless_pro/resources/payment.rb | 4 ++--
lib/gocardless_pro/resources/refund.rb | 6 +++---
lib/gocardless_pro/services/payouts_service.rb | 3 +--
7 files changed, 13 insertions(+), 13 deletions(-)
diff --git a/lib/gocardless_pro/resources/event.rb b/lib/gocardless_pro/resources/event.rb
index 868b9285..66200dc4 100644
--- a/lib/gocardless_pro/resources/event.rb
+++ b/lib/gocardless_pro/resources/event.rb
@@ -15,7 +15,7 @@ module Resources
# mandate which has been transferred. Event creation is an asynchronous
# process, so it can take some time between an action occurring and its
# corresponding event getting included in API responses. See
- # [here](#event-actions) for a complete list of event types.
+ # [here](#webhooks) for a complete list of event types.
class Event
attr_reader :action
attr_reader :created_at
diff --git a/lib/gocardless_pro/resources/mandate.rb b/lib/gocardless_pro/resources/mandate.rb
index 5ff71f12..705e34dc 100644
--- a/lib/gocardless_pro/resources/mandate.rb
+++ b/lib/gocardless_pro/resources/mandate.rb
@@ -13,8 +13,8 @@ module Resources
# Mandates represent the Direct Debit mandate with a
# [customer](#core-endpoints-customers).
#
- # GoCardless will notify you via a [webhook](#appendix-webhooks) whenever
- # the status of a mandate changes.
+ # GoCardless will notify you via a [webhook](#appendix-more-on-webhooks)
+ # whenever the status of a mandate changes.
class Mandate
attr_reader :authorisation_source
attr_reader :consent_parameters
diff --git a/lib/gocardless_pro/resources/outbound_payment.rb b/lib/gocardless_pro/resources/outbound_payment.rb
index fe5fde5f..0170784e 100644
--- a/lib/gocardless_pro/resources/outbound_payment.rb
+++ b/lib/gocardless_pro/resources/outbound_payment.rb
@@ -13,8 +13,9 @@ module Resources
# Outbound Payments represent payments sent from
# [creditors](#core-endpoints-creditors).
#
- # GoCardless will notify you via a [webhook](#appendix-webhooks) when the
- # status of the outbound payment [changes](#event-actions-outbound-payment).
+ # GoCardless will notify you via a [webhook](#appendix-more-on-webhooks)
+ # when the status of the outbound payment
+ # [changes](#webhooks-outbound-payment).
#
# Restricted: Outbound # Payments are currently in Early Access and available only to a limited diff --git a/lib/gocardless_pro/resources/payer_authorisation.rb b/lib/gocardless_pro/resources/payer_authorisation.rb index 79cce40c..ec190e38 100644 --- a/lib/gocardless_pro/resources/payer_authorisation.rb +++ b/lib/gocardless_pro/resources/payer_authorisation.rb @@ -45,7 +45,7 @@ module Resources # the following: #
payer_authorisation_completed webhook (recommended)Restricted: Outbound # Payments are currently in Early Access and available only to a limited diff --git a/lib/gocardless_pro/resources/payer_authorisation.rb b/lib/gocardless_pro/resources/payer_authorisation.rb index ec190e38..79cce40c 100644 --- a/lib/gocardless_pro/resources/payer_authorisation.rb +++ b/lib/gocardless_pro/resources/payer_authorisation.rb @@ -45,7 +45,7 @@ module Resources # the following: #
payer_authorisation_completed webhook (recommended)Restricted: Outbound # Payments are currently in Early Access and available only to a limited From e9897a701b081f7363ee7414ad3be52ca8f4785b Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Thu, 23 Oct 2025 11:35:55 +0000 Subject: [PATCH 10/23] Changes generated by 64443289f7160ba24d5f82a2b0dbfea356c6d632 This commit was automatically created from gocardless/gocardless-pro-ruby-template@64443289f7160ba24d5f82a2b0dbfea356c6d632 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/18746980881 --- .../services/billing_request_templates_service.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/gocardless_pro/services/billing_request_templates_service.rb b/lib/gocardless_pro/services/billing_request_templates_service.rb index 34c77ecf..d368f5c4 100644 --- a/lib/gocardless_pro/services/billing_request_templates_service.rb +++ b/lib/gocardless_pro/services/billing_request_templates_service.rb @@ -97,7 +97,7 @@ def create(options = {}) # Requests created by this template. # Example URL: /billing_request_templates/:identity # - # @param identity # Unique identifier, beginning with "BRQ". + # @param identity # Unique identifier, beginning with "BRT". # @param options [Hash] parameters as a hash, under a params key. def update(identity, options = {}) path = sub_url('/billing_request_templates/:identity', { From 8786bd48650e2ce16be8dc493e5ac3af6ba5d075 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Wed, 3 Dec 2025 14:55:33 +0000 Subject: [PATCH 11/23] Changes generated by 339a5c5f4e167de77232862c9f1291a252048970 This commit was automatically created from gocardless/gocardless-pro-ruby-template@339a5c5f4e167de77232862c9f1291a252048970 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/19898114878 --- lib/gocardless_pro.rb | 3 + lib/gocardless_pro/client.rb | 5 + lib/gocardless_pro/paginator.rb | 5 +- .../resources/outbound_payment.rb | 7 - .../resources/payment_account_transaction.rb | 78 +++++ .../payment_account_transactions_service.rb | 66 ++++ spec/paginator_spec.rb | 137 +++++++++ .../payment_account_transaction_spec.rb | 140 +++++++++ ...yment_account_transactions_service_spec.rb | 288 ++++++++++++++++++ 9 files changed, 720 insertions(+), 9 deletions(-) create mode 100644 lib/gocardless_pro/resources/payment_account_transaction.rb create mode 100644 lib/gocardless_pro/services/payment_account_transactions_service.rb create mode 100644 spec/paginator_spec.rb create mode 100644 spec/resources/payment_account_transaction_spec.rb create mode 100644 spec/services/payment_account_transactions_service_spec.rb diff --git a/lib/gocardless_pro.rb b/lib/gocardless_pro.rb index 0f372d30..d8eb2113 100644 --- a/lib/gocardless_pro.rb +++ b/lib/gocardless_pro.rb @@ -126,6 +126,9 @@ module GoCardlessPro require_relative 'gocardless_pro/resources/payment' require_relative 'gocardless_pro/services/payments_service' +require_relative 'gocardless_pro/resources/payment_account_transaction' +require_relative 'gocardless_pro/services/payment_account_transactions_service' + require_relative 'gocardless_pro/resources/payout' require_relative 'gocardless_pro/services/payouts_service' diff --git a/lib/gocardless_pro/client.rb b/lib/gocardless_pro/client.rb index 49eaf80b..c4711ec7 100644 --- a/lib/gocardless_pro/client.rb +++ b/lib/gocardless_pro/client.rb @@ -148,6 +148,11 @@ def payments @payments ||= Services::PaymentsService.new(@api_service) end + # Access to the service for payment_account_transaction to make API calls + def payment_account_transactions + @payment_account_transactions ||= Services::PaymentAccountTransactionsService.new(@api_service) + end + # Access to the service for payout to make API calls def payouts @payouts ||= Services::PayoutsService.new(@api_service) diff --git a/lib/gocardless_pro/paginator.rb b/lib/gocardless_pro/paginator.rb index 492460f3..933ef33b 100644 --- a/lib/gocardless_pro/paginator.rb +++ b/lib/gocardless_pro/paginator.rb @@ -8,6 +8,7 @@ class Paginator def initialize(options = {}) @service = options.fetch(:service) @options = options.fetch(:options) + @uri_params = options.reject { |k, _| %i[service options].include?(k) } end # Get a lazy enumerable for listing data from the API @@ -22,7 +23,7 @@ def enumerator @options[:params] ||= {} @options[:params] = @options[:params].merge(after: after_cursor) - response = @service.list(@options.merge(after: after_cursor)) + response = @service.list(*@uri_params.values, @options.merge(after: after_cursor)) end end.lazy end @@ -30,7 +31,7 @@ def enumerator private def get_initial_response - @initial_response ||= @service.list(@options) + @initial_response ||= @service.list(*@uri_params.values, @options) end end end diff --git a/lib/gocardless_pro/resources/outbound_payment.rb b/lib/gocardless_pro/resources/outbound_payment.rb index 91e64f93..95275554 100644 --- a/lib/gocardless_pro/resources/outbound_payment.rb +++ b/lib/gocardless_pro/resources/outbound_payment.rb @@ -15,13 +15,6 @@ module Resources # # GoCardless will notify you via a [webhook](#appendix-webhooks) when the # status of the outbound payment [changes](#event-types-outbound-payment). - # - #
Restricted: Outbound - # Payments are currently in Early Access and available only to a limited - # list of organisations. If you are interested in using this feature, please - # stay tuned for our public launch announcement. We are actively testing and - # refining our API to ensure it meets your needs and provides the best - # experience.
class OutboundPayment attr_reader :amount attr_reader :created_at diff --git a/lib/gocardless_pro/resources/payment_account_transaction.rb b/lib/gocardless_pro/resources/payment_account_transaction.rb new file mode 100644 index 00000000..eaf880fd --- /dev/null +++ b/lib/gocardless_pro/resources/payment_account_transaction.rb @@ -0,0 +1,78 @@ +# +# This client is automatically generated from a template and JSON schema definition. +# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing. +# + +require 'uri' + +module GoCardlessPro + # A module containing classes for each of the resources in the GC Api + module Resources + # Represents an instance of a payment_account_transaction resource returned from the API + + # Payment account transactions represent movements of funds on a given + # payment account. The payment account is provisioned by GoCardless and is + # used to fund [outbound payments](#core-endpoints-outbound-payments). + class PaymentAccountTransaction + attr_reader :amount + attr_reader :balance_after_transaction + attr_reader :counterparty_name + attr_reader :currency + attr_reader :description + attr_reader :direction + attr_reader :id + attr_reader :reference + attr_reader :value_date + + # Initialize a payment_account_transaction resource instance + # @param object [Hash] an object returned from the API + def initialize(object, response = nil) + @object = object + + @amount = object['amount'] + @balance_after_transaction = object['balance_after_transaction'] + @counterparty_name = object['counterparty_name'] + @currency = object['currency'] + @description = object['description'] + @direction = object['direction'] + @id = object['id'] + @links = object['links'] + @reference = object['reference'] + @value_date = object['value_date'] + @response = response + end + + def api_response + ApiResponse.new(@response) + end + + # Return the links that the resource has + def links + @payment_account_transaction_links ||= Links.new(@links) + end + + # Provides the payment_account_transaction resource as a hash of all its readable attributes + def to_h + @object + end + + class Links + def initialize(links) + @links = links || {} + end + + def outbound_payment + @links['outbound_payment'] + end + + def payment_bank_account + @links['payment_bank_account'] + end + + def payout + @links['payout'] + end + end + end + end +end diff --git a/lib/gocardless_pro/services/payment_account_transactions_service.rb b/lib/gocardless_pro/services/payment_account_transactions_service.rb new file mode 100644 index 00000000..d2f23b1e --- /dev/null +++ b/lib/gocardless_pro/services/payment_account_transactions_service.rb @@ -0,0 +1,66 @@ +require_relative './base_service' + +# encoding: utf-8 +# +# This client is automatically generated from a template and JSON schema definition. +# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing. +# + +module GoCardlessPro + module Services + # Service for making requests to the PaymentAccountTransaction endpoints + class PaymentAccountTransactionsService < BaseService + # List transactions for a given payment account. + # Example URL: /payment_accounts/:identity/transactions + # + # @param identity # The unique ID of the [bank + # account](#core-endpoints-creditor-bank-accounts) which happens to be the + # payment account. + # @param options [Hash] parameters as a hash, under a params key. + def list(identity, options = {}) + path = sub_url('/payment_accounts/:identity/transactions', { + 'identity' => identity, + }) + + options[:retry_failures] = true + + response = make_request(:get, path, options) + + ListResponse.new( + response: response, + unenveloped_body: unenvelope_body(response.body), + resource_class: Resources::PaymentAccountTransaction + ) + end + + # Get a lazily enumerated list of all the items returned. This is similar to the `list` method but will paginate for you automatically. + # + # @param identity # The unique ID of the [bank + # account](#core-endpoints-creditor-bank-accounts) which happens to be the + # payment account. + # @param options [Hash] parameters as a hash. If the request is a GET, these will be converted to query parameters. + # Otherwise they will be the body of the request. + def all(identity, options = {}) + Paginator.new( + service: self, + options: options, + identity: identity + ).enumerator + end + + private + + # Unenvelope the response of the body using the service's `envelope_key` + # + # @param body [Hash] + def unenvelope_body(body) + body[envelope_key] || body['data'] + end + + # return the key which API responses will envelope data under + def envelope_key + 'payment_account_transactions' + end + end + end +end diff --git a/spec/paginator_spec.rb b/spec/paginator_spec.rb new file mode 100644 index 00000000..70d09b08 --- /dev/null +++ b/spec/paginator_spec.rb @@ -0,0 +1,137 @@ +require 'spec_helper' + +describe GoCardlessPro::Paginator do + let(:client) do + GoCardlessPro::Client.new( + access_token: 'SECRET_TOKEN' + ) + end + + let(:response_headers) { { 'Content-Type' => 'application/json' } } + + describe 'with URI parameters' do + it 'passes URI parameters through to list method on initial request' do + payment_account_id = 'BA123' + + first_response_stub = stub_request(:get, %r{.*api.gocardless.com/payment_accounts/#{payment_account_id}/transactions$}).to_return( + body: { + 'payment_account_transactions' => [{ + 'id' => 'PT001', + 'amount' => '100', + }], + meta: { + cursors: {}, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + + results = client.payment_account_transactions.all(payment_account_id).to_a + + expect(results.length).to eq(1) + expect(first_response_stub).to have_been_requested + end + + it 'passes URI parameters through to list method on paginated requests' do + payment_account_id = 'BA123' + + first_response_stub = stub_request(:get, %r{.*api.gocardless.com/payment_accounts/#{payment_account_id}/transactions$}).to_return( + body: { + 'payment_account_transactions' => [{ + 'id' => 'PT001', + 'amount' => '100', + }], + meta: { + cursors: { after: 'cursor123' }, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + + second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payment_accounts/#{payment_account_id}/transactions\?after=cursor123}).to_return( + body: { + 'payment_account_transactions' => [{ + 'id' => 'PT002', + 'amount' => '200', + }], + meta: { + cursors: {}, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + + results = client.payment_account_transactions.all(payment_account_id).to_a + + expect(results.length).to eq(2) + expect(results[0].id).to eq('PT001') + expect(results[1].id).to eq('PT002') + expect(first_response_stub).to have_been_requested + expect(second_response_stub).to have_been_requested + end + + it 'handles query parameters alongside URI parameters' do + payment_account_id = 'BA123' + + stub = stub_request(:get, %r{.*api.gocardless.com/payment_accounts/#{payment_account_id}/transactions\?.*limit=5}).to_return( + body: { + 'payment_account_transactions' => [{ + 'id' => 'PT001', + 'amount' => '100', + }], + meta: { + cursors: {}, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + + results = client.payment_account_transactions.all(payment_account_id, params: { limit: 5 }).to_a + + expect(results.length).to eq(1) + expect(stub).to have_been_requested + end + end + + describe 'without URI parameters' do + it 'works correctly for endpoints without URI parameters' do + first_response_stub = stub_request(:get, %r{.*api.gocardless.com/payments$}).to_return( + body: { + 'payments' => [{ + 'id' => 'PM001', + 'amount' => '100', + }], + meta: { + cursors: { after: 'cursor123' }, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + + second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payments\?after=cursor123}).to_return( + body: { + 'payments' => [{ + 'id' => 'PM002', + 'amount' => '200', + }], + meta: { + cursors: {}, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + + results = client.payments.all.to_a + + expect(results.length).to eq(2) + expect(first_response_stub).to have_been_requested + expect(second_response_stub).to have_been_requested + end + end +end diff --git a/spec/resources/payment_account_transaction_spec.rb b/spec/resources/payment_account_transaction_spec.rb new file mode 100644 index 00000000..ed6601b4 --- /dev/null +++ b/spec/resources/payment_account_transaction_spec.rb @@ -0,0 +1,140 @@ +require 'spec_helper' + +describe GoCardlessPro::Resources::PaymentAccountTransaction do + let(:client) do + GoCardlessPro::Client.new( + access_token: 'SECRET_TOKEN' + ) + end + + let(:response_headers) { { 'Content-Type' => 'application/json' } } + + describe '#list' do + describe 'with no filters' do + let(:identity) { 'ID123' } + + subject(:get_list_response) { client.payment_account_transactions.list(identity) } + + before do + stub_url = '/payment_accounts/:identity/transactions'.gsub(':identity', identity) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: { + 'payment_account_transactions' => [{ + + 'amount' => 'amount-input', + 'balance_after_transaction' => 'balance_after_transaction-input', + 'counterparty_name' => 'counterparty_name-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'direction' => 'direction-input', + 'id' => 'id-input', + 'links' => 'links-input', + 'reference' => 'reference-input', + 'value_date' => 'value_date-input', + }], + meta: { + cursors: { + before: nil, + after: 'ABC123', + }, + }, + }.to_json, + headers: response_headers + ) + end + + it 'wraps each item in the resource class' do + expect(get_list_response.records.map do |x| + x.class + end.uniq.first).to eq(GoCardlessPro::Resources::PaymentAccountTransaction) + + expect(get_list_response.records.first.amount).to eq('amount-input') + + expect(get_list_response.records.first.balance_after_transaction).to eq('balance_after_transaction-input') + + expect(get_list_response.records.first.counterparty_name).to eq('counterparty_name-input') + + expect(get_list_response.records.first.currency).to eq('currency-input') + + expect(get_list_response.records.first.description).to eq('description-input') + + expect(get_list_response.records.first.direction).to eq('direction-input') + + expect(get_list_response.records.first.id).to eq('id-input') + + expect(get_list_response.records.first.reference).to eq('reference-input') + + expect(get_list_response.records.first.value_date).to eq('value_date-input') + end + + it 'exposes the cursors for before and after' do + expect(get_list_response.before).to eq(nil) + expect(get_list_response.after).to eq('ABC123') + end + + specify { expect(get_list_response.api_response.headers).to eql('content-type' => 'application/json') } + end + end + + describe '#all' do + let(:identity) { 'ID123' } + + let!(:first_response_stub) do + stub_url = '/payment_accounts/:identity/transactions'.gsub(':identity', identity) + stub_request(:get, /.*api.gocardless.com#{stub_url}$/).to_return( + body: { + 'payment_account_transactions' => [{ + + 'amount' => 'amount-input', + 'balance_after_transaction' => 'balance_after_transaction-input', + 'counterparty_name' => 'counterparty_name-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'direction' => 'direction-input', + 'id' => 'id-input', + 'links' => 'links-input', + 'reference' => 'reference-input', + 'value_date' => 'value_date-input', + }], + meta: { + cursors: { after: 'AB345' }, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + end + + let!(:second_response_stub) do + stub_url = '/payment_accounts/:identity/transactions'.gsub(':identity', identity) + stub_request(:get, /.*api.gocardless.com#{stub_url}\?after=AB345/).to_return( + body: { + 'payment_account_transactions' => [{ + + 'amount' => 'amount-input', + 'balance_after_transaction' => 'balance_after_transaction-input', + 'counterparty_name' => 'counterparty_name-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'direction' => 'direction-input', + 'id' => 'id-input', + 'links' => 'links-input', + 'reference' => 'reference-input', + 'value_date' => 'value_date-input', + }], + meta: { + limit: 2, + cursors: {}, + }, + }.to_json, + headers: response_headers + ) + end + + it 'automatically makes the extra requests' do + expect(client.payment_account_transactions.all(identity).to_a.length).to eq(2) + expect(first_response_stub).to have_been_requested + expect(second_response_stub).to have_been_requested + end + end +end diff --git a/spec/services/payment_account_transactions_service_spec.rb b/spec/services/payment_account_transactions_service_spec.rb new file mode 100644 index 00000000..138b0f62 --- /dev/null +++ b/spec/services/payment_account_transactions_service_spec.rb @@ -0,0 +1,288 @@ +require 'spec_helper' + +describe GoCardlessPro::Services::PaymentAccountTransactionsService do + let(:client) do + GoCardlessPro::Client.new( + access_token: 'SECRET_TOKEN' + ) + end + + let(:response_headers) { { 'Content-Type' => 'application/json' } } + + describe '#list' do + describe 'with no filters' do + let(:identity) { 'ID123' } + + subject(:get_list_response) { client.payment_account_transactions.list(identity) } + + let(:body) do + { + 'payment_account_transactions' => [{ + + 'amount' => 'amount-input', + 'balance_after_transaction' => 'balance_after_transaction-input', + 'counterparty_name' => 'counterparty_name-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'direction' => 'direction-input', + 'id' => 'id-input', + 'links' => 'links-input', + 'reference' => 'reference-input', + 'value_date' => 'value_date-input', + }], + meta: { + cursors: { + before: nil, + after: 'ABC123', + }, + }, + }.to_json + end + + before do + stub_url = '/payment_accounts/:identity/transactions'.gsub(':identity', identity) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: body, + headers: response_headers + ) + end + + it 'wraps each item in the resource class' do + expect(get_list_response.records.map do |x| + x.class + end.uniq.first).to eq(GoCardlessPro::Resources::PaymentAccountTransaction) + + expect(get_list_response.records.first.amount).to eq('amount-input') + + expect(get_list_response.records.first.balance_after_transaction).to eq('balance_after_transaction-input') + + expect(get_list_response.records.first.counterparty_name).to eq('counterparty_name-input') + + expect(get_list_response.records.first.currency).to eq('currency-input') + + expect(get_list_response.records.first.description).to eq('description-input') + + expect(get_list_response.records.first.direction).to eq('direction-input') + + expect(get_list_response.records.first.id).to eq('id-input') + + expect(get_list_response.records.first.reference).to eq('reference-input') + + expect(get_list_response.records.first.value_date).to eq('value_date-input') + end + + it 'exposes the cursors for before and after' do + expect(get_list_response.before).to eq(nil) + expect(get_list_response.after).to eq('ABC123') + end + + specify { expect(get_list_response.api_response.headers).to eql('content-type' => 'application/json') } + + describe 'retry behaviour' do + before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) } + + it 'retries timeouts' do + stub_url = '/payment_accounts/:identity/transactions'.gsub(':identity', identity) + stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/). + to_timeout.then.to_return({ status: 200, headers: response_headers, body: body }) + + get_list_response + expect(stub).to have_been_requested.twice + end + + it 'retries 5XX errors' do + stub_url = '/payment_accounts/:identity/transactions'.gsub(':identity', identity) + stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/). + to_return({ status: 502, + headers: { 'Content-Type' => 'text/html' }, + body: 'Response from Cloudflare' }). + then.to_return({ status: 200, headers: response_headers, body: body }) + + get_list_response + expect(stub).to have_been_requested.twice + end + end + end + end + + describe '#all' do + let(:identity) { 'ID123' } + + let!(:first_response_stub) do + stub_url = '/payment_accounts/:identity/transactions'.gsub(':identity', identity) + stub_request(:get, /.*api.gocardless.com#{stub_url}$/).to_return( + body: { + 'payment_account_transactions' => [{ + + 'amount' => 'amount-input', + 'balance_after_transaction' => 'balance_after_transaction-input', + 'counterparty_name' => 'counterparty_name-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'direction' => 'direction-input', + 'id' => 'id-input', + 'links' => 'links-input', + 'reference' => 'reference-input', + 'value_date' => 'value_date-input', + }], + meta: { + cursors: { after: 'AB345' }, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + end + + let!(:second_response_stub) do + stub_url = '/payment_accounts/:identity/transactions'.gsub(':identity', identity) + stub_request(:get, /.*api.gocardless.com#{stub_url}\?after=AB345/).to_return( + body: { + 'payment_account_transactions' => [{ + + 'amount' => 'amount-input', + 'balance_after_transaction' => 'balance_after_transaction-input', + 'counterparty_name' => 'counterparty_name-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'direction' => 'direction-input', + 'id' => 'id-input', + 'links' => 'links-input', + 'reference' => 'reference-input', + 'value_date' => 'value_date-input', + }], + meta: { + limit: 2, + cursors: {}, + }, + }.to_json, + headers: response_headers + ) + end + + it 'automatically makes the extra requests' do + expect(client.payment_account_transactions.all(identity).to_a.length).to eq(2) + expect(first_response_stub).to have_been_requested + expect(second_response_stub).to have_been_requested + end + + describe 'retry behaviour' do + before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) } + + it 'retries timeouts' do + stub_url = '/payment_accounts/:identity/transactions'.gsub(':identity', identity) + first_response_stub = stub_request(:get, /.*api.gocardless.com#{stub_url}$/).to_return( + body: { + 'payment_account_transactions' => [{ + + 'amount' => 'amount-input', + 'balance_after_transaction' => 'balance_after_transaction-input', + 'counterparty_name' => 'counterparty_name-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'direction' => 'direction-input', + 'id' => 'id-input', + 'links' => 'links-input', + 'reference' => 'reference-input', + 'value_date' => 'value_date-input', + }], + meta: { + cursors: { after: 'AB345' }, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + + second_response_stub = stub_request(:get, /.*api.gocardless.com#{stub_url}\?after=AB345/). + to_timeout.then. + to_return( + body: { + 'payment_account_transactions' => [{ + + 'amount' => 'amount-input', + 'balance_after_transaction' => 'balance_after_transaction-input', + 'counterparty_name' => 'counterparty_name-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'direction' => 'direction-input', + 'id' => 'id-input', + 'links' => 'links-input', + 'reference' => 'reference-input', + 'value_date' => 'value_date-input', + }], + meta: { + limit: 2, + cursors: {}, + }, + }.to_json, + headers: response_headers + ) + + client.payment_account_transactions.all(identity).to_a + + expect(first_response_stub).to have_been_requested + expect(second_response_stub).to have_been_requested.twice + end + + it 'retries 5XX errors' do + stub_url = '/payment_accounts/:identity/transactions'.gsub(':identity', identity) + first_response_stub = stub_request(:get, /.*api.gocardless.com#{stub_url}$/).to_return( + body: { + 'payment_account_transactions' => [{ + + 'amount' => 'amount-input', + 'balance_after_transaction' => 'balance_after_transaction-input', + 'counterparty_name' => 'counterparty_name-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'direction' => 'direction-input', + 'id' => 'id-input', + 'links' => 'links-input', + 'reference' => 'reference-input', + 'value_date' => 'value_date-input', + }], + meta: { + cursors: { after: 'AB345' }, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + + second_response_stub = stub_request(:get, /.*api.gocardless.com#{stub_url}\?after=AB345/). + to_return( + status: 502, + body: 'Response from Cloudflare', + headers: { 'Content-Type' => 'text/html' } + ).then.to_return( + body: { + 'payment_account_transactions' => [{ + + 'amount' => 'amount-input', + 'balance_after_transaction' => 'balance_after_transaction-input', + 'counterparty_name' => 'counterparty_name-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'direction' => 'direction-input', + 'id' => 'id-input', + 'links' => 'links-input', + 'reference' => 'reference-input', + 'value_date' => 'value_date-input', + }], + meta: { + limit: 2, + cursors: {}, + }, + }.to_json, + headers: response_headers + ) + + client.payment_account_transactions.all(identity).to_a + + expect(first_response_stub).to have_been_requested + expect(second_response_stub).to have_been_requested.twice + end + end + end +end From 947dae1fc2374ea853319afe7baf71ecf45ac18f Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Fri, 12 Dec 2025 13:35:30 +0000 Subject: [PATCH 12/23] Changes generated by 1560b1120a02b39746da793fc226c3e1a3f84a1f This commit was automatically created from gocardless/gocardless-pro-ruby-template@1560b1120a02b39746da793fc226c3e1a3f84a1f by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/20168382946 --- lib/gocardless_pro.rb | 3 + lib/gocardless_pro/client.rb | 5 + .../bank_account_holder_verification.rb | 44 +++ ...nk_account_holder_verifications_service.rb | 86 +++++ .../bank_account_holder_verification_spec.rb | 231 +++++++++++++ ...count_holder_verifications_service_spec.rb | 325 ++++++++++++++++++ 6 files changed, 694 insertions(+) create mode 100644 lib/gocardless_pro/resources/bank_account_holder_verification.rb create mode 100644 lib/gocardless_pro/services/bank_account_holder_verifications_service.rb create mode 100644 spec/resources/bank_account_holder_verification_spec.rb create mode 100644 spec/services/bank_account_holder_verifications_service_spec.rb diff --git a/lib/gocardless_pro.rb b/lib/gocardless_pro.rb index d8eb2113..da329ce1 100644 --- a/lib/gocardless_pro.rb +++ b/lib/gocardless_pro.rb @@ -45,6 +45,9 @@ module GoCardlessPro require_relative 'gocardless_pro/resources/bank_account_detail' require_relative 'gocardless_pro/services/bank_account_details_service' +require_relative 'gocardless_pro/resources/bank_account_holder_verification' +require_relative 'gocardless_pro/services/bank_account_holder_verifications_service' + require_relative 'gocardless_pro/resources/bank_authorisation' require_relative 'gocardless_pro/services/bank_authorisations_service' diff --git a/lib/gocardless_pro/client.rb b/lib/gocardless_pro/client.rb index c4711ec7..741e1ab1 100644 --- a/lib/gocardless_pro/client.rb +++ b/lib/gocardless_pro/client.rb @@ -13,6 +13,11 @@ def bank_account_details @bank_account_details ||= Services::BankAccountDetailsService.new(@api_service) end + # Access to the service for bank_account_holder_verification to make API calls + def bank_account_holder_verifications + @bank_account_holder_verifications ||= Services::BankAccountHolderVerificationsService.new(@api_service) + end + # Access to the service for bank_authorisation to make API calls def bank_authorisations @bank_authorisations ||= Services::BankAuthorisationsService.new(@api_service) diff --git a/lib/gocardless_pro/resources/bank_account_holder_verification.rb b/lib/gocardless_pro/resources/bank_account_holder_verification.rb new file mode 100644 index 00000000..ed2963fe --- /dev/null +++ b/lib/gocardless_pro/resources/bank_account_holder_verification.rb @@ -0,0 +1,44 @@ +# +# This client is automatically generated from a template and JSON schema definition. +# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing. +# + +require 'uri' + +module GoCardlessPro + # A module containing classes for each of the resources in the GC Api + module Resources + # Represents an instance of a bank_account_holder_verification resource returned from the API + + # Create a bank account holder verification for a bank account. + class BankAccountHolderVerification + attr_reader :actual_account_name + attr_reader :id + attr_reader :result + attr_reader :status + attr_reader :type + + # Initialize a bank_account_holder_verification resource instance + # @param object [Hash] an object returned from the API + def initialize(object, response = nil) + @object = object + + @actual_account_name = object['actual_account_name'] + @id = object['id'] + @result = object['result'] + @status = object['status'] + @type = object['type'] + @response = response + end + + def api_response + ApiResponse.new(@response) + end + + # Provides the bank_account_holder_verification resource as a hash of all its readable attributes + def to_h + @object + end + end + end +end diff --git a/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb b/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb new file mode 100644 index 00000000..8b5b8b5f --- /dev/null +++ b/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb @@ -0,0 +1,86 @@ +require_relative './base_service' + +# encoding: utf-8 +# +# This client is automatically generated from a template and JSON schema definition. +# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing. +# + +module GoCardlessPro + module Services + # Service for making requests to the BankAccountHolderVerification endpoints + class BankAccountHolderVerificationsService < BaseService + # Verify the account holder of the bank account. A complete verification can be + # attached when creating an outbound payment. This endpoint allows partner + # merchants to create Confirmation of Payee checks on customer bank accounts + # before sending outbound payments. + # Example URL: /bank_account_holder_verifications + # @param options [Hash] parameters as a hash, under a params key. + def create(options = {}) + path = '/bank_account_holder_verifications' + + params = options.delete(:params) || {} + options[:params] = {} + options[:params][envelope_key] = params + + options[:retry_failures] = true + + begin + response = make_request(:post, path, options) + + # Response doesn't raise any errors until #body is called + response.tap(&:body) + rescue InvalidStateError => e + if e.idempotent_creation_conflict? + case @api_service.on_idempotency_conflict + when :raise + raise IdempotencyConflict, e.error + when :fetch + return get(e.conflicting_resource_id) + end + end + + raise e + end + + return if response.body.nil? + + Resources::BankAccountHolderVerification.new(unenvelope_body(response.body), response) + end + + # Fetches a bank account holder verification by ID. + # Example URL: /bank_account_holder_verifications/:identity + # + # @param identity # The unique identifier for the bank account holder verification resource, + # e.g. "BAHV123". + # @param options [Hash] parameters as a hash, under a params key. + def get(identity, options = {}) + path = sub_url('/bank_account_holder_verifications/:identity', { + 'identity' => identity, + }) + + options[:retry_failures] = true + + response = make_request(:get, path, options) + + return if response.body.nil? + + Resources::BankAccountHolderVerification.new(unenvelope_body(response.body), response) + end + + private + + # Unenvelope the response of the body using the service's `envelope_key` + # + # @param body [Hash] + def unenvelope_body(body) + body[envelope_key] || body['data'] + end + + # return the key which API responses will envelope data under + def envelope_key + 'bank_account_holder_verifications' + end + end + end +end diff --git a/spec/resources/bank_account_holder_verification_spec.rb b/spec/resources/bank_account_holder_verification_spec.rb new file mode 100644 index 00000000..c6c1f275 --- /dev/null +++ b/spec/resources/bank_account_holder_verification_spec.rb @@ -0,0 +1,231 @@ +require 'spec_helper' + +describe GoCardlessPro::Resources::BankAccountHolderVerification do + let(:client) do + GoCardlessPro::Client.new( + access_token: 'SECRET_TOKEN' + ) + end + + let(:response_headers) { { 'Content-Type' => 'application/json' } } + + describe '#create' do + subject(:post_create_response) { client.bank_account_holder_verifications.create(params: new_resource) } + context 'with a valid request' do + let(:new_resource) do + { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + } + end + + before do + stub_request(:post, %r{.*api.gocardless.com/bank_account_holder_verifications}). + with( + body: { + 'bank_account_holder_verifications' => { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + }, + } + ). + to_return( + body: { + 'bank_account_holder_verifications' => + + { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + }, + + }.to_json, + headers: response_headers + ) + end + + it 'creates and returns the resource' do + expect(post_create_response).to be_a(GoCardlessPro::Resources::BankAccountHolderVerification) + end + end + + context 'with a request that returns a validation error' do + let(:new_resource) { {} } + + before do + stub_request(:post, %r{.*api.gocardless.com/bank_account_holder_verifications}).to_return( + body: { + error: { + type: 'validation_failed', + code: 422, + errors: [ + { message: 'test error message', field: 'test_field' }, + ], + }, + }.to_json, + headers: response_headers, + status: 422 + ) + end + + it 'throws the correct error' do + expect { post_create_response }.to raise_error(GoCardlessPro::ValidationError) + end + end + + context 'with a request that returns an idempotent creation conflict error' do + let(:id) { 'ID123' } + + let(:new_resource) do + { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + } + end + + let!(:post_stub) do + stub_request(:post, %r{.*api.gocardless.com/bank_account_holder_verifications}).to_return( + body: { + error: { + type: 'invalid_state', + code: 409, + errors: [ + { + message: 'A resource has already been created with this idempotency key', + reason: 'idempotent_creation_conflict', + links: { + conflicting_resource_id: id, + }, + }, + ], + }, + }.to_json, + headers: response_headers, + status: 409 + ) + end + + let!(:get_stub) do + stub_url = "/bank_account_holder_verifications/#{id}" + stub_request(:get, /.*api.gocardless.com#{stub_url}/). + to_return( + body: { + 'bank_account_holder_verifications' => { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + }, + }.to_json, + headers: response_headers + ) + end + + it 'fetches the already-created resource' do + post_create_response + expect(post_stub).to have_been_requested + expect(get_stub).to have_been_requested + end + end + end + + describe '#get' do + let(:id) { 'ID123' } + + subject(:get_response) { client.bank_account_holder_verifications.get(id) } + + context 'passing in a custom header' do + let!(:stub) do + stub_url = '/bank_account_holder_verifications/:identity'.gsub(':identity', id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/). + with(headers: { 'Foo' => 'Bar' }). + to_return( + body: { + 'bank_account_holder_verifications' => { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + }, + }.to_json, + headers: response_headers + ) + end + + subject(:get_response) do + client.bank_account_holder_verifications.get(id, headers: { + 'Foo' => 'Bar', + }) + end + + it 'includes the header' do + get_response + expect(stub).to have_been_requested + end + end + + context 'when there is a bank_account_holder_verification to return' do + before do + stub_url = '/bank_account_holder_verifications/:identity'.gsub(':identity', id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: { + 'bank_account_holder_verifications' => { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + }, + }.to_json, + headers: response_headers + ) + end + + it 'wraps the response in a resource' do + expect(get_response).to be_a(GoCardlessPro::Resources::BankAccountHolderVerification) + end + end + + context 'when nothing is returned' do + before do + stub_url = '/bank_account_holder_verifications/:identity'.gsub(':identity', id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: '', + headers: response_headers + ) + end + + it 'returns nil' do + expect(get_response).to be_nil + end + end + + context "when an ID is specified which can't be included in a valid URI" do + let(:id) { '`' } + + it "doesn't raise an error" do + expect { get_response }.to_not raise_error(/bad URI/) + end + end + end +end diff --git a/spec/services/bank_account_holder_verifications_service_spec.rb b/spec/services/bank_account_holder_verifications_service_spec.rb new file mode 100644 index 00000000..c015e8e5 --- /dev/null +++ b/spec/services/bank_account_holder_verifications_service_spec.rb @@ -0,0 +1,325 @@ +require 'spec_helper' + +describe GoCardlessPro::Services::BankAccountHolderVerificationsService do + let(:client) do + GoCardlessPro::Client.new( + access_token: 'SECRET_TOKEN' + ) + end + + let(:response_headers) { { 'Content-Type' => 'application/json' } } + + describe '#create' do + subject(:post_create_response) { client.bank_account_holder_verifications.create(params: new_resource) } + context 'with a valid request' do + let(:new_resource) do + { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + } + end + + before do + stub_request(:post, %r{.*api.gocardless.com/bank_account_holder_verifications}). + with( + body: { + 'bank_account_holder_verifications' => { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + }, + } + ). + to_return( + body: { + 'bank_account_holder_verifications' => + + { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + }, + + }.to_json, + headers: response_headers + ) + end + + it 'creates and returns the resource' do + expect(post_create_response).to be_a(GoCardlessPro::Resources::BankAccountHolderVerification) + end + + describe 'retry behaviour' do + before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) } + + it 'retries timeouts' do + stub = stub_request(:post, %r{.*api.gocardless.com/bank_account_holder_verifications}). + to_timeout.then.to_return({ status: 200, headers: response_headers }) + + post_create_response + expect(stub).to have_been_requested.twice + end + + it 'retries 5XX errors' do + stub = stub_request(:post, %r{.*api.gocardless.com/bank_account_holder_verifications}). + to_return({ status: 502, + headers: { 'Content-Type' => 'text/html' }, + body: 'Response from Cloudflare' }). + then.to_return({ status: 200, headers: response_headers }) + + post_create_response + expect(stub).to have_been_requested.twice + end + end + end + + context 'with a request that returns a validation error' do + let(:new_resource) { {} } + + before do + stub_request(:post, %r{.*api.gocardless.com/bank_account_holder_verifications}).to_return( + body: { + error: { + type: 'validation_failed', + code: 422, + errors: [ + { message: 'test error message', field: 'test_field' }, + ], + }, + }.to_json, + headers: response_headers, + status: 422 + ) + end + + it 'throws the correct error' do + expect { post_create_response }.to raise_error(GoCardlessPro::ValidationError) + end + end + + context 'with a request that returns an idempotent creation conflict error' do + let(:id) { 'ID123' } + + let(:new_resource) do + { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + } + end + + let!(:post_stub) do + stub_request(:post, %r{.*api.gocardless.com/bank_account_holder_verifications}).to_return( + body: { + error: { + type: 'invalid_state', + code: 409, + errors: [ + { + message: 'A resource has already been created with this idempotency key', + reason: 'idempotent_creation_conflict', + links: { + conflicting_resource_id: id, + }, + }, + ], + }, + }.to_json, + headers: response_headers, + status: 409 + ) + end + + let!(:get_stub) do + stub_url = "/bank_account_holder_verifications/#{id}" + stub_request(:get, /.*api.gocardless.com#{stub_url}/). + to_return( + body: { + 'bank_account_holder_verifications' => { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + }, + }.to_json, + headers: response_headers + ) + end + + context 'with default behaviour' do + it 'fetches the already-created resource' do + post_create_response + expect(post_stub).to have_been_requested + expect(get_stub).to have_been_requested + end + end + + context 'with on_idempotency_conflict: :raise' do + let(:client) do + GoCardlessPro::Client.new( + access_token: 'SECRET_TOKEN', + on_idempotency_conflict: :raise + ) + end + + it 'raises an IdempotencyConflict error' do + expect { post_create_response }. + to raise_error(GoCardlessPro::IdempotencyConflict) + end + end + end + end + + describe '#get' do + let(:id) { 'ID123' } + + subject(:get_response) { client.bank_account_holder_verifications.get(id) } + + context 'passing in a custom header' do + let!(:stub) do + stub_url = '/bank_account_holder_verifications/:identity'.gsub(':identity', id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/). + with(headers: { 'Foo' => 'Bar' }). + to_return( + body: { + 'bank_account_holder_verifications' => { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + }, + }.to_json, + headers: response_headers + ) + end + + subject(:get_response) do + client.bank_account_holder_verifications.get(id, headers: { + 'Foo' => 'Bar', + }) + end + + it 'includes the header' do + get_response + expect(stub).to have_been_requested + end + end + + context 'when there is a bank_account_holder_verification to return' do + before do + stub_url = '/bank_account_holder_verifications/:identity'.gsub(':identity', id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: { + 'bank_account_holder_verifications' => { + + 'actual_account_name' => 'actual_account_name-input', + 'id' => 'id-input', + 'result' => 'result-input', + 'status' => 'status-input', + 'type' => 'type-input', + }, + }.to_json, + headers: response_headers + ) + end + + it 'wraps the response in a resource' do + expect(get_response).to be_a(GoCardlessPro::Resources::BankAccountHolderVerification) + end + end + + context 'when nothing is returned' do + before do + stub_url = '/bank_account_holder_verifications/:identity'.gsub(':identity', id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: '', + headers: response_headers + ) + end + + it 'returns nil' do + expect(get_response).to be_nil + end + end + + context "when an ID is specified which can't be included in a valid URI" do + let(:id) { '`' } + + it "doesn't raise an error" do + expect { get_response }.to_not raise_error(/bad URI/) + end + end + + describe 'retry behaviour' do + before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) } + + it 'retries timeouts' do + stub_url = '/bank_account_holder_verifications/:identity'.gsub(':identity', id) + + stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/). + to_timeout.then.to_return({ status: 200, headers: response_headers }) + + get_response + expect(stub).to have_been_requested.twice + end + + it 'retries 5XX errors, other than 500s' do + stub_url = '/bank_account_holder_verifications/:identity'.gsub(':identity', id) + + stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/). + to_return({ status: 502, + headers: { 'Content-Type' => 'text/html' }, + body: 'Response from Cloudflare' }). + then.to_return({ status: 200, headers: response_headers }) + + get_response + expect(stub).to have_been_requested.twice + end + + it 'retries 500 errors returned by the API' do + stub_url = '/bank_account_holder_verifications/:identity'.gsub(':identity', id) + + gocardless_error = { + 'error' => { + 'message' => 'Internal server error', + 'documentation_url' => 'https://developer.gocardless.com/#gocardless', + 'errors' => [{ + 'message' => 'Internal server error', + 'reason' => 'internal_server_error', + }], + 'type' => 'gocardless', + 'code' => 500, + 'request_id' => 'dummy_request_id', + 'id' => 'dummy_exception_id', + }, + } + + stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/). + to_return({ status: 500, + headers: response_headers, + body: gocardless_error.to_json }). + then.to_return({ status: 200, headers: response_headers }) + + get_response + expect(stub).to have_been_requested.twice + end + end + end +end From 607bffa510e3268022620e0ae4e986948558b0e1 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Fri, 12 Dec 2025 15:43:21 +0000 Subject: [PATCH 13/23] Changes generated by 66291d1b54f1ab49758943986274f696be6d5d76 This commit was automatically created from gocardless/gocardless-pro-ruby-template@66291d1b54f1ab49758943986274f696be6d5d76 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/20171863771 --- lib/gocardless_pro.rb | 3 + lib/gocardless_pro/client.rb | 5 + .../resources/payment_account.rb | 63 +++++ .../services/payment_accounts_service.rb | 57 ++++ spec/resources/payment_account_spec.rb | 118 +++++++++ .../services/payment_accounts_service_spec.rb | 250 ++++++++++++++++++ 6 files changed, 496 insertions(+) create mode 100644 lib/gocardless_pro/resources/payment_account.rb create mode 100644 lib/gocardless_pro/services/payment_accounts_service.rb create mode 100644 spec/resources/payment_account_spec.rb create mode 100644 spec/services/payment_accounts_service_spec.rb diff --git a/lib/gocardless_pro.rb b/lib/gocardless_pro.rb index da329ce1..80e0ca51 100644 --- a/lib/gocardless_pro.rb +++ b/lib/gocardless_pro.rb @@ -129,6 +129,9 @@ module GoCardlessPro require_relative 'gocardless_pro/resources/payment' require_relative 'gocardless_pro/services/payments_service' +require_relative 'gocardless_pro/resources/payment_account' +require_relative 'gocardless_pro/services/payment_accounts_service' + require_relative 'gocardless_pro/resources/payment_account_transaction' require_relative 'gocardless_pro/services/payment_account_transactions_service' diff --git a/lib/gocardless_pro/client.rb b/lib/gocardless_pro/client.rb index 741e1ab1..01688820 100644 --- a/lib/gocardless_pro/client.rb +++ b/lib/gocardless_pro/client.rb @@ -153,6 +153,11 @@ def payments @payments ||= Services::PaymentsService.new(@api_service) end + # Access to the service for payment_account to make API calls + def payment_accounts + @payment_accounts ||= Services::PaymentAccountsService.new(@api_service) + end + # Access to the service for payment_account_transaction to make API calls def payment_account_transactions @payment_account_transactions ||= Services::PaymentAccountTransactionsService.new(@api_service) diff --git a/lib/gocardless_pro/resources/payment_account.rb b/lib/gocardless_pro/resources/payment_account.rb new file mode 100644 index 00000000..335d08ab --- /dev/null +++ b/lib/gocardless_pro/resources/payment_account.rb @@ -0,0 +1,63 @@ +# +# This client is automatically generated from a template and JSON schema definition. +# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing. +# + +require 'uri' + +module GoCardlessPro + # A module containing classes for each of the resources in the GC Api + module Resources + # Represents an instance of a payment_account resource returned from the API + + # Access the details of bank accounts provided for you by GoCardless that + # are used to fund [Outbound Payments](#core-endpoints-outbound-payments). + class PaymentAccount + attr_reader :account_balance + attr_reader :account_holder_name + attr_reader :account_number_ending + attr_reader :bank_name + attr_reader :currency + attr_reader :id + + # Initialize a payment_account resource instance + # @param object [Hash] an object returned from the API + def initialize(object, response = nil) + @object = object + + @account_balance = object['account_balance'] + @account_holder_name = object['account_holder_name'] + @account_number_ending = object['account_number_ending'] + @bank_name = object['bank_name'] + @currency = object['currency'] + @id = object['id'] + @links = object['links'] + @response = response + end + + def api_response + ApiResponse.new(@response) + end + + # Return the links that the resource has + def links + @payment_account_links ||= Links.new(@links) + end + + # Provides the payment_account resource as a hash of all its readable attributes + def to_h + @object + end + + class Links + def initialize(links) + @links = links || {} + end + + def creditor + @links['creditor'] + end + end + end + end +end diff --git a/lib/gocardless_pro/services/payment_accounts_service.rb b/lib/gocardless_pro/services/payment_accounts_service.rb new file mode 100644 index 00000000..d701d4af --- /dev/null +++ b/lib/gocardless_pro/services/payment_accounts_service.rb @@ -0,0 +1,57 @@ +require_relative './base_service' + +# encoding: utf-8 +# +# This client is automatically generated from a template and JSON schema definition. +# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing. +# + +module GoCardlessPro + module Services + # Service for making requests to the PaymentAccount endpoints + class PaymentAccountsService < BaseService + # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your + # payment accounts. + # Example URL: /payment_accounts + # @param options [Hash] parameters as a hash, under a params key. + def list(options = {}) + path = '/payment_accounts' + + options[:retry_failures] = true + + response = make_request(:get, path, options) + + ListResponse.new( + response: response, + unenveloped_body: unenvelope_body(response.body), + resource_class: Resources::PaymentAccount + ) + end + + # Get a lazily enumerated list of all the items returned. This is similar to the `list` method but will paginate for you automatically. + # + # @param options [Hash] parameters as a hash. If the request is a GET, these will be converted to query parameters. + # Otherwise they will be the body of the request. + def all(options = {}) + Paginator.new( + service: self, + options: options + ).enumerator + end + + private + + # Unenvelope the response of the body using the service's `envelope_key` + # + # @param body [Hash] + def unenvelope_body(body) + body[envelope_key] || body['data'] + end + + # return the key which API responses will envelope data under + def envelope_key + 'payment_accounts' + end + end + end +end diff --git a/spec/resources/payment_account_spec.rb b/spec/resources/payment_account_spec.rb new file mode 100644 index 00000000..96293c1a --- /dev/null +++ b/spec/resources/payment_account_spec.rb @@ -0,0 +1,118 @@ +require 'spec_helper' + +describe GoCardlessPro::Resources::PaymentAccount do + let(:client) do + GoCardlessPro::Client.new( + access_token: 'SECRET_TOKEN' + ) + end + + let(:response_headers) { { 'Content-Type' => 'application/json' } } + + describe '#list' do + describe 'with no filters' do + subject(:get_list_response) { client.payment_accounts.list } + + before do + stub_request(:get, %r{.*api.gocardless.com/payment_accounts}).to_return( + body: { + 'payment_accounts' => [{ + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }], + meta: { + cursors: { + before: nil, + after: 'ABC123', + }, + }, + }.to_json, + headers: response_headers + ) + end + + it 'wraps each item in the resource class' do + expect(get_list_response.records.map do |x| + x.class + end.uniq.first).to eq(GoCardlessPro::Resources::PaymentAccount) + + expect(get_list_response.records.first.account_balance).to eq('account_balance-input') + + expect(get_list_response.records.first.account_holder_name).to eq('account_holder_name-input') + + expect(get_list_response.records.first.account_number_ending).to eq('account_number_ending-input') + + expect(get_list_response.records.first.bank_name).to eq('bank_name-input') + + expect(get_list_response.records.first.currency).to eq('currency-input') + + expect(get_list_response.records.first.id).to eq('id-input') + end + + it 'exposes the cursors for before and after' do + expect(get_list_response.before).to eq(nil) + expect(get_list_response.after).to eq('ABC123') + end + + specify { expect(get_list_response.api_response.headers).to eql('content-type' => 'application/json') } + end + end + + describe '#all' do + let!(:first_response_stub) do + stub_request(:get, %r{.*api.gocardless.com/payment_accounts$}).to_return( + body: { + 'payment_accounts' => [{ + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }], + meta: { + cursors: { after: 'AB345' }, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + end + + let!(:second_response_stub) do + stub_request(:get, %r{.*api.gocardless.com/payment_accounts\?after=AB345}).to_return( + body: { + 'payment_accounts' => [{ + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }], + meta: { + limit: 2, + cursors: {}, + }, + }.to_json, + headers: response_headers + ) + end + + it 'automatically makes the extra requests' do + expect(client.payment_accounts.all.to_a.length).to eq(2) + expect(first_response_stub).to have_been_requested + expect(second_response_stub).to have_been_requested + end + end +end diff --git a/spec/services/payment_accounts_service_spec.rb b/spec/services/payment_accounts_service_spec.rb new file mode 100644 index 00000000..1e95ac85 --- /dev/null +++ b/spec/services/payment_accounts_service_spec.rb @@ -0,0 +1,250 @@ +require 'spec_helper' + +describe GoCardlessPro::Services::PaymentAccountsService do + let(:client) do + GoCardlessPro::Client.new( + access_token: 'SECRET_TOKEN' + ) + end + + let(:response_headers) { { 'Content-Type' => 'application/json' } } + + describe '#list' do + describe 'with no filters' do + subject(:get_list_response) { client.payment_accounts.list } + + let(:body) do + { + 'payment_accounts' => [{ + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }], + meta: { + cursors: { + before: nil, + after: 'ABC123', + }, + }, + }.to_json + end + + before do + stub_request(:get, %r{.*api.gocardless.com/payment_accounts}).to_return( + body: body, + headers: response_headers + ) + end + + it 'wraps each item in the resource class' do + expect(get_list_response.records.map do |x| + x.class + end.uniq.first).to eq(GoCardlessPro::Resources::PaymentAccount) + + expect(get_list_response.records.first.account_balance).to eq('account_balance-input') + + expect(get_list_response.records.first.account_holder_name).to eq('account_holder_name-input') + + expect(get_list_response.records.first.account_number_ending).to eq('account_number_ending-input') + + expect(get_list_response.records.first.bank_name).to eq('bank_name-input') + + expect(get_list_response.records.first.currency).to eq('currency-input') + + expect(get_list_response.records.first.id).to eq('id-input') + end + + it 'exposes the cursors for before and after' do + expect(get_list_response.before).to eq(nil) + expect(get_list_response.after).to eq('ABC123') + end + + specify { expect(get_list_response.api_response.headers).to eql('content-type' => 'application/json') } + + describe 'retry behaviour' do + before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) } + + it 'retries timeouts' do + stub = stub_request(:get, %r{.*api.gocardless.com/payment_accounts}). + to_timeout.then.to_return({ status: 200, headers: response_headers, body: body }) + + get_list_response + expect(stub).to have_been_requested.twice + end + + it 'retries 5XX errors' do + stub = stub_request(:get, %r{.*api.gocardless.com/payment_accounts}). + to_return({ status: 502, + headers: { 'Content-Type' => 'text/html' }, + body: 'Response from Cloudflare' }). + then.to_return({ status: 200, headers: response_headers, body: body }) + + get_list_response + expect(stub).to have_been_requested.twice + end + end + end + end + + describe '#all' do + let!(:first_response_stub) do + stub_request(:get, %r{.*api.gocardless.com/payment_accounts$}).to_return( + body: { + 'payment_accounts' => [{ + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }], + meta: { + cursors: { after: 'AB345' }, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + end + + let!(:second_response_stub) do + stub_request(:get, %r{.*api.gocardless.com/payment_accounts\?after=AB345}).to_return( + body: { + 'payment_accounts' => [{ + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }], + meta: { + limit: 2, + cursors: {}, + }, + }.to_json, + headers: response_headers + ) + end + + it 'automatically makes the extra requests' do + expect(client.payment_accounts.all.to_a.length).to eq(2) + expect(first_response_stub).to have_been_requested + expect(second_response_stub).to have_been_requested + end + + describe 'retry behaviour' do + before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) } + + it 'retries timeouts' do + first_response_stub = stub_request(:get, %r{.*api.gocardless.com/payment_accounts$}).to_return( + body: { + 'payment_accounts' => [{ + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }], + meta: { + cursors: { after: 'AB345' }, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + + second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payment_accounts\?after=AB345}). + to_timeout.then. + to_return( + body: { + 'payment_accounts' => [{ + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }], + meta: { + limit: 2, + cursors: {}, + }, + }.to_json, + headers: response_headers + ) + + client.payment_accounts.all.to_a + + expect(first_response_stub).to have_been_requested + expect(second_response_stub).to have_been_requested.twice + end + + it 'retries 5XX errors' do + first_response_stub = stub_request(:get, %r{.*api.gocardless.com/payment_accounts$}).to_return( + body: { + 'payment_accounts' => [{ + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }], + meta: { + cursors: { after: 'AB345' }, + limit: 1, + }, + }.to_json, + headers: response_headers + ) + + second_response_stub = stub_request(:get, %r{.*api.gocardless.com/payment_accounts\?after=AB345}). + to_return( + status: 502, + body: 'Response from Cloudflare', + headers: { 'Content-Type' => 'text/html' } + ).then.to_return( + body: { + 'payment_accounts' => [{ + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }], + meta: { + limit: 2, + cursors: {}, + }, + }.to_json, + headers: response_headers + ) + + client.payment_accounts.all.to_a + + expect(first_response_stub).to have_been_requested + expect(second_response_stub).to have_been_requested.twice + end + end + end +end From 0b4c52399d920d4380dabb37c1381720d571dfa4 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:15:38 +0000 Subject: [PATCH 14/23] Changes generated by 67dd3bbd646ad34e2a6f0f07ea206c0ee0a08699 This commit was automatically created from gocardless/gocardless-pro-ruby-template@67dd3bbd646ad34e2a6f0f07ea206c0ee0a08699 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/20172748042 --- .../services/outbound_payments_service.rb | 15 ++++ spec/resources/outbound_payment_spec.rb | 75 ++++++++++++++++ .../outbound_payments_service_spec.rb | 86 +++++++++++++++++++ 3 files changed, 176 insertions(+) diff --git a/lib/gocardless_pro/services/outbound_payments_service.rb b/lib/gocardless_pro/services/outbound_payments_service.rb index d0b00a1b..a459cae1 100644 --- a/lib/gocardless_pro/services/outbound_payments_service.rb +++ b/lib/gocardless_pro/services/outbound_payments_service.rb @@ -234,6 +234,21 @@ def update(identity, options = {}) Resources::OutboundPayment.new(unenvelope_body(response.body), response) end + # Retrieve aggregate statistics on outbound payments. + # Example URL: /outbound_payments/stats + # @param options [Hash] parameters as a hash, under a params key. + def stats(options = {}) + path = '/outbound_payments/stats' + + options[:retry_failures] = false + + response = make_request(:get, path, options) + + return if response.body.nil? + + Resources::OutboundPayment.new(unenvelope_body(response.body), response) + end + private # Unenvelope the response of the body using the service's `envelope_key` diff --git a/spec/resources/outbound_payment_spec.rb b/spec/resources/outbound_payment_spec.rb index 130ff166..59b73238 100644 --- a/spec/resources/outbound_payment_spec.rb +++ b/spec/resources/outbound_payment_spec.rb @@ -689,4 +689,79 @@ end end end + + describe '#stats' do + subject(:get_response) { client.outbound_payments.stats } + + let(:resource_id) { 'ABC123' } + + let!(:stub) do + # /outbound_payments/stats + stub_url = '/outbound_payments/stats'.gsub(':identity', resource_id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: { + 'outbound_payments' => { + + 'amount' => 'amount-input', + 'created_at' => 'created_at-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'execution_date' => 'execution_date-input', + 'id' => 'id-input', + 'is_withdrawal' => 'is_withdrawal-input', + 'links' => 'links-input', + 'metadata' => 'metadata-input', + 'reference' => 'reference-input', + 'scheme' => 'scheme-input', + 'status' => 'status-input', + 'verifications' => 'verifications-input', + }, + }.to_json, + + headers: response_headers + ) + end + + it 'wraps the response and calls the right endpoint' do + expect(get_response).to be_a(GoCardlessPro::Resources::OutboundPayment) + + expect(stub).to have_been_requested + end + + context 'when the request needs a body and custom header' do + subject(:get_response) { client.outbound_payments.stats(body, headers) } + + let(:resource_id) { 'ABC123' } + + let!(:stub) do + # /outbound_payments/stats + stub_url = '/outbound_payments/stats'.gsub(':identity', resource_id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/). + with( + body: { foo: 'bar' }, + headers: { 'Foo' => 'Bar' } + ).to_return( + body: { + 'outbound_payments' => { + + 'amount' => 'amount-input', + 'created_at' => 'created_at-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'execution_date' => 'execution_date-input', + 'id' => 'id-input', + 'is_withdrawal' => 'is_withdrawal-input', + 'links' => 'links-input', + 'metadata' => 'metadata-input', + 'reference' => 'reference-input', + 'scheme' => 'scheme-input', + 'status' => 'status-input', + 'verifications' => 'verifications-input', + }, + }.to_json, + headers: response_headers + ) + end + end + end end diff --git a/spec/services/outbound_payments_service_spec.rb b/spec/services/outbound_payments_service_spec.rb index d5af3ba5..f291f578 100644 --- a/spec/services/outbound_payments_service_spec.rb +++ b/spec/services/outbound_payments_service_spec.rb @@ -997,4 +997,90 @@ end end end + + describe '#stats' do + subject(:get_response) { client.outbound_payments.stats } + + let(:resource_id) { 'ABC123' } + + let!(:stub) do + # /outbound_payments/stats + stub_url = '/outbound_payments/stats'.gsub(':identity', resource_id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: { + 'outbound_payments' => { + + 'amount' => 'amount-input', + 'created_at' => 'created_at-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'execution_date' => 'execution_date-input', + 'id' => 'id-input', + 'is_withdrawal' => 'is_withdrawal-input', + 'links' => 'links-input', + 'metadata' => 'metadata-input', + 'reference' => 'reference-input', + 'scheme' => 'scheme-input', + 'status' => 'status-input', + 'verifications' => 'verifications-input', + }, + }.to_json, + + headers: response_headers + ) + end + + it 'wraps the response and calls the right endpoint' do + expect(get_response).to be_a(GoCardlessPro::Resources::OutboundPayment) + + expect(stub).to have_been_requested + end + + describe 'retry behaviour' do + it "doesn't retry errors" do + stub_url = '/outbound_payments/stats'.gsub(':identity', resource_id) + stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/). + to_timeout + + expect { get_response }.to raise_error(Faraday::ConnectionFailed) + expect(stub).to have_been_requested + end + end + + context 'when the request needs a body and custom header' do + subject(:get_response) { client.outbound_payments.stats(body, headers) } + + let(:resource_id) { 'ABC123' } + + let!(:stub) do + # /outbound_payments/stats + stub_url = '/outbound_payments/stats'.gsub(':identity', resource_id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/). + with( + body: { foo: 'bar' }, + headers: { 'Foo' => 'Bar' } + ).to_return( + body: { + 'outbound_payments' => { + + 'amount' => 'amount-input', + 'created_at' => 'created_at-input', + 'currency' => 'currency-input', + 'description' => 'description-input', + 'execution_date' => 'execution_date-input', + 'id' => 'id-input', + 'is_withdrawal' => 'is_withdrawal-input', + 'links' => 'links-input', + 'metadata' => 'metadata-input', + 'reference' => 'reference-input', + 'scheme' => 'scheme-input', + 'status' => 'status-input', + 'verifications' => 'verifications-input', + }, + }.to_json, + headers: response_headers + ) + end + end + end end From c61467e823cf8d0553f45f51a93e9fea1d023f6f Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Fri, 12 Dec 2025 17:08:55 +0000 Subject: [PATCH 15/23] Changes generated by b0aa6f7cdc8a445ae988d764696bb5809d363a79 This commit was automatically created from gocardless/gocardless-pro-ruby-template@b0aa6f7cdc8a445ae988d764696bb5809d363a79 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/20174147330 --- .../services/payment_accounts_service.rb | 19 +++ spec/resources/payment_account_spec.rb | 87 +++++++++++ .../services/payment_accounts_service_spec.rb | 142 ++++++++++++++++++ 3 files changed, 248 insertions(+) diff --git a/lib/gocardless_pro/services/payment_accounts_service.rb b/lib/gocardless_pro/services/payment_accounts_service.rb index d701d4af..c586ad69 100644 --- a/lib/gocardless_pro/services/payment_accounts_service.rb +++ b/lib/gocardless_pro/services/payment_accounts_service.rb @@ -10,6 +10,25 @@ module GoCardlessPro module Services # Service for making requests to the PaymentAccount endpoints class PaymentAccountsService < BaseService + # Retrieves the details of an existing payment account. + # Example URL: /payment_accounts/:identity + # + # @param identity # Unique identifier, beginning with "BA". + # @param options [Hash] parameters as a hash, under a params key. + def get(identity, options = {}) + path = sub_url('/payment_accounts/:identity', { + 'identity' => identity, + }) + + options[:retry_failures] = true + + response = make_request(:get, path, options) + + return if response.body.nil? + + Resources::PaymentAccount.new(unenvelope_body(response.body), response) + end + # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your # payment accounts. # Example URL: /payment_accounts diff --git a/spec/resources/payment_account_spec.rb b/spec/resources/payment_account_spec.rb index 96293c1a..b6654b54 100644 --- a/spec/resources/payment_account_spec.rb +++ b/spec/resources/payment_account_spec.rb @@ -9,6 +9,93 @@ let(:response_headers) { { 'Content-Type' => 'application/json' } } + describe '#get' do + let(:id) { 'ID123' } + + subject(:get_response) { client.payment_accounts.get(id) } + + context 'passing in a custom header' do + let!(:stub) do + stub_url = '/payment_accounts/:identity'.gsub(':identity', id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/). + with(headers: { 'Foo' => 'Bar' }). + to_return( + body: { + 'payment_accounts' => { + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }, + }.to_json, + headers: response_headers + ) + end + + subject(:get_response) do + client.payment_accounts.get(id, headers: { + 'Foo' => 'Bar', + }) + end + + it 'includes the header' do + get_response + expect(stub).to have_been_requested + end + end + + context 'when there is a payment_account to return' do + before do + stub_url = '/payment_accounts/:identity'.gsub(':identity', id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: { + 'payment_accounts' => { + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }, + }.to_json, + headers: response_headers + ) + end + + it 'wraps the response in a resource' do + expect(get_response).to be_a(GoCardlessPro::Resources::PaymentAccount) + end + end + + context 'when nothing is returned' do + before do + stub_url = '/payment_accounts/:identity'.gsub(':identity', id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: '', + headers: response_headers + ) + end + + it 'returns nil' do + expect(get_response).to be_nil + end + end + + context "when an ID is specified which can't be included in a valid URI" do + let(:id) { '`' } + + it "doesn't raise an error" do + expect { get_response }.to_not raise_error(/bad URI/) + end + end + end + describe '#list' do describe 'with no filters' do subject(:get_list_response) { client.payment_accounts.list } diff --git a/spec/services/payment_accounts_service_spec.rb b/spec/services/payment_accounts_service_spec.rb index 1e95ac85..c3c7f0f2 100644 --- a/spec/services/payment_accounts_service_spec.rb +++ b/spec/services/payment_accounts_service_spec.rb @@ -9,6 +9,148 @@ let(:response_headers) { { 'Content-Type' => 'application/json' } } + describe '#get' do + let(:id) { 'ID123' } + + subject(:get_response) { client.payment_accounts.get(id) } + + context 'passing in a custom header' do + let!(:stub) do + stub_url = '/payment_accounts/:identity'.gsub(':identity', id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/). + with(headers: { 'Foo' => 'Bar' }). + to_return( + body: { + 'payment_accounts' => { + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }, + }.to_json, + headers: response_headers + ) + end + + subject(:get_response) do + client.payment_accounts.get(id, headers: { + 'Foo' => 'Bar', + }) + end + + it 'includes the header' do + get_response + expect(stub).to have_been_requested + end + end + + context 'when there is a payment_account to return' do + before do + stub_url = '/payment_accounts/:identity'.gsub(':identity', id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: { + 'payment_accounts' => { + + 'account_balance' => 'account_balance-input', + 'account_holder_name' => 'account_holder_name-input', + 'account_number_ending' => 'account_number_ending-input', + 'bank_name' => 'bank_name-input', + 'currency' => 'currency-input', + 'id' => 'id-input', + 'links' => 'links-input', + }, + }.to_json, + headers: response_headers + ) + end + + it 'wraps the response in a resource' do + expect(get_response).to be_a(GoCardlessPro::Resources::PaymentAccount) + end + end + + context 'when nothing is returned' do + before do + stub_url = '/payment_accounts/:identity'.gsub(':identity', id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: '', + headers: response_headers + ) + end + + it 'returns nil' do + expect(get_response).to be_nil + end + end + + context "when an ID is specified which can't be included in a valid URI" do + let(:id) { '`' } + + it "doesn't raise an error" do + expect { get_response }.to_not raise_error(/bad URI/) + end + end + + describe 'retry behaviour' do + before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) } + + it 'retries timeouts' do + stub_url = '/payment_accounts/:identity'.gsub(':identity', id) + + stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/). + to_timeout.then.to_return({ status: 200, headers: response_headers }) + + get_response + expect(stub).to have_been_requested.twice + end + + it 'retries 5XX errors, other than 500s' do + stub_url = '/payment_accounts/:identity'.gsub(':identity', id) + + stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/). + to_return({ status: 502, + headers: { 'Content-Type' => 'text/html' }, + body: 'Response from Cloudflare' }). + then.to_return({ status: 200, headers: response_headers }) + + get_response + expect(stub).to have_been_requested.twice + end + + it 'retries 500 errors returned by the API' do + stub_url = '/payment_accounts/:identity'.gsub(':identity', id) + + gocardless_error = { + 'error' => { + 'message' => 'Internal server error', + 'documentation_url' => 'https://developer.gocardless.com/#gocardless', + 'errors' => [{ + 'message' => 'Internal server error', + 'reason' => 'internal_server_error', + }], + 'type' => 'gocardless', + 'code' => 500, + 'request_id' => 'dummy_request_id', + 'id' => 'dummy_exception_id', + }, + } + + stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/). + to_return({ status: 500, + headers: response_headers, + body: gocardless_error.to_json }). + then.to_return({ status: 200, headers: response_headers }) + + get_response + expect(stub).to have_been_requested.twice + end + end + end + describe '#list' do describe 'with no filters' do subject(:get_list_response) { client.payment_accounts.list } From 4c5b81f3dc72126a870aca4319e3c3caadf145e5 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Thu, 18 Dec 2025 17:36:35 +0000 Subject: [PATCH 16/23] Changes generated by e73ab60a6fcee9426568bee24344ba0b9da1adb9 This commit was automatically created from gocardless/gocardless-pro-ruby-template@e73ab60a6fcee9426568bee24344ba0b9da1adb9 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/20345599061 --- lib/gocardless_pro/resources/outbound_payment.rb | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/lib/gocardless_pro/resources/outbound_payment.rb b/lib/gocardless_pro/resources/outbound_payment.rb index 95275554..f68a8fb5 100644 --- a/lib/gocardless_pro/resources/outbound_payment.rb +++ b/lib/gocardless_pro/resources/outbound_payment.rb @@ -15,6 +15,17 @@ module Resources # # GoCardless will notify you via a [webhook](#appendix-webhooks) when the # status of the outbound payment [changes](#event-types-outbound-payment). + # + # ####Rate limiting + # + # Two rate limits apply to the Outbound Payments APIs: + # - All POST Outbound Payment endpoints (create, withdraw, approve, cancel + # and etc.) share a single rate-limit group of 300 requests per minute. As + # initiating a payment typically requires two API calls (one to create the + # payment and one to approve it), this allows you to add approximately 150 + # outbound payments per minute. + # - All remaining Outbound Payment endpoints are limited to 500 requests per + # minute. class OutboundPayment attr_reader :amount attr_reader :created_at From ebe54e404bad4b02445c6ec8fed303858f0a424b Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Wed, 31 Dec 2025 16:15:35 +0000 Subject: [PATCH 17/23] Changes generated by cb7854a7c813404c7f8ef88a71de9dafd8f862a0 This commit was automatically created from gocardless/gocardless-pro-ruby-template@cb7854a7c813404c7f8ef88a71de9dafd8f862a0 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/20622741498 --- .../middlewares/raise_gocardless_errors.rb | 8 ++++++++ spec/middlewares/raise_gocardless_errors_spec.rb | 11 +++++++++++ 2 files changed, 19 insertions(+) diff --git a/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb b/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb index d31dbc82..fc691458 100644 --- a/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb +++ b/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb @@ -13,6 +13,13 @@ def on_complete(env) return unless CLIENT_ERROR_STATUSES.include?(env.status) json_body ||= JSON.parse(env.body) unless env.body.empty? + if json_body['error'].is_a?(String) + # Some errors are returned as string rather than objects, wrap in standard format + json_body['error'] = { + 'message' => json_body['error'], + 'status' => env.status, + } + end error_type = json_body['error']['type'] error_class = error_class_for_status(env.status) || error_class_for_type(error_type) @@ -24,6 +31,7 @@ def on_complete(env) def error_class_for_status(code) { + 400 => GoCardlessPro::InvalidApiUsageError, 401 => GoCardlessPro::AuthenticationError, 403 => GoCardlessPro::PermissionError, 429 => GoCardlessPro::RateLimitError, diff --git a/spec/middlewares/raise_gocardless_errors_spec.rb b/spec/middlewares/raise_gocardless_errors_spec.rb index 5adb4e46..de1cfa2d 100644 --- a/spec/middlewares/raise_gocardless_errors_spec.rb +++ b/spec/middlewares/raise_gocardless_errors_spec.rb @@ -123,5 +123,16 @@ to raise_error(GoCardlessPro::InvalidStateError) end end + + context 'for an unwrapped string error' do + let(:status) { 400 } + let(:body) { { error: 'unwrapped error' }.to_json } + it 'raises a wrapped error' do + expect { connection.post('https://api.gocardless.com/widgets') }. + to raise_error(GoCardlessPro::InvalidApiUsageError) do |error| + expect(error).to have_attributes({ message: 'unwrapped error' }) + end + end + end end end From 5e29d0052057716d2a73b984ae001f17dedcf329 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Wed, 31 Dec 2025 16:39:14 +0000 Subject: [PATCH 18/23] Changes generated by 8f25127f8e34d5f66c0ed88260939c8a67a90a73 This commit was automatically created from gocardless/gocardless-pro-ruby-template@8f25127f8e34d5f66c0ed88260939c8a67a90a73 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/20623108507 --- lib/gocardless_pro/client.rb | 2 +- lib/gocardless_pro/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gocardless_pro/client.rb b/lib/gocardless_pro/client.rb index 01688820..f15e1766 100644 --- a/lib/gocardless_pro/client.rb +++ b/lib/gocardless_pro/client.rb @@ -268,7 +268,7 @@ def default_options 'User-Agent' => "#{user_agent}", 'Content-Type' => 'application/json', 'GoCardless-Client-Library' => 'gocardless-pro-ruby', - 'GoCardless-Client-Version' => '4.2.0', + 'GoCardless-Client-Version' => '4.2.1', }, } end diff --git a/lib/gocardless_pro/version.rb b/lib/gocardless_pro/version.rb index 9f6a1651..ee044f6e 100644 --- a/lib/gocardless_pro/version.rb +++ b/lib/gocardless_pro/version.rb @@ -3,5 +3,5 @@ module GoCardlessPro module GoCardlessPro # Current version of the GC gem - VERSION = '4.2.0' + VERSION = '4.2.1' end From 4910cd42524eec066086db3a08dcf374b7b7c3c9 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Mon, 12 Jan 2026 17:24:46 +0000 Subject: [PATCH 19/23] Changes generated by b9772b070039846a4bf837d8ad72675a62f64574 This commit was automatically created from gocardless/gocardless-pro-ruby-template@b9772b070039846a4bf837d8ad72675a62f64574 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/20928583223 --- lib/gocardless_pro/resources/event.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/gocardless_pro/resources/event.rb b/lib/gocardless_pro/resources/event.rb index 22e15a18..a742f061 100644 --- a/lib/gocardless_pro/resources/event.rb +++ b/lib/gocardless_pro/resources/event.rb @@ -116,6 +116,10 @@ def organisation @links['organisation'] end + def outbound_payment + @links['outbound_payment'] + end + def parent_event @links['parent_event'] end From e240585b4677b502a59fbd5b18cd673cef2e6fa0 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Wed, 21 Jan 2026 11:21:31 +0000 Subject: [PATCH 20/23] Changes generated by a3bb22b0d776f8d24f4937b977fb4808aa3d3929 This commit was automatically created from gocardless/gocardless-pro-ruby-template@a3bb22b0d776f8d24f4937b977fb4808aa3d3929 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/21207616893 --- lib/gocardless_pro.rb | 3 + lib/gocardless_pro/client.rb | 5 ++ .../resources/funds_availability.rb | 38 ++++++++++ .../services/funds_availabilities_service.rb | 50 +++++++++++++ spec/resources/funds_availability_spec.rb | 64 ++++++++++++++++ .../funds_availabilities_service_spec.rb | 75 +++++++++++++++++++ 6 files changed, 235 insertions(+) create mode 100644 lib/gocardless_pro/resources/funds_availability.rb create mode 100644 lib/gocardless_pro/services/funds_availabilities_service.rb create mode 100644 spec/resources/funds_availability_spec.rb create mode 100644 spec/services/funds_availabilities_service_spec.rb diff --git a/lib/gocardless_pro.rb b/lib/gocardless_pro.rb index 80e0ca51..4258c51e 100644 --- a/lib/gocardless_pro.rb +++ b/lib/gocardless_pro.rb @@ -93,6 +93,9 @@ module GoCardlessPro require_relative 'gocardless_pro/resources/export' require_relative 'gocardless_pro/services/exports_service' +require_relative 'gocardless_pro/resources/funds_availability' +require_relative 'gocardless_pro/services/funds_availabilities_service' + require_relative 'gocardless_pro/resources/instalment_schedule' require_relative 'gocardless_pro/services/instalment_schedules_service' diff --git a/lib/gocardless_pro/client.rb b/lib/gocardless_pro/client.rb index f15e1766..deb88080 100644 --- a/lib/gocardless_pro/client.rb +++ b/lib/gocardless_pro/client.rb @@ -93,6 +93,11 @@ def exports @exports ||= Services::ExportsService.new(@api_service) end + # Access to the service for funds_availability to make API calls + def funds_availabilities + @funds_availabilities ||= Services::FundsAvailabilitiesService.new(@api_service) + end + # Access to the service for instalment_schedule to make API calls def instalment_schedules @instalment_schedules ||= Services::InstalmentSchedulesService.new(@api_service) diff --git a/lib/gocardless_pro/resources/funds_availability.rb b/lib/gocardless_pro/resources/funds_availability.rb new file mode 100644 index 00000000..aeeb0041 --- /dev/null +++ b/lib/gocardless_pro/resources/funds_availability.rb @@ -0,0 +1,38 @@ +# +# This client is automatically generated from a template and JSON schema definition. +# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing. +# + +require 'uri' + +module GoCardlessPro + # A module containing classes for each of the resources in the GC Api + module Resources + # Represents an instance of a funds_availability resource returned from the API + + # Checks if the payer's current balance is sufficient to cover the amount + # the merchant wants to charge within the consent parameters defined on the + # mandate. + class FundsAvailability + attr_reader :available + + # Initialize a funds_availability resource instance + # @param object [Hash] an object returned from the API + def initialize(object, response = nil) + @object = object + + @available = object['available'] + @response = response + end + + def api_response + ApiResponse.new(@response) + end + + # Provides the funds_availability resource as a hash of all its readable attributes + def to_h + @object + end + end + end +end diff --git a/lib/gocardless_pro/services/funds_availabilities_service.rb b/lib/gocardless_pro/services/funds_availabilities_service.rb new file mode 100644 index 00000000..f87fb4a6 --- /dev/null +++ b/lib/gocardless_pro/services/funds_availabilities_service.rb @@ -0,0 +1,50 @@ +require_relative './base_service' + +# encoding: utf-8 +# +# This client is automatically generated from a template and JSON schema definition. +# See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing. +# + +module GoCardlessPro + module Services + # Service for making requests to the FundsAvailability endpoints + class FundsAvailabilitiesService < BaseService + # Checks if the payer's current balance is sufficient to cover the amount + # the merchant wants to charge within the consent parameters defined on the + # mandate. + # Example URL: /funds_availability/:identity + # + # @param identity # Unique identifier, beginning with "MD". Note that this prefix may not + # apply to mandates created before 2016. + # @param options [Hash] parameters as a hash, under a params key. + def check(identity, options = {}) + path = sub_url('/funds_availability/:identity', { + 'identity' => identity, + }) + + options[:retry_failures] = false + + response = make_request(:get, path, options) + + return if response.body.nil? + + Resources::FundsAvailability.new(unenvelope_body(response.body), response) + end + + private + + # Unenvelope the response of the body using the service's `envelope_key` + # + # @param body [Hash] + def unenvelope_body(body) + body[envelope_key] || body['data'] + end + + # return the key which API responses will envelope data under + def envelope_key + 'funds_availability' + end + end + end +end diff --git a/spec/resources/funds_availability_spec.rb b/spec/resources/funds_availability_spec.rb new file mode 100644 index 00000000..c94bdce5 --- /dev/null +++ b/spec/resources/funds_availability_spec.rb @@ -0,0 +1,64 @@ +require 'spec_helper' + +describe GoCardlessPro::Resources::FundsAvailability do + let(:client) do + GoCardlessPro::Client.new( + access_token: 'SECRET_TOKEN' + ) + end + + let(:response_headers) { { 'Content-Type' => 'application/json' } } + + describe '#check' do + subject(:get_response) { client.funds_availabilities.check(resource_id) } + + let(:resource_id) { 'ABC123' } + + let!(:stub) do + # /funds_availability/%v + stub_url = '/funds_availability/:identity'.gsub(':identity', resource_id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: { + 'funds_availability' => { + + 'available' => 'available-input', + }, + }.to_json, + + headers: response_headers + ) + end + + it 'wraps the response and calls the right endpoint' do + expect(get_response).to be_a(GoCardlessPro::Resources::FundsAvailability) + + expect(stub).to have_been_requested + end + + context 'when the request needs a body and custom header' do + let(:body) { { foo: 'bar' } } + let(:headers) { { 'Foo' => 'Bar' } } + subject(:get_response) { client.funds_availabilities.check(resource_id, body, headers) } + + let(:resource_id) { 'ABC123' } + + let!(:stub) do + # /funds_availability/%v + stub_url = '/funds_availability/:identity'.gsub(':identity', resource_id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/). + with( + body: { foo: 'bar' }, + headers: { 'Foo' => 'Bar' } + ).to_return( + body: { + 'funds_availability' => { + + 'available' => 'available-input', + }, + }.to_json, + headers: response_headers + ) + end + end + end +end diff --git a/spec/services/funds_availabilities_service_spec.rb b/spec/services/funds_availabilities_service_spec.rb new file mode 100644 index 00000000..f5661653 --- /dev/null +++ b/spec/services/funds_availabilities_service_spec.rb @@ -0,0 +1,75 @@ +require 'spec_helper' + +describe GoCardlessPro::Services::FundsAvailabilitiesService do + let(:client) do + GoCardlessPro::Client.new( + access_token: 'SECRET_TOKEN' + ) + end + + let(:response_headers) { { 'Content-Type' => 'application/json' } } + + describe '#check' do + subject(:get_response) { client.funds_availabilities.check(resource_id) } + + let(:resource_id) { 'ABC123' } + + let!(:stub) do + # /funds_availability/%v + stub_url = '/funds_availability/:identity'.gsub(':identity', resource_id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/).to_return( + body: { + 'funds_availability' => { + + 'available' => 'available-input', + }, + }.to_json, + + headers: response_headers + ) + end + + it 'wraps the response and calls the right endpoint' do + expect(get_response).to be_a(GoCardlessPro::Resources::FundsAvailability) + + expect(stub).to have_been_requested + end + + describe 'retry behaviour' do + it "doesn't retry errors" do + stub_url = '/funds_availability/:identity'.gsub(':identity', resource_id) + stub = stub_request(:get, /.*api.gocardless.com#{stub_url}/). + to_timeout + + expect { get_response }.to raise_error(Faraday::ConnectionFailed) + expect(stub).to have_been_requested + end + end + + context 'when the request needs a body and custom header' do + let(:body) { { foo: 'bar' } } + let(:headers) { { 'Foo' => 'Bar' } } + subject(:get_response) { client.funds_availabilities.check(resource_id, body, headers) } + + let(:resource_id) { 'ABC123' } + + let!(:stub) do + # /funds_availability/%v + stub_url = '/funds_availability/:identity'.gsub(':identity', resource_id) + stub_request(:get, /.*api.gocardless.com#{stub_url}/). + with( + body: { foo: 'bar' }, + headers: { 'Foo' => 'Bar' } + ).to_return( + body: { + 'funds_availability' => { + + 'available' => 'available-input', + }, + }.to_json, + headers: response_headers + ) + end + end + end +end From 1b85a088d31565a6fae6eaa5087e3f653e0f46ba Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Wed, 28 Jan 2026 16:22:53 +0000 Subject: [PATCH 21/23] Changes generated by 32268f58ef9056651a721fc3e05b59146d36ec87 This commit was automatically created from gocardless/gocardless-pro-ruby-template@32268f58ef9056651a721fc3e05b59146d36ec87 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/21446192512 --- .../resources/billing_request.rb | 4 ++ spec/resources/billing_request_spec.rb | 60 ++++++++++++++++ .../services/billing_requests_service_spec.rb | 68 +++++++++++++++++++ 3 files changed, 132 insertions(+) diff --git a/lib/gocardless_pro/resources/billing_request.rb b/lib/gocardless_pro/resources/billing_request.rb index bd0e098d..d4261e76 100644 --- a/lib/gocardless_pro/resources/billing_request.rb +++ b/lib/gocardless_pro/resources/billing_request.rb @@ -30,6 +30,8 @@ class BillingRequest attr_reader :instalment_schedule_request attr_reader :mandate_request attr_reader :metadata + attr_reader :payment_context_code + attr_reader :payment_purpose_code attr_reader :payment_request attr_reader :purpose_code attr_reader :resources @@ -50,6 +52,8 @@ def initialize(object, response = nil) @links = object['links'] @mandate_request = object['mandate_request'] @metadata = object['metadata'] + @payment_context_code = object['payment_context_code'] + @payment_purpose_code = object['payment_purpose_code'] @payment_request = object['payment_request'] @purpose_code = object['purpose_code'] @resources = object['resources'] diff --git a/spec/resources/billing_request_spec.rb b/spec/resources/billing_request_spec.rb index a5fdf641..99085f6c 100644 --- a/spec/resources/billing_request_spec.rb +++ b/spec/resources/billing_request_spec.rb @@ -24,6 +24,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -47,6 +49,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -70,6 +74,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -126,6 +132,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -172,6 +180,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -212,6 +222,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -257,6 +269,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -291,6 +305,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -336,6 +352,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -370,6 +388,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -415,6 +435,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -449,6 +471,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -494,6 +518,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -528,6 +554,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -573,6 +601,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -604,6 +634,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -642,6 +674,10 @@ expect(get_list_response.records.first.metadata).to eq('metadata-input') + expect(get_list_response.records.first.payment_context_code).to eq('payment_context_code-input') + + expect(get_list_response.records.first.payment_purpose_code).to eq('payment_purpose_code-input') + expect(get_list_response.records.first.payment_request).to eq('payment_request-input') expect(get_list_response.records.first.purpose_code).to eq('purpose_code-input') @@ -677,6 +713,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -706,6 +744,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -751,6 +791,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -790,6 +832,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -850,6 +894,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -895,6 +941,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -929,6 +977,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -974,6 +1024,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1008,6 +1060,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1053,6 +1107,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1087,6 +1143,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1132,6 +1190,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', diff --git a/spec/services/billing_requests_service_spec.rb b/spec/services/billing_requests_service_spec.rb index 0c2236e8..b995aa9f 100644 --- a/spec/services/billing_requests_service_spec.rb +++ b/spec/services/billing_requests_service_spec.rb @@ -24,6 +24,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -47,6 +49,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -70,6 +74,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -149,6 +155,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -195,6 +203,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -251,6 +261,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -307,6 +319,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -341,6 +355,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -397,6 +413,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -431,6 +449,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -487,6 +507,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -521,6 +543,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -577,6 +601,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -611,6 +637,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -667,6 +695,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -697,6 +727,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -740,6 +772,10 @@ expect(get_list_response.records.first.metadata).to eq('metadata-input') + expect(get_list_response.records.first.payment_context_code).to eq('payment_context_code-input') + + expect(get_list_response.records.first.payment_purpose_code).to eq('payment_purpose_code-input') + expect(get_list_response.records.first.payment_request).to eq('payment_request-input') expect(get_list_response.records.first.purpose_code).to eq('purpose_code-input') @@ -798,6 +834,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -827,6 +865,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -865,6 +905,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -894,6 +936,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -928,6 +972,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -960,6 +1006,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1005,6 +1053,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1044,6 +1094,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1159,6 +1211,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1215,6 +1269,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1249,6 +1305,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1305,6 +1363,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1339,6 +1399,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1395,6 +1457,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1429,6 +1493,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', @@ -1485,6 +1551,8 @@ 'links' => 'links-input', 'mandate_request' => 'mandate_request-input', 'metadata' => 'metadata-input', + 'payment_context_code' => 'payment_context_code-input', + 'payment_purpose_code' => 'payment_purpose_code-input', 'payment_request' => 'payment_request-input', 'purpose_code' => 'purpose_code-input', 'resources' => 'resources-input', From 0eb0a73fc53d0e2e663bc971afa990c710a8bcb8 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Sat, 31 Jan 2026 16:01:18 +0000 Subject: [PATCH 22/23] Changes generated by ff825b1576a6fa823f60d2b7c2d64e34d10e56d2 This commit was automatically created from gocardless/gocardless-pro-ruby-template@ff825b1576a6fa823f60d2b7c2d64e34d10e56d2 by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/21547032707 --- lib/gocardless_pro/client.rb | 2 +- lib/gocardless_pro/version.rb | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gocardless_pro/client.rb b/lib/gocardless_pro/client.rb index deb88080..6a1de3ab 100644 --- a/lib/gocardless_pro/client.rb +++ b/lib/gocardless_pro/client.rb @@ -273,7 +273,7 @@ def default_options 'User-Agent' => "#{user_agent}", 'Content-Type' => 'application/json', 'GoCardless-Client-Library' => 'gocardless-pro-ruby', - 'GoCardless-Client-Version' => '4.2.1', + 'GoCardless-Client-Version' => '4.3.0', }, } end diff --git a/lib/gocardless_pro/version.rb b/lib/gocardless_pro/version.rb index ee044f6e..12de3668 100644 --- a/lib/gocardless_pro/version.rb +++ b/lib/gocardless_pro/version.rb @@ -3,5 +3,5 @@ module GoCardlessPro module GoCardlessPro # Current version of the GC gem - VERSION = '4.2.1' + VERSION = '4.3.0' end From e1df31766d5c4398d0ef4ed444ace7bd4428d6d3 Mon Sep 17 00:00:00 2001 From: "gocardless-ci-robot[bot]" <123969075+gocardless-ci-robot[bot]@users.noreply.github.com> Date: Fri, 13 Feb 2026 09:42:04 +0000 Subject: [PATCH 23/23] Changes generated by 551e0b47b9189255cf8bd7bef7161c19199e7f8b This commit was automatically created from gocardless/gocardless-pro-ruby-template@551e0b47b9189255cf8bd7bef7161c19199e7f8b by the `push-files` action. Workflow run: https://github.com/gocardless/gocardless-pro-ruby-template/actions/runs/21982023603 --- lib/gocardless_pro/api_service.rb | 2 +- lib/gocardless_pro/resources/balance.rb | 12 +- .../resources/bank_account_detail.rb | 2 +- .../bank_account_holder_verification.rb | 2 +- .../resources/bank_authorisation.rb | 18 +- .../resources/bank_details_lookup.rb | 2 +- .../resources/billing_request.rb | 20 +- .../resources/billing_request_flow.rb | 6 +- .../resources/billing_request_template.rb | 26 +- .../resources/billing_request_with_action.rb | 14 +- lib/gocardless_pro/resources/block.rb | 62 ++-- lib/gocardless_pro/resources/creditor.rb | 12 +- .../resources/creditor_bank_account.rb | 20 +- .../resources/currency_exchange_rate.rb | 2 +- lib/gocardless_pro/resources/customer.rb | 8 +- .../resources/customer_bank_account.rb | 28 +- .../resources/customer_notification.rb | 24 +- lib/gocardless_pro/resources/event.rb | 12 +- lib/gocardless_pro/resources/export.rb | 2 +- .../resources/funds_availability.rb | 6 +- .../resources/instalment_schedule.rb | 28 +- lib/gocardless_pro/resources/institution.rb | 10 +- lib/gocardless_pro/resources/logo.rb | 6 +- lib/gocardless_pro/resources/mandate.rb | 8 +- .../resources/mandate_import.rb | 72 ++--- .../resources/mandate_import_entry.rb | 54 ++-- lib/gocardless_pro/resources/mandate_pdf.rb | 6 +- .../resources/negative_balance_limit.rb | 8 +- .../resources/outbound_payment.rb | 26 +- .../resources/payer_authorisation.rb | 104 +++---- lib/gocardless_pro/resources/payer_theme.rb | 2 +- lib/gocardless_pro/resources/payment.rb | 12 +- .../resources/payment_account.rb | 4 +- .../resources/payment_account_transaction.rb | 6 +- lib/gocardless_pro/resources/payout.rb | 12 +- lib/gocardless_pro/resources/payout_item.rb | 38 +-- lib/gocardless_pro/resources/redirect_flow.rb | 62 ++-- lib/gocardless_pro/resources/refund.rb | 12 +- .../resources/scenario_simulator.rb | 10 +- .../resources/scheme_identifier.rb | 6 +- lib/gocardless_pro/resources/subscription.rb | 97 +++---- lib/gocardless_pro/resources/tax_rate.rb | 6 +- .../resources/transferred_mandate.rb | 2 +- .../resources/verification_detail.rb | 20 +- lib/gocardless_pro/resources/webhook.rb | 2 +- .../services/balances_service.rb | 5 +- .../services/bank_account_details_service.rb | 14 +- ...nk_account_holder_verifications_service.rb | 14 +- .../services/bank_authorisations_service.rb | 6 +- .../services/bank_details_lookups_service.rb | 49 ++-- .../services/billing_request_flows_service.rb | 10 +- .../billing_request_templates_service.rb | 14 +- .../billing_request_with_actions_service.rb | 12 +- .../services/billing_requests_service.rb | 130 ++++----- lib/gocardless_pro/services/blocks_service.rb | 26 +- .../creditor_bank_accounts_service.rb | 24 +- .../services/creditors_service.rb | 16 +- .../currency_exchange_rates_service.rb | 4 +- .../customer_bank_accounts_service.rb | 42 +-- .../customer_notifications_service.rb | 16 +- .../services/customers_service.rb | 32 +-- lib/gocardless_pro/services/events_service.rb | 8 +- .../services/exports_service.rb | 6 +- .../services/funds_availabilities_service.rb | 10 +- .../services/instalment_schedules_service.rb | 84 +++--- .../services/institutions_service.rb | 8 +- lib/gocardless_pro/services/logos_service.rb | 12 +- .../mandate_import_entries_service.rb | 26 +- .../services/mandate_imports_service.rb | 54 ++-- .../services/mandate_pdfs_service.rb | 62 ++-- .../services/mandates_service.rb | 55 ++-- .../negative_balance_limits_service.rb | 4 +- .../services/outbound_payments_service.rb | 34 +-- .../services/payer_authorisations_service.rb | 70 ++--- .../services/payer_themes_service.rb | 6 +- .../payment_account_transactions_service.rb | 14 +- .../services/payment_accounts_service.rb | 8 +- .../services/payments_service.rb | 52 ++-- .../services/payout_items_service.rb | 10 +- .../services/payouts_service.rb | 16 +- .../services/redirect_flows_service.rb | 29 +- .../services/refunds_service.rb | 32 +-- .../services/scenario_simulators_service.rb | 265 +++++++++--------- .../services/scheme_identifiers_service.rb | 74 ++--- .../services/subscriptions_service.rb | 145 +++++----- .../services/tax_rates_service.rb | 8 +- .../services/transferred_mandates_service.rb | 8 +- .../services/verification_details_service.rb | 4 +- .../services/webhooks_service.rb | 12 +- 89 files changed, 1217 insertions(+), 1206 deletions(-) diff --git a/lib/gocardless_pro/api_service.rb b/lib/gocardless_pro/api_service.rb index e47a502f..f99e3f1e 100644 --- a/lib/gocardless_pro/api_service.rb +++ b/lib/gocardless_pro/api_service.rb @@ -7,7 +7,7 @@ require 'base64' module GoCardlessPro - # GoCardless API + # GoCardless API class ApiService attr_reader :on_idempotency_conflict diff --git a/lib/gocardless_pro/resources/balance.rb b/lib/gocardless_pro/resources/balance.rb index d2445e18..d920dede 100644 --- a/lib/gocardless_pro/resources/balance.rb +++ b/lib/gocardless_pro/resources/balance.rb @@ -10,13 +10,13 @@ module GoCardlessPro module Resources # Represents an instance of a balance resource returned from the API - # Returns the balances for a creditor. These balances are the same as what’s - # shown in the dashboard with one exception (mentioned below under - # balance_type). + # Returns the balances for a creditor. These balances are the same as + # what’s shown in the dashboard with one exception (mentioned below under + # balance_type). # - # These balances will typically be 3-5 minutes old. The balance amounts - # likely won’t match what’s shown in the dashboard as the dashboard balances - # are updated much less frequently (once per day). + # These balances will typically be 3-5 minutes old. The balance amounts + # likely won’t match what’s shown in the dashboard as the dashboard + # balances are updated much less frequently (once per day). class Balance attr_reader :amount attr_reader :balance_type diff --git a/lib/gocardless_pro/resources/bank_account_detail.rb b/lib/gocardless_pro/resources/bank_account_detail.rb index e9564052..a8b71181 100644 --- a/lib/gocardless_pro/resources/bank_account_detail.rb +++ b/lib/gocardless_pro/resources/bank_account_detail.rb @@ -10,7 +10,7 @@ module GoCardlessPro module Resources # Represents an instance of a bank_account_detail resource returned from the API - # Retrieve bank account details in JWE encrypted format + # Retrieve bank account details in JWE encrypted format class BankAccountDetail attr_reader :ciphertext attr_reader :encrypted_key diff --git a/lib/gocardless_pro/resources/bank_account_holder_verification.rb b/lib/gocardless_pro/resources/bank_account_holder_verification.rb index ed2963fe..b2e0c667 100644 --- a/lib/gocardless_pro/resources/bank_account_holder_verification.rb +++ b/lib/gocardless_pro/resources/bank_account_holder_verification.rb @@ -10,7 +10,7 @@ module GoCardlessPro module Resources # Represents an instance of a bank_account_holder_verification resource returned from the API - # Create a bank account holder verification for a bank account. + # Create a bank account holder verification for a bank account. class BankAccountHolderVerification attr_reader :actual_account_name attr_reader :id diff --git a/lib/gocardless_pro/resources/bank_authorisation.rb b/lib/gocardless_pro/resources/bank_authorisation.rb index d7d9d1f0..de6b3573 100644 --- a/lib/gocardless_pro/resources/bank_authorisation.rb +++ b/lib/gocardless_pro/resources/bank_authorisation.rb @@ -10,16 +10,16 @@ module GoCardlessPro module Resources # Represents an instance of a bank_authorisation resource returned from the API - # Bank Authorisations can be used to authorise Billing Requests. - # Authorisations - # are created against a specific bank, usually the bank that provides the - # payer's - # account. + # Bank Authorisations can be used to authorise Billing Requests. + # Authorisations + # are created against a specific bank, usually the bank that provides the + # payer's + # account. # - # Creation of Bank Authorisations is only permitted from GoCardless hosted - # UIs - # (see Billing Request Flows) to ensure we meet regulatory requirements for - # checkout flows. + # Creation of Bank Authorisations is only permitted from GoCardless hosted + # UIs + # (see Billing Request Flows) to ensure we meet regulatory requirements for + # checkout flows. class BankAuthorisation attr_reader :authorisation_type attr_reader :authorised_at diff --git a/lib/gocardless_pro/resources/bank_details_lookup.rb b/lib/gocardless_pro/resources/bank_details_lookup.rb index 664113e1..a1262e0f 100644 --- a/lib/gocardless_pro/resources/bank_details_lookup.rb +++ b/lib/gocardless_pro/resources/bank_details_lookup.rb @@ -10,7 +10,7 @@ module GoCardlessPro module Resources # Represents an instance of a bank_details_lookup resource returned from the API - # Look up the name and reachability of a bank account. + # Look up the name and reachability of a bank account. class BankDetailsLookup attr_reader :available_debit_schemes attr_reader :bank_name diff --git a/lib/gocardless_pro/resources/billing_request.rb b/lib/gocardless_pro/resources/billing_request.rb index d4261e76..90529046 100644 --- a/lib/gocardless_pro/resources/billing_request.rb +++ b/lib/gocardless_pro/resources/billing_request.rb @@ -10,17 +10,17 @@ module GoCardlessPro module Resources # Represents an instance of a billing_request resource returned from the API - # Billing Requests help create resources that require input or action from - # a customer. An example of required input might be additional customer - # billing details, while an action would be asking a customer to authorise a - # payment using their mobile banking app. + # Billing Requests help create resources that require input or action from + # a customer. An example of required input might be additional customer + # billing details, while an action would be asking a customer to authorise + # a payment using their mobile banking app. # - # See [Billing Requests: - # Overview](https://developer.gocardless.com/getting-started/billing-requests/overview/) - # for how-to's, explanations and tutorials.Important: All properties associated with - # `subscription_request` and `instalment_schedule_request` are only - # supported for ACH and PAD schemes.
+ # See [Billing Requests: + # Overview](https://developer.gocardless.com/getting-started/billing-requests/overview/) + # for how-to's, explanations and tutorials.Important: All properties associated with + # `subscription_request` and `instalment_schedule_request` are only + # supported for ACH and PAD schemes.
class BillingRequest attr_reader :actions attr_reader :created_at diff --git a/lib/gocardless_pro/resources/billing_request_flow.rb b/lib/gocardless_pro/resources/billing_request_flow.rb index ccc471e0..0f256a07 100644 --- a/lib/gocardless_pro/resources/billing_request_flow.rb +++ b/lib/gocardless_pro/resources/billing_request_flow.rb @@ -10,9 +10,9 @@ module GoCardlessPro module Resources # Represents an instance of a billing_request_flow resource returned from the API - # Billing Request Flows can be created to enable a payer to authorise a - # payment created for a scheme with strong payer - # authorisation (such as open banking single payments). + # Billing Request Flows can be created to enable a payer to authorise a + # payment created for a scheme with strong payer + # authorisation (such as open banking single payments). class BillingRequestFlow attr_reader :authorisation_url attr_reader :auto_fulfil diff --git a/lib/gocardless_pro/resources/billing_request_template.rb b/lib/gocardless_pro/resources/billing_request_template.rb index 6e435a6f..c9a1a574 100644 --- a/lib/gocardless_pro/resources/billing_request_template.rb +++ b/lib/gocardless_pro/resources/billing_request_template.rb @@ -10,21 +10,21 @@ module GoCardlessPro module Resources # Represents an instance of a billing_request_template resource returned from the API - # Billing Request Templates are reusable templates that result in - # numerous Billing Requests with similar attributes. They provide - # a no-code solution for generating various types of multi-user payment - # links. + # Billing Request Templates are reusable templates that result in + # numerous Billing Requests with similar attributes. They provide + # a no-code solution for generating various types of multi-user payment + # links. # - # Each template includes a reusable URL that can be embedded in a website - # or shared with customers via email. Every time the URL is opened, - # it generates a new Billing Request. + # Each template includes a reusable URL that can be embedded in a website + # or shared with customers via email. Every time the URL is opened, + # it generates a new Billing Request. # - # Billing Request Templates overcome the key limitation of the Billing - # Request: - # a Billing Request cannot be shared among multiple users because it is - # intended - # for single-use and is designed to cater to the unique needs of individual - # customers. + # Billing Request Templates overcome the key limitation of the Billing + # Request: + # a Billing Request cannot be shared among multiple users because it is + # intended + # for single-use and is designed to cater to the unique needs of individual + # customers. class BillingRequestTemplate attr_reader :authorisation_url attr_reader :created_at diff --git a/lib/gocardless_pro/resources/billing_request_with_action.rb b/lib/gocardless_pro/resources/billing_request_with_action.rb index d7cd1556..3fda272b 100644 --- a/lib/gocardless_pro/resources/billing_request_with_action.rb +++ b/lib/gocardless_pro/resources/billing_request_with_action.rb @@ -10,14 +10,14 @@ module GoCardlessPro module Resources # Represents an instance of a billing_request_with_action resource returned from the API - # Billing Requests help create resources that require input or action from - # a customer. An example of required input might be additional customer - # billing details, while an action would be asking a customer to authorise a - # payment using their mobile banking app. + # Billing Requests help create resources that require input or action from + # a customer. An example of required input might be additional customer + # billing details, while an action would be asking a customer to authorise + # a payment using their mobile banking app. # - # See [Billing Requests: - # Overview](https://developer.gocardless.com/getting-started/billing-requests/overview/) - # for how-to's, explanations and tutorials. + # See [Billing Requests: + # Overview](https://developer.gocardless.com/getting-started/billing-requests/overview/) + # for how-to's, explanations and tutorials. class BillingRequestWithAction attr_reader :bank_authorisations attr_reader :billing_requests diff --git a/lib/gocardless_pro/resources/block.rb b/lib/gocardless_pro/resources/block.rb index 33d9236e..fb3f6494 100644 --- a/lib/gocardless_pro/resources/block.rb +++ b/lib/gocardless_pro/resources/block.rb @@ -10,44 +10,44 @@ module GoCardlessPro module Resources # Represents an instance of a block resource returned from the API - # Blocks are created to prevent certain customer details from being used - # when creating - # mandates. + # Blocks are created to prevent certain customer details from being used + # when creating + # mandates. # - # The details used to create blocks can be exact matches, like a bank - # account or an email, - # or a more generic match such as an email domain or bank name. Please be - # careful when creating - # blocks for more generic matches as this may block legitimate payers from - # using your service. + # The details used to create blocks can be exact matches, like a bank + # account or an email, + # or a more generic match such as an email domain or bank name. Please be + # careful when creating + # blocks for more generic matches as this may block legitimate payers from + # using your service. # - # New block types may be added over time. + # New block types may be added over time. # - # A block is in essence a simple rule that is used to match against details - # in a newly - # created mandate. If there is a successful match then the mandate is - # transitioned to a - # "blocked" state. + # A block is in essence a simple rule that is used to match against details + # in a newly + # created mandate. If there is a successful match then the mandate is + # transitioned to a + # "blocked" state. # - # Please note: + # Please note: # - # - Payments and subscriptions cannot be created against a mandate in - # blocked state. - # - A mandate can never be transitioned out of the blocked state. + # - Payments and subscriptions cannot be created against a mandate in + # blocked state. + # - A mandate can never be transitioned out of the blocked state. # - # The one exception to this is when blocking a 'bank_name'. This block will - # prevent bank - # accounts from being created for banks that match the given name. To ensure - # we match - # bank names correctly an existing bank account must be used when creating - # this block. Please - # be aware that we cannot always match a bank account to a given bank name. + # The one exception to this is when blocking a 'bank_name'. This block will + # prevent bank + # accounts from being created for banks that match the given name. To + # ensure we match + # bank names correctly an existing bank account must be used when creating + # this block. Please + # be aware that we cannot always match a bank account to a given bank name. # - #- # This API is currently only available for GoCardless Protect+ integrators - # - please get in touch if you - # would like to use this API. - #
+ #+ # This API is currently only available for GoCardless Protect+ + # integrators - please get in + # touch if you would like to use this API. + #
class Block attr_reader :active attr_reader :block_type diff --git a/lib/gocardless_pro/resources/creditor.rb b/lib/gocardless_pro/resources/creditor.rb index 15121362..d8fc15f4 100644 --- a/lib/gocardless_pro/resources/creditor.rb +++ b/lib/gocardless_pro/resources/creditor.rb @@ -10,13 +10,13 @@ module GoCardlessPro module Resources # Represents an instance of a creditor resource returned from the API - # Each [payment](#core-endpoints-payments) taken through the API is linked - # to a "creditor", to whom the payment is then paid out. In most cases your - # organisation will have a single "creditor", but the API also supports - # collecting payments on behalf of others. + # Each [payment](#core-endpoints-payments) taken through the API is linked + # to a "creditor", to whom the payment is then paid out. In most cases your + # organisation will have a single "creditor", but the API also supports + # collecting payments on behalf of others. # - # Currently, for Anti Money Laundering reasons, any creditors you add must - # be directly related to your organisation. + # Currently, for Anti Money Laundering reasons, any creditors you add must + # be directly related to your organisation. class Creditor attr_reader :address_line1 attr_reader :address_line2 diff --git a/lib/gocardless_pro/resources/creditor_bank_account.rb b/lib/gocardless_pro/resources/creditor_bank_account.rb index 277d10c7..8e80a5b9 100644 --- a/lib/gocardless_pro/resources/creditor_bank_account.rb +++ b/lib/gocardless_pro/resources/creditor_bank_account.rb @@ -10,18 +10,18 @@ module GoCardlessPro module Resources # Represents an instance of a creditor_bank_account resource returned from the API - # Creditor Bank Accounts hold the bank details of a - # [creditor](#core-endpoints-creditors). These are the bank accounts which - # your [payouts](#core-endpoints-payouts) will be sent to. + # Creditor Bank Accounts hold the bank details of a + # [creditor](#core-endpoints-creditors). These are the bank accounts which + # your [payouts](#core-endpoints-payouts) will be sent to. # - # Note that creditor bank accounts must be unique, and so you will encounter - # a `bank_account_exists` error if you try to create a duplicate bank - # account. You may wish to handle this by updating the existing record - # instead, the ID of which will be provided as - # `links[creditor_bank_account]` in the error response. + # Note that creditor bank accounts must be unique, and so you will + # encounter a `bank_account_exists` error if you try to create a duplicate + # bank account. You may wish to handle this by updating the existing record + # instead, the ID of which will be provided as + # `links[creditor_bank_account]` in the error response. # - #Restricted: This API is not - # available for partner integrations.
+ #Restricted: This API is not + # available for partner integrations.
class CreditorBankAccount attr_reader :account_holder_name attr_reader :account_number_ending diff --git a/lib/gocardless_pro/resources/currency_exchange_rate.rb b/lib/gocardless_pro/resources/currency_exchange_rate.rb index cae5cf1e..34135ed3 100644 --- a/lib/gocardless_pro/resources/currency_exchange_rate.rb +++ b/lib/gocardless_pro/resources/currency_exchange_rate.rb @@ -10,7 +10,7 @@ module GoCardlessPro module Resources # Represents an instance of a currency_exchange_rate resource returned from the API - # Currency exchange rates from our foreign exchange provider. + # Currency exchange rates from our foreign exchange provider. class CurrencyExchangeRate attr_reader :rate attr_reader :source diff --git a/lib/gocardless_pro/resources/customer.rb b/lib/gocardless_pro/resources/customer.rb index ea5f0f7e..d69b3940 100644 --- a/lib/gocardless_pro/resources/customer.rb +++ b/lib/gocardless_pro/resources/customer.rb @@ -10,10 +10,10 @@ module GoCardlessPro module Resources # Represents an instance of a customer resource returned from the API - # Customer objects hold the contact details for a customer. A customer can - # have several [customer bank - # accounts](#core-endpoints-customer-bank-accounts), which in turn can have - # several Direct Debit [mandates](#core-endpoints-mandates). + # Customer objects hold the contact details for a customer. A customer can + # have several [customer bank + # accounts](#core-endpoints-customer-bank-accounts), which in turn can have + # several Direct Debit [mandates](#core-endpoints-mandates). class Customer attr_reader :address_line1 attr_reader :address_line2 diff --git a/lib/gocardless_pro/resources/customer_bank_account.rb b/lib/gocardless_pro/resources/customer_bank_account.rb index 5f706aef..1ffde66f 100644 --- a/lib/gocardless_pro/resources/customer_bank_account.rb +++ b/lib/gocardless_pro/resources/customer_bank_account.rb @@ -10,23 +10,23 @@ module GoCardlessPro module Resources # Represents an instance of a customer_bank_account resource returned from the API - # Customer Bank Accounts hold the bank details of a - # [customer](#core-endpoints-customers). They always belong to a - # [customer](#core-endpoints-customers), and may be linked to several Direct - # Debit [mandates](#core-endpoints-mandates). + # Customer Bank Accounts hold the bank details of a + # [customer](#core-endpoints-customers). They always belong to a + # [customer](#core-endpoints-customers), and may be linked to several + # Direct Debit [mandates](#core-endpoints-mandates). # - # Note that customer bank accounts must be unique, and so you will encounter - # a `bank_account_exists` error if you try to create a duplicate bank - # account. You may wish to handle this by updating the existing record - # instead, the ID of which will be provided as - # `links[customer_bank_account]` in the error response. + # Note that customer bank accounts must be unique, and so you will + # encounter a `bank_account_exists` error if you try to create a duplicate + # bank account. You may wish to handle this by updating the existing record + # instead, the ID of which will be provided as + # `links[customer_bank_account]` in the error response. # - # _Note:_ To ensure the customer's bank accounts are valid, verify them - # first - # using + # _Note:_ To ensure the customer's bank accounts are valid, verify them + # first + # using # - # [bank_details_lookups](#bank-details-lookups-perform-a-bank-details-lookup), - # before proceeding with creating the accounts + # [bank_details_lookups](#bank-details-lookups-perform-a-bank-details-lookup), + # before proceeding with creating the accounts class CustomerBankAccount attr_reader :account_holder_name attr_reader :account_number_ending diff --git a/lib/gocardless_pro/resources/customer_notification.rb b/lib/gocardless_pro/resources/customer_notification.rb index ea318509..37a43cd4 100644 --- a/lib/gocardless_pro/resources/customer_notification.rb +++ b/lib/gocardless_pro/resources/customer_notification.rb @@ -10,20 +10,20 @@ module GoCardlessPro module Resources # Represents an instance of a customer_notification resource returned from the API - # Customer Notifications represent the notification which is due to be sent - # to a customer - # after an event has happened. The event, the resource and the customer to - # be notified - # are all identified in the `links` property. + # Customer Notifications represent the notification which is due to be sent + # to a customer + # after an event has happened. The event, the resource and the customer to + # be notified + # are all identified in the `links` property. # - # Note that these are ephemeral records - once the notification has been - # actioned in some - # way, it is no longer visible using this API. + # Note that these are ephemeral records - once the notification has been + # actioned in some + # way, it is no longer visible using this API. # - #Restricted: This API is - # currently only available for approved integrators - please get in touch if you would like to - # use this API.
+ #Restricted: This API is + # currently only available for approved integrators - please get in touch if you would like to + # use this API.
class CustomerNotification attr_reader :action_taken attr_reader :action_taken_at diff --git a/lib/gocardless_pro/resources/event.rb b/lib/gocardless_pro/resources/event.rb index a742f061..d4a98f44 100644 --- a/lib/gocardless_pro/resources/event.rb +++ b/lib/gocardless_pro/resources/event.rb @@ -10,12 +10,12 @@ module GoCardlessPro module Resources # Represents an instance of a event resource returned from the API - # Events are stored for all webhooks. An event refers to a resource which - # has been updated, for example a payment which has been collected, or a - # mandate which has been transferred. Event creation is an asynchronous - # process, so it can take some time between an action occurring and its - # corresponding event getting included in API responses. See - # [here](#event-types) for a complete list of event types. + # Events are stored for all webhooks. An event refers to a resource which + # has been updated, for example a payment which has been collected, or a + # mandate which has been transferred. Event creation is an asynchronous + # process, so it can take some time between an action occurring and its + # corresponding event getting included in API responses. See + # [here](#event-types) for a complete list of event types. class Event attr_reader :action attr_reader :created_at diff --git a/lib/gocardless_pro/resources/export.rb b/lib/gocardless_pro/resources/export.rb index d1f59ea9..b5def9a3 100644 --- a/lib/gocardless_pro/resources/export.rb +++ b/lib/gocardless_pro/resources/export.rb @@ -10,7 +10,7 @@ module GoCardlessPro module Resources # Represents an instance of a export resource returned from the API - # File-based exports of data + # File-based exports of data class Export attr_reader :created_at attr_reader :currency diff --git a/lib/gocardless_pro/resources/funds_availability.rb b/lib/gocardless_pro/resources/funds_availability.rb index aeeb0041..b9bdc4d5 100644 --- a/lib/gocardless_pro/resources/funds_availability.rb +++ b/lib/gocardless_pro/resources/funds_availability.rb @@ -10,9 +10,9 @@ module GoCardlessPro module Resources # Represents an instance of a funds_availability resource returned from the API - # Checks if the payer's current balance is sufficient to cover the amount - # the merchant wants to charge within the consent parameters defined on the - # mandate. + # Checks if the payer's current balance is sufficient to cover the amount + # the merchant wants to charge within the consent parameters defined on the + # mandate. class FundsAvailability attr_reader :available diff --git a/lib/gocardless_pro/resources/instalment_schedule.rb b/lib/gocardless_pro/resources/instalment_schedule.rb index 0f530ff5..fde9be46 100644 --- a/lib/gocardless_pro/resources/instalment_schedule.rb +++ b/lib/gocardless_pro/resources/instalment_schedule.rb @@ -10,22 +10,22 @@ module GoCardlessPro module Resources # Represents an instance of a instalment_schedule resource returned from the API - # Instalment schedules are objects which represent a collection of related - # payments, with the - # intention to collect the `total_amount` specified. The API supports both - # schedule-based - # creation (similar to subscriptions) as well as explicit selection of - # differing payment - # amounts and charge dates. + # Instalment schedules are objects which represent a collection of related + # payments, with the + # intention to collect the `total_amount` specified. The API supports both + # schedule-based + # creation (similar to subscriptions) as well as explicit selection of + # differing payment + # amounts and charge dates. # - # Unlike subscriptions, the payments are created immediately, so the - # instalment schedule - # cannot be modified once submitted and instead can only be cancelled (which - # will cancel - # any of the payments which have not yet been submitted). + # Unlike subscriptions, the payments are created immediately, so the + # instalment schedule + # cannot be modified once submitted and instead can only be cancelled + # (which will cancel + # any of the payments which have not yet been submitted). # - # Customers will receive a single notification about the complete schedule - # of collection. + # Customers will receive a single notification about the complete schedule + # of collection. # class InstalmentSchedule attr_reader :created_at diff --git a/lib/gocardless_pro/resources/institution.rb b/lib/gocardless_pro/resources/institution.rb index 420dc830..b46bf6bc 100644 --- a/lib/gocardless_pro/resources/institution.rb +++ b/lib/gocardless_pro/resources/institution.rb @@ -10,12 +10,12 @@ module GoCardlessPro module Resources # Represents an instance of a institution resource returned from the API - # Institutions that are supported when creating [Bank - # Authorisations](#billing-requests-bank-authorisations) for a particular - # country or purpose. + # Institutions that are supported when creating [Bank + # Authorisations](#billing-requests-bank-authorisations) for a particular + # country or purpose. # - # Not all institutions support both Payment Initiation (PIS) and Account - # Information (AIS) services. + # Not all institutions support both Payment Initiation (PIS) and Account + # Information (AIS) services. class Institution attr_reader :autocompletes_collect_bank_account attr_reader :country_code diff --git a/lib/gocardless_pro/resources/logo.rb b/lib/gocardless_pro/resources/logo.rb index e1718473..e930870e 100644 --- a/lib/gocardless_pro/resources/logo.rb +++ b/lib/gocardless_pro/resources/logo.rb @@ -10,9 +10,9 @@ module GoCardlessPro module Resources # Represents an instance of a logo resource returned from the API - # Logos are image uploads that, when associated with a creditor, are shown - # on the [billing request flow](#billing-requests-billing-request-flows) - # payment pages. + # Logos are image uploads that, when associated with a creditor, are shown + # on the [billing request flow](#billing-requests-billing-request-flows) + # payment pages. class Logo attr_reader :id diff --git a/lib/gocardless_pro/resources/mandate.rb b/lib/gocardless_pro/resources/mandate.rb index 5ff71f12..d36e2356 100644 --- a/lib/gocardless_pro/resources/mandate.rb +++ b/lib/gocardless_pro/resources/mandate.rb @@ -10,11 +10,11 @@ module GoCardlessPro module Resources # Represents an instance of a mandate resource returned from the API - # Mandates represent the Direct Debit mandate with a - # [customer](#core-endpoints-customers). + # Mandates represent the Direct Debit mandate with a + # [customer](#core-endpoints-customers). # - # GoCardless will notify you via a [webhook](#appendix-webhooks) whenever - # the status of a mandate changes. + # GoCardless will notify you via a [webhook](#appendix-webhooks) whenever + # the status of a mandate changes. class Mandate attr_reader :authorisation_source attr_reader :consent_parameters diff --git a/lib/gocardless_pro/resources/mandate_import.rb b/lib/gocardless_pro/resources/mandate_import.rb index 8dd94ed5..a89a407f 100644 --- a/lib/gocardless_pro/resources/mandate_import.rb +++ b/lib/gocardless_pro/resources/mandate_import.rb @@ -10,48 +10,48 @@ module GoCardlessPro module Resources # Represents an instance of a mandate_import resource returned from the API - # Mandate Imports allow you to migrate existing mandates from other - # providers into the - # GoCardless platform. + # Mandate Imports allow you to migrate existing mandates from other + # providers into the + # GoCardless platform. # - # The process is as follows: + # The process is as follows: # - # 1. [Create a mandate - # import](#mandate-imports-create-a-new-mandate-import) - # 2. [Add entries](#mandate-import-entries-add-a-mandate-import-entry) to - # the import - # 3. [Submit](#mandate-imports-submit-a-mandate-import) the import - # 4. Wait until a member of the GoCardless team approves the import, at - # which point the mandates will be created - # 5. [Link up the - # mandates](#mandate-import-entries-list-all-mandate-import-entries) in your - # system + # 1. [Create a mandate + # import](#mandate-imports-create-a-new-mandate-import) + # 2. [Add entries](#mandate-import-entries-add-a-mandate-import-entry) to + # the import + # 3. [Submit](#mandate-imports-submit-a-mandate-import) the import + # 4. Wait until a member of the GoCardless team approves the import, at + # which point the mandates will be created + # 5. [Link up the + # mandates](#mandate-import-entries-list-all-mandate-import-entries) in + # your system # - # When you add entries to your mandate import, they are not turned into - # actual mandates - # until the mandate import is submitted by you via the API, and then - # processed by a member - # of the GoCardless team. When that happens, a mandate will be created for - # each entry in the import. + # When you add entries to your mandate import, they are not turned into + # actual mandates + # until the mandate import is submitted by you via the API, and then + # processed by a member + # of the GoCardless team. When that happens, a mandate will be created for + # each entry in the import. # - # We will issue a `mandate_created` webhook for each entry, which will be - # the same as the webhooks - # triggered when [ creating a mandate ](#mandates-create-a-mandate) using - # the mandates API. Once these - # webhooks start arriving, any reconciliation can now be accomplished by - # [checking the current status](#mandate-imports-get-a-mandate-import) of - # the mandate import and - # [linking up the mandates to your - # system](#mandate-import-entries-list-all-mandate-import-entries). + # We will issue a `mandate_created` webhook for each entry, which will be + # the same as the webhooks + # triggered when [ creating a mandate ](#mandates-create-a-mandate) using + # the mandates API. Once these + # webhooks start arriving, any reconciliation can now be accomplished by + # [checking the current status](#mandate-imports-get-a-mandate-import) of + # the mandate import and + # [linking up the mandates to your + # system](#mandate-import-entries-list-all-mandate-import-entries). # - #Note that all Mandate Imports have an upper limit of - # 30,000 entries, so we recommend you split your import into several smaller - # imports if you're planning to exceed this threshold.
+ #Note that all Mandate Imports have an upper limit of + # 30,000 entries, so we recommend you split your import into several + # smaller imports if you're planning to exceed this threshold.
# - #Restricted: This API is - # currently only available for approved integrators - please get in touch if you would like to - # use this API.
+ #Restricted: This API is + # currently only available for approved integrators - please get in touch if you would like to + # use this API.
class MandateImport attr_reader :created_at attr_reader :id diff --git a/lib/gocardless_pro/resources/mandate_import_entry.rb b/lib/gocardless_pro/resources/mandate_import_entry.rb index e485c9aa..f3b4f45f 100644 --- a/lib/gocardless_pro/resources/mandate_import_entry.rb +++ b/lib/gocardless_pro/resources/mandate_import_entry.rb @@ -10,36 +10,36 @@ module GoCardlessPro module Resources # Represents an instance of a mandate_import_entry resource returned from the API - # Mandate Import Entries are added to a [Mandate - # Import](#core-endpoints-mandate-imports). - # Each entry corresponds to one mandate to be imported into GoCardless. + # Mandate Import Entries are added to a [Mandate + # Import](#core-endpoints-mandate-imports). + # Each entry corresponds to one mandate to be imported into GoCardless. # - # To import a mandate you will need: - #Restricted: This API is - # currently only available for approved integrators - please get in touch if you would like to - # use this API.
+ #Restricted: This API is + # currently only available for approved integrators - please get in touch if you would like to + # use this API.
class MandateImportEntry attr_reader :created_at attr_reader :processing_errors diff --git a/lib/gocardless_pro/resources/mandate_pdf.rb b/lib/gocardless_pro/resources/mandate_pdf.rb index 2293032b..10f5f7ec 100644 --- a/lib/gocardless_pro/resources/mandate_pdf.rb +++ b/lib/gocardless_pro/resources/mandate_pdf.rb @@ -10,9 +10,9 @@ module GoCardlessPro module Resources # Represents an instance of a mandate_pdf resource returned from the API - # Mandate PDFs allow you to easily display [scheme-rules - # compliant](#appendix-compliance-requirements) Direct Debit mandates to - # your customers. + # Mandate PDFs allow you to easily display [scheme-rules + # compliant](#appendix-compliance-requirements) Direct Debit mandates to + # your customers. class MandatePdf attr_reader :expires_at attr_reader :url diff --git a/lib/gocardless_pro/resources/negative_balance_limit.rb b/lib/gocardless_pro/resources/negative_balance_limit.rb index e51e1495..b8ad9878 100644 --- a/lib/gocardless_pro/resources/negative_balance_limit.rb +++ b/lib/gocardless_pro/resources/negative_balance_limit.rb @@ -10,10 +10,10 @@ module GoCardlessPro module Resources # Represents an instance of a negative_balance_limit resource returned from the API - # The negative balance limit is a threshold for the creditor balance beyond - # which refunds are not permitted. The default limit is zero — refunds are - # not permitted if the creditor has a negative balance. The limit can be - # changed on a per-creditor basis. + # The negative balance limit is a threshold for the creditor balance beyond + # which refunds are not permitted. The default limit is zero — refunds are + # not permitted if the creditor has a negative balance. The limit can be + # changed on a per-creditor basis. # class NegativeBalanceLimit attr_reader :balance_limit diff --git a/lib/gocardless_pro/resources/outbound_payment.rb b/lib/gocardless_pro/resources/outbound_payment.rb index f68a8fb5..80efa24a 100644 --- a/lib/gocardless_pro/resources/outbound_payment.rb +++ b/lib/gocardless_pro/resources/outbound_payment.rb @@ -10,22 +10,22 @@ module GoCardlessPro module Resources # Represents an instance of a outbound_payment resource returned from the API - # Outbound Payments represent payments sent from - # [creditors](#core-endpoints-creditors). + # Outbound Payments represent payments sent from + # [creditors](#core-endpoints-creditors). # - # GoCardless will notify you via a [webhook](#appendix-webhooks) when the - # status of the outbound payment [changes](#event-types-outbound-payment). + # GoCardless will notify you via a [webhook](#appendix-webhooks) when the + # status of the outbound payment [changes](#event-types-outbound-payment). # - # ####Rate limiting + # ####Rate limiting # - # Two rate limits apply to the Outbound Payments APIs: - # - All POST Outbound Payment endpoints (create, withdraw, approve, cancel - # and etc.) share a single rate-limit group of 300 requests per minute. As - # initiating a payment typically requires two API calls (one to create the - # payment and one to approve it), this allows you to add approximately 150 - # outbound payments per minute. - # - All remaining Outbound Payment endpoints are limited to 500 requests per - # minute. + # Two rate limits apply to the Outbound Payments APIs: + # - All POST Outbound Payment endpoints (create, withdraw, approve, cancel + # and etc.) share a single rate-limit group of 300 requests per minute. As + # initiating a payment typically requires two API calls (one to create the + # payment and one to approve it), this allows you to add approximately 150 + # outbound payments per minute. + # - All remaining Outbound Payment endpoints are limited to 500 requests + # per minute. class OutboundPayment attr_reader :amount attr_reader :created_at diff --git a/lib/gocardless_pro/resources/payer_authorisation.rb b/lib/gocardless_pro/resources/payer_authorisation.rb index 79cce40c..ad32b58c 100644 --- a/lib/gocardless_pro/resources/payer_authorisation.rb +++ b/lib/gocardless_pro/resources/payer_authorisation.rb @@ -10,64 +10,64 @@ module GoCardlessPro module Resources # Represents an instance of a payer_authorisation resource returned from the API - #- # Don't use Payer Authorisations for new integrations. - # It is deprecated in favour of - # - # Billing Requests. Use Billing Requests to build any future - # integrations. - #
+ #+ # Don't use Payer Authorisations for new integrations. + # It is deprecated in favour of + # + # Billing Requests. Use Billing Requests to build any future + # integrations. + #
# - # Payer Authorisation resource acts as a wrapper for creating customer, bank - # account and mandate details in a single request. - # PayerAuthorisation API enables the integrators to build their own custom - # payment pages. + # Payer Authorisation resource acts as a wrapper for creating customer, + # bank account and mandate details in a single request. + # PayerAuthorisation API enables the integrators to build their own custom + # payment pages. # - # The process to use the Payer Authorisation API is as follows: + # The process to use the Payer Authorisation API is as follows: # - # 1. Create a Payer Authorisation, either empty or with already available - # information - # 2. Update the authorisation with additional information or fix any - # mistakes - # 3. Submit the authorisation, after the payer has reviewed their - # information - # 4. [coming soon] Redirect the payer to the verification mechanisms from - # the response of the Submit request (this will be introduced as a - # non-breaking change) - # 5. Confirm the authorisation to indicate that the resources can be - # created + # 1. Create a Payer Authorisation, either empty or with already available + # information + # 2. Update the authorisation with additional information or fix any + # mistakes + # 3. Submit the authorisation, after the payer has reviewed their + # information + # 4. [coming soon] Redirect the payer to the verification mechanisms from + # the response of the Submit request (this will be introduced as a + # non-breaking change) + # 5. Confirm the authorisation to indicate that the resources can be + # created # - # After the Payer Authorisation is confirmed, resources will eventually be - # created as it's an asynchronous process. + # After the Payer Authorisation is confirmed, resources will eventually be + # created as it's an asynchronous process. # - # To retrieve the status and ID of the linked resources you can do one of - # the following: - # payer_authorisation_completed webhook (recommended)https://api.gocardless.com/events?payer_authorisation={id}&action=completed
- # payer_authorisation_completed webhook (recommended)https://api.gocardless.com/events?payer_authorisation={id}&action=completed
+ #
- # Note that the `create` and `update` endpoints behave differently than
- # other existing `create` and `update` endpoints. The Payer Authorisation
- # is still saved if incomplete data is provided.
- # We return the list of incomplete data in the `incomplete_fields` along
- # with the resources in the body of the response.
- # The bank account details(account_number, bank_code & branch_code) must
- # be sent together rather than splitting across different request for both
- # `create` and `update` endpoints.
- #
- # The API is designed to be flexible and allows you to collect information
- # in multiple steps without storing any sensitive data in the browser or in
- # your servers.
- #
+ # Note that the `create` and `update` endpoints behave differently than
+ # other existing `create` and `update` endpoints. The Payer Authorisation
+ # is still saved if incomplete data is provided.
+ # We return the list of incomplete data in the `incomplete_fields` along
+ # with the resources in the body of the response.
+ # The bank account details(account_number, bank_code & branch_code) must
+ # be sent together rather than splitting across different request for both
+ # `create` and `update` endpoints.
+ #
+ # The API is designed to be flexible and allows you to collect
+ # information in multiple steps without storing any sensitive data in the
+ # browser or in your servers.
+ #
410 Gone.
+ # The Payout Items API allows you to view, on a per-payout basis, the
+ # credit and debit
+ # items that make up that payout's amount. Payout items can only be
+ # retrieved for payouts
+ # created in the last 6 months. Requests for older payouts will return an
+ # HTTP status
+ # 410 Gone.
#
class PayoutItem
attr_reader :amount
diff --git a/lib/gocardless_pro/resources/redirect_flow.rb b/lib/gocardless_pro/resources/redirect_flow.rb
index 1b0737f5..1f975241 100644
--- a/lib/gocardless_pro/resources/redirect_flow.rb
+++ b/lib/gocardless_pro/resources/redirect_flow.rb
@@ -10,44 +10,44 @@ module GoCardlessPro
module Resources
# Represents an instance of a redirect_flow resource returned from the API
- # Deprecated: Redirect Flows - # are legacy APIs and cannot be used by new integrators. - # The [Billing Request flow](#billing-requests) API should be used for - # your payment flows.
+ #Deprecated: Redirect Flows + # are legacy APIs and cannot be used by new integrators. + # The [Billing Request flow](#billing-requests) API should be used for + # your payment flows.
# - # Redirect flows enable you to use GoCardless' [hosted payment - # pages](https://pay-sandbox.gocardless.com/AL000000AKFPFF) to set up - # mandates with your customers. These pages are fully compliant and have - # been translated into Danish, Dutch, French, German, Italian, Norwegian, - # Portuguese, Slovak, Spanish and Swedish. + # Redirect flows enable you to use GoCardless' [hosted payment + # pages](https://pay-sandbox.gocardless.com/AL000000AKFPFF) to set up + # mandates with your customers. These pages are fully compliant and have + # been translated into Danish, Dutch, French, German, Italian, Norwegian, + # Portuguese, Slovak, Spanish and Swedish. # - # The overall flow is: + # The overall flow is: # - # 1. You [create](#redirect-flows-create-a-redirect-flow) a redirect flow - # for your customer, and redirect them to the returned redirect url, e.g. - # `https://pay.gocardless.com/flow/RE123`. + # 1. You [create](#redirect-flows-create-a-redirect-flow) a redirect flow + # for your customer, and redirect them to the returned redirect url, e.g. + # `https://pay.gocardless.com/flow/RE123`. # - # 2. Your customer supplies their name, email, address, and bank account - # details, and submits the form. This securely stores their details, and - # redirects them back to your `success_redirect_url` with - # `redirect_flow_id=RE123` in the querystring. + # 2. Your customer supplies their name, email, address, and bank account + # details, and submits the form. This securely stores their details, and + # redirects them back to your `success_redirect_url` with + # `redirect_flow_id=RE123` in the querystring. # - # 3. You [complete](#redirect-flows-complete-a-redirect-flow) the redirect - # flow, which creates a [customer](#core-endpoints-customers), [customer - # bank account](#core-endpoints-customer-bank-accounts), and - # [mandate](#core-endpoints-mandates), and returns the ID of the mandate. - # You may wish to create a [subscription](#core-endpoints-subscriptions) or - # [payment](#core-endpoints-payments) at this point. + # 3. You [complete](#redirect-flows-complete-a-redirect-flow) the redirect + # flow, which creates a [customer](#core-endpoints-customers), [customer + # bank account](#core-endpoints-customer-bank-accounts), and + # [mandate](#core-endpoints-mandates), and returns the ID of the mandate. + # You may wish to create a [subscription](#core-endpoints-subscriptions) or + # [payment](#core-endpoints-payments) at this point. # - # Once you have [completed](#redirect-flows-complete-a-redirect-flow) the - # redirect flow via the API, you should display a confirmation page to your - # customer, confirming that their Direct Debit has been set up. You can - # build your own page, or redirect to the one we provide in the - # `confirmation_url` attribute of the redirect flow. + # Once you have [completed](#redirect-flows-complete-a-redirect-flow) the + # redirect flow via the API, you should display a confirmation page to your + # customer, confirming that their Direct Debit has been set up. You can + # build your own page, or redirect to the one we provide in the + # `confirmation_url` attribute of the redirect flow. # - # Redirect flows expire 30 minutes after they are first created. You cannot - # complete an expired redirect flow. For an integrator this is shorter and - # they will expire after 10 minutes. + # Redirect flows expire 30 minutes after they are first created. You cannot + # complete an expired redirect flow. For an integrator this is shorter and + # they will expire after 10 minutes. class RedirectFlow attr_reader :confirmation_url attr_reader :created_at diff --git a/lib/gocardless_pro/resources/refund.rb b/lib/gocardless_pro/resources/refund.rb index 244c5b18..86e68c13 100644 --- a/lib/gocardless_pro/resources/refund.rb +++ b/lib/gocardless_pro/resources/refund.rb @@ -10,13 +10,13 @@ module GoCardlessPro module Resources # Represents an instance of a refund resource returned from the API - # Refund objects represent (partial) refunds of a - # [payment](#core-endpoints-payments) back to the - # [customer](#core-endpoints-customers). + # Refund objects represent (partial) refunds of a + # [payment](#core-endpoints-payments) back to the + # [customer](#core-endpoints-customers). # - # GoCardless will notify you via a [webhook](#appendix-webhooks) whenever a - # refund is created, and will update the `amount_refunded` property of the - # payment. + # GoCardless will notify you via a [webhook](#appendix-webhooks) whenever a + # refund is created, and will update the `amount_refunded` property of the + # payment. class Refund attr_reader :amount attr_reader :created_at diff --git a/lib/gocardless_pro/resources/scenario_simulator.rb b/lib/gocardless_pro/resources/scenario_simulator.rb index 7186a626..3abc097e 100644 --- a/lib/gocardless_pro/resources/scenario_simulator.rb +++ b/lib/gocardless_pro/resources/scenario_simulator.rb @@ -10,11 +10,11 @@ module GoCardlessPro module Resources # Represents an instance of a scenario_simulator resource returned from the API - # Scenario Simulators allow you to manually trigger and test certain paths - # that your - # integration will encounter in the real world. These endpoints are only - # active in the - # sandbox environment. + # Scenario Simulators allow you to manually trigger and test certain paths + # that your + # integration will encounter in the real world. These endpoints are only + # active in the + # sandbox environment. class ScenarioSimulator attr_reader :id diff --git a/lib/gocardless_pro/resources/scheme_identifier.rb b/lib/gocardless_pro/resources/scheme_identifier.rb index 7a638f27..03c362ff 100644 --- a/lib/gocardless_pro/resources/scheme_identifier.rb +++ b/lib/gocardless_pro/resources/scheme_identifier.rb @@ -10,9 +10,9 @@ module GoCardlessPro module Resources # Represents an instance of a scheme_identifier resource returned from the API - # This represents a scheme identifier (e.g. a SUN in Bacs or a CID in SEPA). - # Scheme identifiers are used to specify the beneficiary name that appears - # on customers' bank statements. + # This represents a scheme identifier (e.g. a SUN in Bacs or a CID in + # SEPA). Scheme identifiers are used to specify the beneficiary name that + # appears on customers' bank statements. # class SchemeIdentifier attr_reader :address_line1 diff --git a/lib/gocardless_pro/resources/subscription.rb b/lib/gocardless_pro/resources/subscription.rb index 9a9badc9..0c51d992 100644 --- a/lib/gocardless_pro/resources/subscription.rb +++ b/lib/gocardless_pro/resources/subscription.rb @@ -10,63 +10,64 @@ module GoCardlessPro module Resources # Represents an instance of a subscription resource returned from the API - # Subscriptions create [payments](#core-endpoints-payments) according to a - # schedule. + # Subscriptions create [payments](#core-endpoints-payments) according to a + # schedule. # - # ### Recurrence Rules + # ### Recurrence Rules # - # The following rules apply when specifying recurrence: + # The following rules apply when specifying recurrence: # - # - If `day_of_month` and `start_date` are not provided `start_date` will be - # the [mandate](#core-endpoints-mandates)'s `next_possible_charge_date` and - # the subscription will then recur based on the `interval` & `interval_unit` - # - If `month` or `day_of_month` are present the following validations - # apply: + # - If `day_of_month` and `start_date` are not provided `start_date` will + # be the [mandate](#core-endpoints-mandates)'s `next_possible_charge_date` + # and the subscription will then recur based on the `interval` & + # `interval_unit` + # - If `month` or `day_of_month` are present the following validations + # apply: # - # | __interval_unit__ | __month__ | - # __day_of_month__ | - # | :---------------- | :--------------------------------------------- | - # :----------------------------------------- | - # | yearly | optional (required if `day_of_month` provided) | - # optional (invalid if `month` not provided) | - # | monthly | invalid | - # optional | - # | weekly | invalid | - # invalid | + # | __interval_unit__ | __month__ | + # __day_of_month__ | + # | :---------------- | :--------------------------------------------- | + # :----------------------------------------- | + # | yearly | optional (required if `day_of_month` provided) | + # optional (invalid if `month` not provided) | + # | monthly | invalid | + # optional | + # | weekly | invalid | + # invalid | # - # Examples: + # Examples: # - # | __interval_unit__ | __interval__ | __month__ | __day_of_month__ | valid? - # | - # | :---------------- | :----------- | :-------- | :--------------- | - # :------------------------------------------------- | - # | yearly | 1 | january | -1 | valid - # | - # | monthly | 6 | | | valid - # | - # | monthly | 6 | | 12 | valid - # | - # | weekly | 2 | | | valid - # | - # | yearly | 1 | march | | - # invalid - missing `day_of_month` | - # | yearly | 1 | | 2 | - # invalid - missing `month` | - # | monthly | 6 | august | 12 | - # invalid - `month` must be blank | - # | weekly | 2 | october | 10 | - # invalid - `month` and `day_of_month` must be blank | + # | __interval_unit__ | __interval__ | __month__ | __day_of_month__ | + # valid? | + # | :---------------- | :----------- | :-------- | :--------------- | + # :------------------------------------------------- | + # | yearly | 1 | january | -1 | valid + # | + # | monthly | 6 | | | valid + # | + # | monthly | 6 | | 12 | valid + # | + # | weekly | 2 | | | valid + # | + # | yearly | 1 | march | | + # invalid - missing `day_of_month` | + # | yearly | 1 | | 2 | + # invalid - missing `month` | + # | monthly | 6 | august | 12 | + # invalid - `month` must be blank | + # | weekly | 2 | october | 10 | + # invalid - `month` and `day_of_month` must be blank | # - # ### Rolling dates + # ### Rolling dates # - # When a charge date falls on a non-business day, one of two things will - # happen: + # When a charge date falls on a non-business day, one of two things will + # happen: # - # - if the recurrence rule specified `-1` as the `day_of_month`, the charge - # date will be rolled __backwards__ to the previous business day (i.e., the - # last working day of the month). - # - otherwise the charge date will be rolled __forwards__ to the next - # business day. + # - if the recurrence rule specified `-1` as the `day_of_month`, the charge + # date will be rolled __backwards__ to the previous business day (i.e., the + # last working day of the month). + # - otherwise the charge date will be rolled __forwards__ to the next + # business day. class Subscription attr_reader :amount attr_reader :app_fee diff --git a/lib/gocardless_pro/resources/tax_rate.rb b/lib/gocardless_pro/resources/tax_rate.rb index a727b65f..ed6042a6 100644 --- a/lib/gocardless_pro/resources/tax_rate.rb +++ b/lib/gocardless_pro/resources/tax_rate.rb @@ -10,10 +10,10 @@ module GoCardlessPro module Resources # Represents an instance of a tax_rate resource returned from the API - # Tax rates from tax authority. + # Tax rates from tax authority. # - # We also maintain a [static list of the tax rates for each - # jurisdiction](#appendix-tax-rates). + # We also maintain a [static list of the tax rates for each + # jurisdiction](#appendix-tax-rates). class TaxRate attr_reader :end_date attr_reader :id diff --git a/lib/gocardless_pro/resources/transferred_mandate.rb b/lib/gocardless_pro/resources/transferred_mandate.rb index 55b437ae..688ca823 100644 --- a/lib/gocardless_pro/resources/transferred_mandate.rb +++ b/lib/gocardless_pro/resources/transferred_mandate.rb @@ -10,7 +10,7 @@ module GoCardlessPro module Resources # Represents an instance of a transferred_mandate resource returned from the API - # Mandates that have been transferred using Current Account Switch Service + # Mandates that have been transferred using Current Account Switch Service class TransferredMandate attr_reader :encrypted_customer_bank_details attr_reader :encrypted_decryption_key diff --git a/lib/gocardless_pro/resources/verification_detail.rb b/lib/gocardless_pro/resources/verification_detail.rb index df411dd6..b1381be7 100644 --- a/lib/gocardless_pro/resources/verification_detail.rb +++ b/lib/gocardless_pro/resources/verification_detail.rb @@ -10,17 +10,17 @@ module GoCardlessPro module Resources # Represents an instance of a verification_detail resource returned from the API - # Verification details represent any information needed by GoCardless to - # verify a creditor. + # Verification details represent any information needed by GoCardless to + # verify a creditor. # - #Restricted: - # These endpoints are restricted to customers who want to collect their - # merchant's - # verification details and pass them to GoCardless via our API. Please - # [get in - # touch](mailto:help@gocardless.com) if you wish to enable this feature on - # your - # account.
+ #Restricted: + # These endpoints are restricted to customers who want to collect their + # merchant's + # verification details and pass them to GoCardless via our API. Please + # [get in + # touch](mailto:help@gocardless.com) if you wish to enable this feature + # on your + # account.
class VerificationDetail attr_reader :address_line1 attr_reader :address_line2 diff --git a/lib/gocardless_pro/resources/webhook.rb b/lib/gocardless_pro/resources/webhook.rb index 691ae816..de951050 100644 --- a/lib/gocardless_pro/resources/webhook.rb +++ b/lib/gocardless_pro/resources/webhook.rb @@ -10,7 +10,7 @@ module GoCardlessPro module Resources # Represents an instance of a webhook resource returned from the API - # Basic description of a webhook + # Basic description of a webhook class Webhook attr_reader :created_at attr_reader :id diff --git a/lib/gocardless_pro/services/balances_service.rb b/lib/gocardless_pro/services/balances_service.rb index be33f703..49a7ec8c 100644 --- a/lib/gocardless_pro/services/balances_service.rb +++ b/lib/gocardless_pro/services/balances_service.rb @@ -10,8 +10,9 @@ module GoCardlessPro module Services # Service for making requests to the Balance endpoints class BalancesService < BaseService - # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of balances - # for a given creditor. This endpoint is rate limited to 60 requests per minute. + # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of balances + # for a given creditor. This endpoint is rate limited to 60 requests per + # minute. # Example URL: /balances # @param options [Hash] parameters as a hash, under a params key. def list(options = {}) diff --git a/lib/gocardless_pro/services/bank_account_details_service.rb b/lib/gocardless_pro/services/bank_account_details_service.rb index a9ddec76..54f2939f 100644 --- a/lib/gocardless_pro/services/bank_account_details_service.rb +++ b/lib/gocardless_pro/services/bank_account_details_service.rb @@ -10,16 +10,16 @@ module GoCardlessPro module Services # Service for making requests to the BankAccountDetail endpoints class BankAccountDetailsService < BaseService - # Returns bank account details in the flattened JSON Web Encryption format - # described in RFC 7516. + # Returns bank account details in the flattened JSON Web Encryption format + # described in RFC 7516. # - # You must specify a `Gc-Key-Id` header when using this endpoint. See [Public - # Key - # Setup](https://developer.gocardless.com/gc-embed/bank-details-access#public_key_setup) - # for more details. + # You must specify a `Gc-Key-Id` header when using this endpoint. See [Public + # Key + # Setup](https://developer.gocardless.com/gc-embed/bank-details-access#public_key_setup) + # for more details. # Example URL: /bank_account_details/:identity # - # @param identity # Unique identifier, beginning with "BA". + # @param identity # Unique identifier, beginning with "BA". # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/bank_account_details/:identity', { diff --git a/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb b/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb index 8b5b8b5f..9b0a09b6 100644 --- a/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb +++ b/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb @@ -10,10 +10,10 @@ module GoCardlessPro module Services # Service for making requests to the BankAccountHolderVerification endpoints class BankAccountHolderVerificationsService < BaseService - # Verify the account holder of the bank account. A complete verification can be - # attached when creating an outbound payment. This endpoint allows partner - # merchants to create Confirmation of Payee checks on customer bank accounts - # before sending outbound payments. + # Verify the account holder of the bank account. A complete verification can be + # attached when creating an outbound payment. This endpoint allows partner + # merchants to create Confirmation of Payee checks on customer bank accounts + # before sending outbound payments. # Example URL: /bank_account_holder_verifications # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) @@ -48,11 +48,11 @@ def create(options = {}) Resources::BankAccountHolderVerification.new(unenvelope_body(response.body), response) end - # Fetches a bank account holder verification by ID. + # Fetches a bank account holder verification by ID. # Example URL: /bank_account_holder_verifications/:identity # - # @param identity # The unique identifier for the bank account holder verification resource, - # e.g. "BAHV123". + # @param identity # The unique identifier for the bank account holder verification + # resource, e.g. "BAHV123". # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/bank_account_holder_verifications/:identity', { diff --git a/lib/gocardless_pro/services/bank_authorisations_service.rb b/lib/gocardless_pro/services/bank_authorisations_service.rb index 8412f14c..85460d25 100644 --- a/lib/gocardless_pro/services/bank_authorisations_service.rb +++ b/lib/gocardless_pro/services/bank_authorisations_service.rb @@ -10,7 +10,7 @@ module GoCardlessPro module Services # Service for making requests to the BankAuthorisation endpoints class BankAuthorisationsService < BaseService - # Create a Bank Authorisation. + # Create a Bank Authorisation. # Example URL: /bank_authorisations # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) @@ -45,10 +45,10 @@ def create(options = {}) Resources::BankAuthorisation.new(unenvelope_body(response.body), response) end - # Get a single bank authorisation. + # Get a single bank authorisation. # Example URL: /bank_authorisations/:identity # - # @param identity # Unique identifier, beginning with "BAU". + # @param identity # Unique identifier, beginning with "BAU". # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/bank_authorisations/:identity', { diff --git a/lib/gocardless_pro/services/bank_details_lookups_service.rb b/lib/gocardless_pro/services/bank_details_lookups_service.rb index a4ccbfbf..1b1f5e43 100644 --- a/lib/gocardless_pro/services/bank_details_lookups_service.rb +++ b/lib/gocardless_pro/services/bank_details_lookups_service.rb @@ -10,35 +10,36 @@ module GoCardlessPro module Services # Service for making requests to the BankDetailsLookup endpoints class BankDetailsLookupsService < BaseService - # Performs a bank details lookup. As part of the lookup, a modulus check and - # reachability check are performed. + # Performs a bank details lookup. As part of the lookup, a modulus check and + # reachability check are performed. # - # For UK-based bank accounts, where an account holder name is provided (and an - # account number, a sort code or an iban - # are already present), we verify that the account holder name and bank account - # number match the details held by - # the relevant bank. + # For UK-based bank accounts, where an account holder name is provided (and an + # account number, a sort code or an iban + # are already present), we verify that the account holder name and bank account + # number match the details held by + # the relevant bank. # - # If your request returns an [error](#api-usage-errors) or the - # `available_debit_schemes` - # attribute is an empty array, you will not be able to collect payments from the - # specified bank account. GoCardless may be able to collect payments from an - # account - # even if no `bic` is returned. + # If your request returns an [error](#api-usage-errors) or the + # `available_debit_schemes` + # attribute is an empty array, you will not be able to collect payments from + # the + # specified bank account. GoCardless may be able to collect payments from an + # account + # even if no `bic` is returned. # - # Bank account details may be supplied using [local - # details](#appendix-local-bank-details) or an IBAN. + # Bank account details may be supplied using [local + # details](#appendix-local-bank-details) or an IBAN. # - # _ACH scheme_ For compliance reasons, an extra validation step is done using - # a third-party provider to make sure the customer's bank account can accept - # Direct Debit. If a bank account is discovered to be closed or invalid, the - # customer is requested to adjust the account number/routing number and - # succeed in this check to continue with the flow. + # _ACH scheme_ For compliance reasons, an extra validation step is done using + # a third-party provider to make sure the customer's bank account can accept + # Direct Debit. If a bank account is discovered to be closed or invalid, the + # customer is requested to adjust the account number/routing number and + # succeed in this check to continue with the flow. # - # _Note:_ Usage of this endpoint is monitored. If your organisation relies on - # GoCardless for - # modulus or reachability checking but not for payment collection, please get in - # touch. + # _Note:_ Usage of this endpoint is monitored. If your organisation relies on + # GoCardless for + # modulus or reachability checking but not for payment collection, please get + # in touch. # Example URL: /bank_details_lookups # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) diff --git a/lib/gocardless_pro/services/billing_request_flows_service.rb b/lib/gocardless_pro/services/billing_request_flows_service.rb index 66c44119..e6ab1b4d 100644 --- a/lib/gocardless_pro/services/billing_request_flows_service.rb +++ b/lib/gocardless_pro/services/billing_request_flows_service.rb @@ -10,7 +10,7 @@ module GoCardlessPro module Services # Service for making requests to the BillingRequestFlow endpoints class BillingRequestFlowsService < BaseService - # Creates a new billing request flow. + # Creates a new billing request flow. # Example URL: /billing_request_flows # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) @@ -29,12 +29,12 @@ def create(options = {}) Resources::BillingRequestFlow.new(unenvelope_body(response.body), response) end - # Returns the flow having generated a fresh session token which can be used to - # power - # integrations that manipulate the flow. + # Returns the flow having generated a fresh session token which can be used to + # power + # integrations that manipulate the flow. # Example URL: /billing_request_flows/:identity/actions/initialise # - # @param identity # Unique identifier, beginning with "BRF". + # @param identity # Unique identifier, beginning with "BRF". # @param options [Hash] parameters as a hash, under a params key. def initialise(identity, options = {}) path = sub_url('/billing_request_flows/:identity/actions/initialise', { diff --git a/lib/gocardless_pro/services/billing_request_templates_service.rb b/lib/gocardless_pro/services/billing_request_templates_service.rb index d368f5c4..d8ce3a9c 100644 --- a/lib/gocardless_pro/services/billing_request_templates_service.rb +++ b/lib/gocardless_pro/services/billing_request_templates_service.rb @@ -10,8 +10,8 @@ module GoCardlessPro module Services # Service for making requests to the BillingRequestTemplate endpoints class BillingRequestTemplatesService < BaseService - # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your - # Billing Request Templates. + # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your + # Billing Request Templates. # Example URL: /billing_request_templates # @param options [Hash] parameters as a hash, under a params key. def list(options = {}) @@ -39,10 +39,10 @@ def all(options = {}) ).enumerator end - # Fetches a Billing Request Template + # Fetches a Billing Request Template # Example URL: /billing_request_templates/:identity # - # @param identity # Unique identifier, beginning with "BRT". + # @param identity # Unique identifier, beginning with "BRT". # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/billing_request_templates/:identity', { @@ -93,11 +93,11 @@ def create(options = {}) Resources::BillingRequestTemplate.new(unenvelope_body(response.body), response) end - # Updates a Billing Request Template, which will affect all future Billing - # Requests created by this template. + # Updates a Billing Request Template, which will affect all future Billing + # Requests created by this template. # Example URL: /billing_request_templates/:identity # - # @param identity # Unique identifier, beginning with "BRT". + # @param identity # Unique identifier, beginning with "BRT". # @param options [Hash] parameters as a hash, under a params key. def update(identity, options = {}) path = sub_url('/billing_request_templates/:identity', { diff --git a/lib/gocardless_pro/services/billing_request_with_actions_service.rb b/lib/gocardless_pro/services/billing_request_with_actions_service.rb index 5d58af25..945dcc45 100644 --- a/lib/gocardless_pro/services/billing_request_with_actions_service.rb +++ b/lib/gocardless_pro/services/billing_request_with_actions_service.rb @@ -10,12 +10,12 @@ module GoCardlessPro module Services # Service for making requests to the BillingRequestWithAction endpoints class BillingRequestWithActionsService < BaseService - # Creates a billing request and completes any specified actions in a single - # request. - # This endpoint allows you to create a billing request and immediately complete - # actions - # such as collecting customer details, bank account details, or other required - # actions. + # Creates a billing request and completes any specified actions in a single + # request. + # This endpoint allows you to create a billing request and immediately complete + # actions + # such as collecting customer details, bank account details, or other required + # actions. # Example URL: /billing_requests/create_with_actions # @param options [Hash] parameters as a hash, under a params key. def create_with_actions(options = {}) diff --git a/lib/gocardless_pro/services/billing_requests_service.rb b/lib/gocardless_pro/services/billing_requests_service.rb index 3b45d121..877c4866 100644 --- a/lib/gocardless_pro/services/billing_requests_service.rb +++ b/lib/gocardless_pro/services/billing_requests_service.rb @@ -10,9 +10,9 @@ module GoCardlessPro module Services # Service for making requests to the BillingRequest endpoints class BillingRequestsService < BaseService - #Important: All properties associated with - # `subscription_request` and `instalment_schedule_request` are only supported - # for ACH and PAD schemes.
+ #Important: All properties associated with + # `subscription_request` and `instalment_schedule_request` are only supported + # for ACH and PAD schemes.
# Example URL: /billing_requests # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) @@ -47,19 +47,19 @@ def create(options = {}) Resources::BillingRequest.new(unenvelope_body(response.body), response) end - # If the billing request has a pendingcollect_customer_details
- # action, this endpoint can be used to collect the details in order to
- # complete it.
+ # If the billing request has a pending collect_customer_details
+ # action, this endpoint can be used to collect the details in order to
+ # complete it.
#
- # The endpoint takes the same payload as Customers, but checks that the
- # customer fields are populated correctly for the billing request scheme.
+ # The endpoint takes the same payload as Customers, but checks that the
+ # customer fields are populated correctly for the billing request scheme.
#
- # Whatever is provided to this endpoint is used to update the referenced
- # customer, and will take effect immediately after the request is
- # successful.
+ # Whatever is provided to this endpoint is used to update the referenced
+ # customer, and will take effect immediately after the request is
+ # successful.
# Example URL: /billing_requests/:identity/actions/collect_customer_details
#
- # @param identity # Unique identifier, beginning with "BRQ".
+ # @param identity # Unique identifier, beginning with "BRQ".
# @param options [Hash] parameters as a hash, under a params key.
def collect_customer_details(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/collect_customer_details', {
@@ -95,32 +95,32 @@ def collect_customer_details(identity, options = {})
Resources::BillingRequest.new(unenvelope_body(response.body), response)
end
- # If the billing request has a pending
- # collect_bank_account action, this endpoint can be
- # used to collect the details in order to complete it.
+ # If the billing request has a pending
+ # collect_bank_account action, this endpoint can be
+ # used to collect the details in order to complete it.
#
- # The endpoint takes the same payload as Customer Bank Accounts, but check
- # the bank account is valid for the billing request scheme before creating
- # and attaching it.
+ # The endpoint takes the same payload as Customer Bank Accounts, but check
+ # the bank account is valid for the billing request scheme before creating
+ # and attaching it.
#
- # If the scheme is PayTo and the pay_id is available, this can be included in
- # the payload along with the
- # country_code.
+ # If the scheme is PayTo and the pay_id is available, this can be included in
+ # the payload along with the
+ # country_code.
#
- # _ACH scheme_ For compliance reasons, an extra validation step is done using
- # a third-party provider to make sure the customer's bank account can accept
- # Direct Debit. If a bank account is discovered to be closed or invalid, the
- # customer is requested to adjust the account number/routing number and
- # succeed in this check to continue with the flow.
+ # _ACH scheme_ For compliance reasons, an extra validation step is done using
+ # a third-party provider to make sure the customer's bank account can accept
+ # Direct Debit. If a bank account is discovered to be closed or invalid, the
+ # customer is requested to adjust the account number/routing number and
+ # succeed in this check to continue with the flow.
#
- # _BACS scheme_ [Payer Name
- # Verification](https://hub.gocardless.com/s/article/Introduction-to-Payer-Name-Verification?language=en_GB)
- # is enabled by default for UK based bank accounts, meaning we verify the
- # account holder name and bank account
- # number match the details held by the relevant bank.
+ # _BACS scheme_ [Payer Name
+ # Verification](https://hub.gocardless.com/s/article/Introduction-to-Payer-Name-Verification?language=en_GB)
+ # is enabled by default for UK based bank accounts, meaning we verify the
+ # account holder name and bank account
+ # number match the details held by the relevant bank.
# Example URL: /billing_requests/:identity/actions/collect_bank_account
#
- # @param identity # Unique identifier, beginning with "BRQ".
+ # @param identity # Unique identifier, beginning with "BRQ".
# @param options [Hash] parameters as a hash, under a params key.
def collect_bank_account(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/collect_bank_account', {
@@ -156,12 +156,12 @@ def collect_bank_account(identity, options = {})
Resources::BillingRequest.new(unenvelope_body(response.body), response)
end
- # This is needed when you have a mandate request. As a scheme compliance rule we
- # are required to
- # allow the payer to crosscheck the details entered by them and confirm it.
+ # This is needed when you have a mandate request. As a scheme compliance rule
+ # we are required to
+ # allow the payer to crosscheck the details entered by them and confirm it.
# Example URL: /billing_requests/:identity/actions/confirm_payer_details
#
- # @param identity # Unique identifier, beginning with "BRQ".
+ # @param identity # Unique identifier, beginning with "BRQ".
# @param options [Hash] parameters as a hash, under a params key.
def confirm_payer_details(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/confirm_payer_details', {
@@ -197,11 +197,11 @@ def confirm_payer_details(identity, options = {})
Resources::BillingRequest.new(unenvelope_body(response.body), response)
end
- # If a billing request is ready to be fulfilled, call this endpoint to cause
- # it to fulfil, executing the payment.
+ # If a billing request is ready to be fulfilled, call this endpoint to cause
+ # it to fulfil, executing the payment.
# Example URL: /billing_requests/:identity/actions/fulfil
#
- # @param identity # Unique identifier, beginning with "BRQ".
+ # @param identity # Unique identifier, beginning with "BRQ".
# @param options [Hash] parameters as a hash, under a params key.
def fulfil(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/fulfil', {
@@ -237,11 +237,11 @@ def fulfil(identity, options = {})
Resources::BillingRequest.new(unenvelope_body(response.body), response)
end
- # Immediately cancels a billing request, causing all billing request flows
- # to expire.
+ # Immediately cancels a billing request, causing all billing request flows
+ # to expire.
# Example URL: /billing_requests/:identity/actions/cancel
#
- # @param identity # Unique identifier, beginning with "BRQ".
+ # @param identity # Unique identifier, beginning with "BRQ".
# @param options [Hash] parameters as a hash, under a params key.
def cancel(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/cancel', {
@@ -277,8 +277,8 @@ def cancel(identity, options = {})
Resources::BillingRequest.new(unenvelope_body(response.body), response)
end
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
- # billing requests.
+ # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
+ # billing requests.
# Example URL: /billing_requests
# @param options [Hash] parameters as a hash, under a params key.
def list(options = {})
@@ -306,10 +306,10 @@ def all(options = {})
).enumerator
end
- # Fetches a billing request
+ # Fetches a billing request
# Example URL: /billing_requests/:identity
#
- # @param identity # Unique identifier, beginning with "BRQ".
+ # @param identity # Unique identifier, beginning with "BRQ".
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/billing_requests/:identity', {
@@ -325,15 +325,15 @@ def get(identity, options = {})
Resources::BillingRequest.new(unenvelope_body(response.body), response)
end
- # Notifies the customer linked to the billing request, asking them to authorise
- # it.
- # Currently, the customer can only be notified by email.
+ # Notifies the customer linked to the billing request, asking them to authorise
+ # it.
+ # Currently, the customer can only be notified by email.
#
- # This endpoint is currently supported only for Instant Bank Pay Billing
- # Requests.
+ # This endpoint is currently supported only for Instant Bank Pay Billing
+ # Requests.
# Example URL: /billing_requests/:identity/actions/notify
#
- # @param identity # Unique identifier, beginning with "BRQ".
+ # @param identity # Unique identifier, beginning with "BRQ".
# @param options [Hash] parameters as a hash, under a params key.
def notify(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/notify', {
@@ -369,11 +369,11 @@ def notify(identity, options = {})
Resources::BillingRequest.new(unenvelope_body(response.body), response)
end
- # Triggers a fallback from the open-banking flow to direct debit. Note, the
- # billing request must have fallback enabled.
+ # Triggers a fallback from the open-banking flow to direct debit. Note, the
+ # billing request must have fallback enabled.
# Example URL: /billing_requests/:identity/actions/fallback
#
- # @param identity # Unique identifier, beginning with "BRQ".
+ # @param identity # Unique identifier, beginning with "BRQ".
# @param options [Hash] parameters as a hash, under a params key.
def fallback(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/fallback', {
@@ -409,16 +409,16 @@ def fallback(identity, options = {})
Resources::BillingRequest.new(unenvelope_body(response.body), response)
end
- # This will allow for the updating of the currency and subsequently the scheme
- # if
- # needed for a Billing Request. This will only be available for mandate only
- # flows
- # which do not have the lock_currency flag set to true on the Billing Request
- # Flow. It
- # will also not support any request which has a payments request.
+ # This will allow for the updating of the currency and subsequently the scheme
+ # if
+ # needed for a Billing Request. This will only be available for mandate only
+ # flows
+ # which do not have the lock_currency flag set to true on the Billing Request
+ # Flow. It
+ # will also not support any request which has a payments request.
# Example URL: /billing_requests/:identity/actions/choose_currency
#
- # @param identity # Unique identifier, beginning with "BRQ".
+ # @param identity # Unique identifier, beginning with "BRQ".
# @param options [Hash] parameters as a hash, under a params key.
def choose_currency(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/choose_currency', {
@@ -454,10 +454,10 @@ def choose_currency(identity, options = {})
Resources::BillingRequest.new(unenvelope_body(response.body), response)
end
- # Creates an Institution object and attaches it to the Billing Request
+ # Creates an Institution object and attaches it to the Billing Request
# Example URL: /billing_requests/:identity/actions/select_institution
#
- # @param identity # Unique identifier, beginning with "BRQ".
+ # @param identity # Unique identifier, beginning with "BRQ".
# @param options [Hash] parameters as a hash, under a params key.
def select_institution(identity, options = {})
path = sub_url('/billing_requests/:identity/actions/select_institution', {
diff --git a/lib/gocardless_pro/services/blocks_service.rb b/lib/gocardless_pro/services/blocks_service.rb
index 8d57a98f..da055db9 100644
--- a/lib/gocardless_pro/services/blocks_service.rb
+++ b/lib/gocardless_pro/services/blocks_service.rb
@@ -10,7 +10,7 @@ module GoCardlessPro
module Services
# Service for making requests to the Block endpoints
class BlocksService < BaseService
- # Creates a new Block of a given type. By default it will be active.
+ # Creates a new Block of a given type. By default it will be active.
# Example URL: /blocks
# @param options [Hash] parameters as a hash, under a params key.
def create(options = {})
@@ -45,10 +45,10 @@ def create(options = {})
Resources::Block.new(unenvelope_body(response.body), response)
end
- # Retrieves the details of an existing block.
+ # Retrieves the details of an existing block.
# Example URL: /blocks/:identity
#
- # @param identity # Unique identifier, beginning with "BLC".
+ # @param identity # Unique identifier, beginning with "BLC".
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/blocks/:identity', {
@@ -64,8 +64,8 @@ def get(identity, options = {})
Resources::Block.new(unenvelope_body(response.body), response)
end
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
- # blocks.
+ # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
+ # blocks.
# Example URL: /blocks
# @param options [Hash] parameters as a hash, under a params key.
def list(options = {})
@@ -93,10 +93,10 @@ def all(options = {})
).enumerator
end
- # Disables a block so that it no longer will prevent mandate creation.
+ # Disables a block so that it no longer will prevent mandate creation.
# Example URL: /blocks/:identity/actions/disable
#
- # @param identity # Unique identifier, beginning with "BLC".
+ # @param identity # Unique identifier, beginning with "BLC".
# @param options [Hash] parameters as a hash, under a params key.
def disable(identity, options = {})
path = sub_url('/blocks/:identity/actions/disable', {
@@ -132,10 +132,10 @@ def disable(identity, options = {})
Resources::Block.new(unenvelope_body(response.body), response)
end
- # Enables a previously disabled block so that it will prevent mandate creation
+ # Enables a previously disabled block so that it will prevent mandate creation
# Example URL: /blocks/:identity/actions/enable
#
- # @param identity # Unique identifier, beginning with "BLC".
+ # @param identity # Unique identifier, beginning with "BLC".
# @param options [Hash] parameters as a hash, under a params key.
def enable(identity, options = {})
path = sub_url('/blocks/:identity/actions/enable', {
@@ -171,10 +171,10 @@ def enable(identity, options = {})
Resources::Block.new(unenvelope_body(response.body), response)
end
- # Creates new blocks for a given reference. By default blocks will be active.
- # Returns 201 if at least one block was created. Returns 200 if there were no
- # new
- # blocks created.
+ # Creates new blocks for a given reference. By default blocks will be active.
+ # Returns 201 if at least one block was created. Returns 200 if there were no
+ # new
+ # blocks created.
# Example URL: /blocks/block_by_ref
# @param options [Hash] parameters as a hash, under a params key.
def block_by_ref(options = {})
diff --git a/lib/gocardless_pro/services/creditor_bank_accounts_service.rb b/lib/gocardless_pro/services/creditor_bank_accounts_service.rb
index 11becb96..c5c504ad 100644
--- a/lib/gocardless_pro/services/creditor_bank_accounts_service.rb
+++ b/lib/gocardless_pro/services/creditor_bank_accounts_service.rb
@@ -10,7 +10,7 @@ module GoCardlessPro
module Services
# Service for making requests to the CreditorBankAccount endpoints
class CreditorBankAccountsService < BaseService
- # Creates a new creditor bank account object.
+ # Creates a new creditor bank account object.
# Example URL: /creditor_bank_accounts
# @param options [Hash] parameters as a hash, under a params key.
def create(options = {})
@@ -45,8 +45,8 @@ def create(options = {})
Resources::CreditorBankAccount.new(unenvelope_body(response.body), response)
end
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
- # creditor bank accounts.
+ # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
+ # creditor bank accounts.
# Example URL: /creditor_bank_accounts
# @param options [Hash] parameters as a hash, under a params key.
def list(options = {})
@@ -74,10 +74,10 @@ def all(options = {})
).enumerator
end
- # Retrieves the details of an existing creditor bank account.
+ # Retrieves the details of an existing creditor bank account.
# Example URL: /creditor_bank_accounts/:identity
#
- # @param identity # Unique identifier, beginning with "BA".
+ # @param identity # Unique identifier, beginning with "BA".
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/creditor_bank_accounts/:identity', {
@@ -93,17 +93,17 @@ def get(identity, options = {})
Resources::CreditorBankAccount.new(unenvelope_body(response.body), response)
end
- # Immediately disables the bank account, no money can be paid out to a disabled
- # account.
+ # Immediately disables the bank account, no money can be paid out to a disabled
+ # account.
#
- # This will return a `disable_failed` error if the bank account has already been
- # disabled.
+ # This will return a `disable_failed` error if the bank account has already
+ # been disabled.
#
- # A disabled bank account can be re-enabled by creating a new bank account
- # resource with the same details.
+ # A disabled bank account can be re-enabled by creating a new bank account
+ # resource with the same details.
# Example URL: /creditor_bank_accounts/:identity/actions/disable
#
- # @param identity # Unique identifier, beginning with "BA".
+ # @param identity # Unique identifier, beginning with "BA".
# @param options [Hash] parameters as a hash, under a params key.
def disable(identity, options = {})
path = sub_url('/creditor_bank_accounts/:identity/actions/disable', {
diff --git a/lib/gocardless_pro/services/creditors_service.rb b/lib/gocardless_pro/services/creditors_service.rb
index f7b1d074..b3becc1e 100644
--- a/lib/gocardless_pro/services/creditors_service.rb
+++ b/lib/gocardless_pro/services/creditors_service.rb
@@ -10,7 +10,7 @@ module GoCardlessPro
module Services
# Service for making requests to the Creditor endpoints
class CreditorsService < BaseService
- # Creates a new creditor.
+ # Creates a new creditor.
# Example URL: /creditors
# @param options [Hash] parameters as a hash, under a params key.
def create(options = {})
@@ -45,8 +45,8 @@ def create(options = {})
Resources::Creditor.new(unenvelope_body(response.body), response)
end
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
- # creditors.
+ # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
+ # creditors.
# Example URL: /creditors
# @param options [Hash] parameters as a hash, under a params key.
def list(options = {})
@@ -74,10 +74,10 @@ def all(options = {})
).enumerator
end
- # Retrieves the details of an existing creditor.
+ # Retrieves the details of an existing creditor.
# Example URL: /creditors/:identity
#
- # @param identity # Unique identifier, beginning with "CR".
+ # @param identity # Unique identifier, beginning with "CR".
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/creditors/:identity', {
@@ -93,11 +93,11 @@ def get(identity, options = {})
Resources::Creditor.new(unenvelope_body(response.body), response)
end
- # Updates a creditor object. Supports all of the fields supported when creating
- # a creditor.
+ # Updates a creditor object. Supports all of the fields supported when creating
+ # a creditor.
# Example URL: /creditors/:identity
#
- # @param identity # Unique identifier, beginning with "CR".
+ # @param identity # Unique identifier, beginning with "CR".
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/creditors/:identity', {
diff --git a/lib/gocardless_pro/services/currency_exchange_rates_service.rb b/lib/gocardless_pro/services/currency_exchange_rates_service.rb
index 15e57e13..143625ce 100644
--- a/lib/gocardless_pro/services/currency_exchange_rates_service.rb
+++ b/lib/gocardless_pro/services/currency_exchange_rates_service.rb
@@ -10,8 +10,8 @@ module GoCardlessPro
module Services
# Service for making requests to the CurrencyExchangeRate endpoints
class CurrencyExchangeRatesService < BaseService
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of all
- # exchange rates.
+ # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of all
+ # exchange rates.
# Example URL: /currency_exchange_rates
# @param options [Hash] parameters as a hash, under a params key.
def list(options = {})
diff --git a/lib/gocardless_pro/services/customer_bank_accounts_service.rb b/lib/gocardless_pro/services/customer_bank_accounts_service.rb
index 5dbf1673..41485d1d 100644
--- a/lib/gocardless_pro/services/customer_bank_accounts_service.rb
+++ b/lib/gocardless_pro/services/customer_bank_accounts_service.rb
@@ -10,19 +10,19 @@ module GoCardlessPro
module Services
# Service for making requests to the CustomerBankAccount endpoints
class CustomerBankAccountsService < BaseService
- # Creates a new customer bank account object.
+ # Creates a new customer bank account object.
#
- # There are three different ways to supply bank account details:
+ # There are three different ways to supply bank account details:
#
- # - [Local details](#appendix-local-bank-details)
+ # - [Local details](#appendix-local-bank-details)
#
- # - IBAN
+ # - IBAN
#
- # - [Customer Bank Account
- # Tokens](#javascript-flow-create-a-customer-bank-account-token)
+ # - [Customer Bank Account
+ # Tokens](#javascript-flow-create-a-customer-bank-account-token)
#
- # For more information on the different fields required in each country, see
- # [local bank details](#appendix-local-bank-details).
+ # For more information on the different fields required in each country, see
+ # [local bank details](#appendix-local-bank-details).
# Example URL: /customer_bank_accounts
# @param options [Hash] parameters as a hash, under a params key.
def create(options = {})
@@ -57,8 +57,8 @@ def create(options = {})
Resources::CustomerBankAccount.new(unenvelope_body(response.body), response)
end
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your bank
- # accounts.
+ # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your bank
+ # accounts.
# Example URL: /customer_bank_accounts
# @param options [Hash] parameters as a hash, under a params key.
def list(options = {})
@@ -86,10 +86,10 @@ def all(options = {})
).enumerator
end
- # Retrieves the details of an existing bank account.
+ # Retrieves the details of an existing bank account.
# Example URL: /customer_bank_accounts/:identity
#
- # @param identity # Unique identifier, beginning with "BA".
+ # @param identity # Unique identifier, beginning with "BA".
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/customer_bank_accounts/:identity', {
@@ -105,11 +105,11 @@ def get(identity, options = {})
Resources::CustomerBankAccount.new(unenvelope_body(response.body), response)
end
- # Updates a customer bank account object. Only the metadata parameter is
- # allowed.
+ # Updates a customer bank account object. Only the metadata parameter is
+ # allowed.
# Example URL: /customer_bank_accounts/:identity
#
- # @param identity # Unique identifier, beginning with "BA".
+ # @param identity # Unique identifier, beginning with "BA".
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/customer_bank_accounts/:identity', {
@@ -129,16 +129,16 @@ def update(identity, options = {})
Resources::CustomerBankAccount.new(unenvelope_body(response.body), response)
end
- # Immediately cancels all associated mandates and cancellable payments.
+ # Immediately cancels all associated mandates and cancellable payments.
#
- # This will return a `disable_failed` error if the bank account has already been
- # disabled.
+ # This will return a `disable_failed` error if the bank account has already
+ # been disabled.
#
- # A disabled bank account can be re-enabled by creating a new bank account
- # resource with the same details.
+ # A disabled bank account can be re-enabled by creating a new bank account
+ # resource with the same details.
# Example URL: /customer_bank_accounts/:identity/actions/disable
#
- # @param identity # Unique identifier, beginning with "BA".
+ # @param identity # Unique identifier, beginning with "BA".
# @param options [Hash] parameters as a hash, under a params key.
def disable(identity, options = {})
path = sub_url('/customer_bank_accounts/:identity/actions/disable', {
diff --git a/lib/gocardless_pro/services/customer_notifications_service.rb b/lib/gocardless_pro/services/customer_notifications_service.rb
index e2423385..416c68f1 100644
--- a/lib/gocardless_pro/services/customer_notifications_service.rb
+++ b/lib/gocardless_pro/services/customer_notifications_service.rb
@@ -10,17 +10,17 @@ module GoCardlessPro
module Services
# Service for making requests to the CustomerNotification endpoints
class CustomerNotificationsService < BaseService
- # "Handling" a notification means that you have sent the notification yourself
- # (and
- # don't want GoCardless to send it).
- # If the notification has already been actioned, or the deadline to notify has
- # passed,
- # this endpoint will return an `already_actioned` error and you should not take
- # further action. This endpoint takes no additional parameters.
+ # "Handling" a notification means that you have sent the notification yourself
+ # (and
+ # don't want GoCardless to send it).
+ # If the notification has already been actioned, or the deadline to notify has
+ # passed,
+ # this endpoint will return an `already_actioned` error and you should not take
+ # further action. This endpoint takes no additional parameters.
#
# Example URL: /customer_notifications/:identity/actions/handle
#
- # @param identity # The id of the notification.
+ # @param identity # The id of the notification.
# @param options [Hash] parameters as a hash, under a params key.
def handle(identity, options = {})
path = sub_url('/customer_notifications/:identity/actions/handle', {
diff --git a/lib/gocardless_pro/services/customers_service.rb b/lib/gocardless_pro/services/customers_service.rb
index 3aed5929..419837e3 100644
--- a/lib/gocardless_pro/services/customers_service.rb
+++ b/lib/gocardless_pro/services/customers_service.rb
@@ -10,7 +10,7 @@ module GoCardlessPro
module Services
# Service for making requests to the Customer endpoints
class CustomersService < BaseService
- # Creates a new customer object.
+ # Creates a new customer object.
# Example URL: /customers
# @param options [Hash] parameters as a hash, under a params key.
def create(options = {})
@@ -45,8 +45,8 @@ def create(options = {})
Resources::Customer.new(unenvelope_body(response.body), response)
end
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
- # customers.
+ # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
+ # customers.
# Example URL: /customers
# @param options [Hash] parameters as a hash, under a params key.
def list(options = {})
@@ -74,10 +74,10 @@ def all(options = {})
).enumerator
end
- # Retrieves the details of an existing customer.
+ # Retrieves the details of an existing customer.
# Example URL: /customers/:identity
#
- # @param identity # Unique identifier, beginning with "CU".
+ # @param identity # Unique identifier, beginning with "CU".
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/customers/:identity', {
@@ -93,11 +93,11 @@ def get(identity, options = {})
Resources::Customer.new(unenvelope_body(response.body), response)
end
- # Updates a customer object. Supports all of the fields supported when creating
- # a customer.
+ # Updates a customer object. Supports all of the fields supported when creating
+ # a customer.
# Example URL: /customers/:identity
#
- # @param identity # Unique identifier, beginning with "CU".
+ # @param identity # Unique identifier, beginning with "CU".
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/customers/:identity', {
@@ -117,17 +117,17 @@ def update(identity, options = {})
Resources::Customer.new(unenvelope_body(response.body), response)
end
- # Removed customers will not appear in search results or lists of customers (in
- # our API
- # or exports), and it will not be possible to load an individually removed
- # customer by
- # ID.
+ # Removed customers will not appear in search results or lists of customers (in
+ # our API
+ # or exports), and it will not be possible to load an individually removed
+ # customer by
+ # ID.
#
- # The action of removing a customer cannot - # be reversed, so please use with care.
+ #The action of removing a customer cannot + # be reversed, so please use with care.
# Example URL: /customers/:identity # - # @param identity # Unique identifier, beginning with "CU". + # @param identity # Unique identifier, beginning with "CU". # @param options [Hash] parameters as a hash, under a params key. def remove(identity, options = {}) path = sub_url('/customers/:identity', { diff --git a/lib/gocardless_pro/services/events_service.rb b/lib/gocardless_pro/services/events_service.rb index bea0c258..a1024b10 100644 --- a/lib/gocardless_pro/services/events_service.rb +++ b/lib/gocardless_pro/services/events_service.rb @@ -10,8 +10,8 @@ module GoCardlessPro module Services # Service for making requests to the Event endpoints class EventsService < BaseService - # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your - # events. + # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your + # events. # Example URL: /events # @param options [Hash] parameters as a hash, under a params key. def list(options = {}) @@ -39,10 +39,10 @@ def all(options = {}) ).enumerator end - # Retrieves the details of a single event. + # Retrieves the details of a single event. # Example URL: /events/:identity # - # @param identity # Unique identifier, beginning with "EV". + # @param identity # Unique identifier, beginning with "EV". # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/events/:identity', { diff --git a/lib/gocardless_pro/services/exports_service.rb b/lib/gocardless_pro/services/exports_service.rb index c9584974..01bc90c3 100644 --- a/lib/gocardless_pro/services/exports_service.rb +++ b/lib/gocardless_pro/services/exports_service.rb @@ -10,10 +10,10 @@ module GoCardlessPro module Services # Service for making requests to the Export endpoints class ExportsService < BaseService - # Returns a single export. + # Returns a single export. # Example URL: /exports/:identity # - # @param identity # Unique identifier, beginning with "EX". + # @param identity # Unique identifier, beginning with "EX". # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/exports/:identity', { @@ -29,7 +29,7 @@ def get(identity, options = {}) Resources::Export.new(unenvelope_body(response.body), response) end - # Returns a list of exports which are available for download. + # Returns a list of exports which are available for download. # Example URL: /exports # @param options [Hash] parameters as a hash, under a params key. def list(options = {}) diff --git a/lib/gocardless_pro/services/funds_availabilities_service.rb b/lib/gocardless_pro/services/funds_availabilities_service.rb index f87fb4a6..e7055fe4 100644 --- a/lib/gocardless_pro/services/funds_availabilities_service.rb +++ b/lib/gocardless_pro/services/funds_availabilities_service.rb @@ -10,13 +10,13 @@ module GoCardlessPro module Services # Service for making requests to the FundsAvailability endpoints class FundsAvailabilitiesService < BaseService - # Checks if the payer's current balance is sufficient to cover the amount - # the merchant wants to charge within the consent parameters defined on the - # mandate. + # Checks if the payer's current balance is sufficient to cover the amount + # the merchant wants to charge within the consent parameters defined on the + # mandate. # Example URL: /funds_availability/:identity # - # @param identity # Unique identifier, beginning with "MD". Note that this prefix may not - # apply to mandates created before 2016. + # @param identity # Unique identifier, beginning with "MD". Note that this prefix may not + # apply to mandates created before 2016. # @param options [Hash] parameters as a hash, under a params key. def check(identity, options = {}) path = sub_url('/funds_availability/:identity', { diff --git a/lib/gocardless_pro/services/instalment_schedules_service.rb b/lib/gocardless_pro/services/instalment_schedules_service.rb index 8eab203c..5e1e3fe5 100644 --- a/lib/gocardless_pro/services/instalment_schedules_service.rb +++ b/lib/gocardless_pro/services/instalment_schedules_service.rb @@ -10,25 +10,25 @@ module GoCardlessPro module Services # Service for making requests to the InstalmentSchedule endpoints class InstalmentSchedulesService < BaseService - # Creates a new instalment schedule object, along with the associated payments. - # This - # API is recommended if you know the specific dates you wish to charge. - # Otherwise, - # please check out the [scheduling - # version](#instalment-schedules-create-with-schedule). + # Creates a new instalment schedule object, along with the associated payments. + # This + # API is recommended if you know the specific dates you wish to charge. + # Otherwise, + # please check out the [scheduling + # version](#instalment-schedules-create-with-schedule). # - # The `instalments` property is an array of payment properties (`amount` and - # `charge_date`). + # The `instalments` property is an array of payment properties (`amount` and + # `charge_date`). # - # It can take quite a while to create the associated payments, so the API will - # return - # the status as `pending` initially. When processing has completed, a subsequent - # GET - # request for the instalment schedule will either have the status `success` and - # link - # to the created payments, or the status `error` and detailed information about - # the - # failures. + # It can take quite a while to create the associated payments, so the API will + # return + # the status as `pending` initially. When processing has completed, a + # subsequent GET + # request for the instalment schedule will either have the status `success` and + # link + # to the created payments, or the status `error` and detailed information about + # the + # failures. # Example URL: /instalment_schedules # @param options [Hash] parameters as a hash, under a params key. def create_with_dates(options = {}) @@ -63,20 +63,22 @@ def create_with_dates(options = {}) Resources::InstalmentSchedule.new(unenvelope_body(response.body), response) end - # Creates a new instalment schedule object, along with the associated payments. - # This - # API is recommended if you wish to use the GoCardless scheduling logic. For - # finer - # control over the individual dates, please check out the [alternative - # version](#instalment-schedules-create-with-dates). + # Creates a new instalment schedule object, along with the associated payments. + # This + # API is recommended if you wish to use the GoCardless scheduling logic. For + # finer + # control over the individual dates, please check out the [alternative + # version](#instalment-schedules-create-with-dates). # - # It can take quite a while to create the associated payments, so the API will - # return - # the status as `pending` initially. When processing has completed, a subsequent - # GET request for the instalment schedule will either have the status `success` - # and link to - # the created payments, or the status `error` and detailed information about the - # failures. + # It can take quite a while to create the associated payments, so the API will + # return + # the status as `pending` initially. When processing has completed, a + # subsequent + # GET request for the instalment schedule will either have the status `success` + # and link to + # the created payments, or the status `error` and detailed information about + # the + # failures. # Example URL: /instalment_schedules # @param options [Hash] parameters as a hash, under a params key. def create_with_schedule(options = {}) @@ -111,8 +113,8 @@ def create_with_schedule(options = {}) Resources::InstalmentSchedule.new(unenvelope_body(response.body), response) end - # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your - # instalment schedules. + # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your + # instalment schedules. # Example URL: /instalment_schedules # @param options [Hash] parameters as a hash, under a params key. def list(options = {}) @@ -140,10 +142,10 @@ def all(options = {}) ).enumerator end - # Retrieves the details of an existing instalment schedule. + # Retrieves the details of an existing instalment schedule. # Example URL: /instalment_schedules/:identity # - # @param identity # Unique identifier, beginning with "IS". + # @param identity # Unique identifier, beginning with "IS". # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/instalment_schedules/:identity', { @@ -159,10 +161,10 @@ def get(identity, options = {}) Resources::InstalmentSchedule.new(unenvelope_body(response.body), response) end - # Updates an instalment schedule. This accepts only the metadata parameter. + # Updates an instalment schedule. This accepts only the metadata parameter. # Example URL: /instalment_schedules/:identity # - # @param identity # Unique identifier, beginning with "IS". + # @param identity # Unique identifier, beginning with "IS". # @param options [Hash] parameters as a hash, under a params key. def update(identity, options = {}) path = sub_url('/instalment_schedules/:identity', { @@ -182,14 +184,14 @@ def update(identity, options = {}) Resources::InstalmentSchedule.new(unenvelope_body(response.body), response) end - # Immediately cancels an instalment schedule; no further payments will be - # collected for it. + # Immediately cancels an instalment schedule; no further payments will be + # collected for it. # - # This will fail with a `cancellation_failed` error if the instalment schedule - # is already cancelled or has completed. + # This will fail with a `cancellation_failed` error if the instalment schedule + # is already cancelled or has completed. # Example URL: /instalment_schedules/:identity/actions/cancel # - # @param identity # Unique identifier, beginning with "IS". + # @param identity # Unique identifier, beginning with "IS". # @param options [Hash] parameters as a hash, under a params key. def cancel(identity, options = {}) path = sub_url('/instalment_schedules/:identity/actions/cancel', { diff --git a/lib/gocardless_pro/services/institutions_service.rb b/lib/gocardless_pro/services/institutions_service.rb index 0a154a91..f47f2e92 100644 --- a/lib/gocardless_pro/services/institutions_service.rb +++ b/lib/gocardless_pro/services/institutions_service.rb @@ -10,7 +10,7 @@ module GoCardlessPro module Services # Service for making requests to the Institution endpoints class InstitutionsService < BaseService - # Returns a list of supported institutions. + # Returns a list of supported institutions. # Example URL: /institutions # @param options [Hash] parameters as a hash, under a params key. def list(options = {}) @@ -38,12 +38,12 @@ def all(options = {}) ).enumerator end - # Returns all institutions valid for a Billing Request. + # Returns all institutions valid for a Billing Request. # - # This endpoint is currently supported only for FasterPayments. + # This endpoint is currently supported only for FasterPayments. # Example URL: /billing_requests/:identity/institutions # - # @param identity # Unique identifier, beginning with "BRQ". + # @param identity # Unique identifier, beginning with "BRQ". # @param options [Hash] parameters as a hash, under a params key. def list_for_billing_request(identity, options = {}) path = sub_url('/billing_requests/:identity/institutions', { diff --git a/lib/gocardless_pro/services/logos_service.rb b/lib/gocardless_pro/services/logos_service.rb index eb16415f..a171c253 100644 --- a/lib/gocardless_pro/services/logos_service.rb +++ b/lib/gocardless_pro/services/logos_service.rb @@ -10,13 +10,13 @@ module GoCardlessPro module Services # Service for making requests to the Logo endpoints class LogosService < BaseService - # Creates a new logo associated with a creditor. If a creditor already has a - # logo, this will update the existing logo linked to the creditor. + # Creates a new logo associated with a creditor. If a creditor already has a + # logo, this will update the existing logo linked to the creditor. # - # We support JPG and PNG formats. Your logo will be scaled to a maximum of 300px - # by 40px. For more guidance on how to upload logos that will look - # great across your customer payment page and notification emails see - # [here](https://developer.gocardless.com/gc-embed/setting-up-branding#tips_for_uploading_your_logo). + # We support JPG and PNG formats. Your logo will be scaled to a maximum of + # 300px by 40px. For more guidance on how to upload logos that will look + # great across your customer payment page and notification emails see + # [here](https://developer.gocardless.com/gc-embed/setting-up-branding#tips_for_uploading_your_logo). # Example URL: /branding/logos # @param options [Hash] parameters as a hash, under a params key. def create_for_creditor(options = {}) diff --git a/lib/gocardless_pro/services/mandate_import_entries_service.rb b/lib/gocardless_pro/services/mandate_import_entries_service.rb index 995eac36..861e87e2 100644 --- a/lib/gocardless_pro/services/mandate_import_entries_service.rb +++ b/lib/gocardless_pro/services/mandate_import_entries_service.rb @@ -10,13 +10,13 @@ module GoCardlessPro module Services # Service for making requests to the MandateImportEntry endpoints class MandateImportEntriesService < BaseService - # For an existing [mandate import](#core-endpoints-mandate-imports), this - # endpoint can - # be used to add individual mandates to be imported into GoCardless. + # For an existing [mandate import](#core-endpoints-mandate-imports), this + # endpoint can + # be used to add individual mandates to be imported into GoCardless. # - # You can add no more than 30,000 rows to a single mandate import. - # If you attempt to go over this limit, the API will return a - # `record_limit_exceeded` error. + # You can add no more than 30,000 rows to a single mandate import. + # If you attempt to go over this limit, the API will return a + # `record_limit_exceeded` error. # Example URL: /mandate_import_entries # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) @@ -35,14 +35,14 @@ def create(options = {}) Resources::MandateImportEntry.new(unenvelope_body(response.body), response) end - # For an existing mandate import, this endpoint lists all of the entries - # attached. + # For an existing mandate import, this endpoint lists all of the entries + # attached. # - # After a mandate import has been submitted, you can use this endpoint to - # associate records - # in your system (using the `record_identifier` that you provided when creating - # the - # mandate import). + # After a mandate import has been submitted, you can use this endpoint to + # associate records + # in your system (using the `record_identifier` that you provided when creating + # the + # mandate import). # # Example URL: /mandate_import_entries # @param options [Hash] parameters as a hash, under a params key. diff --git a/lib/gocardless_pro/services/mandate_imports_service.rb b/lib/gocardless_pro/services/mandate_imports_service.rb index 42476310..3e4e9265 100644 --- a/lib/gocardless_pro/services/mandate_imports_service.rb +++ b/lib/gocardless_pro/services/mandate_imports_service.rb @@ -10,11 +10,12 @@ module GoCardlessPro module Services # Service for making requests to the MandateImport endpoints class MandateImportsService < BaseService - # Mandate imports are first created, before mandates are added one-at-a-time, so - # this endpoint merely signals the start of the import process. Once you've - # finished - # adding entries to an import, you should - # [submit](#mandate-imports-submit-a-mandate-import) it. + # Mandate imports are first created, before mandates are added one-at-a-time, + # so + # this endpoint merely signals the start of the import process. Once you've + # finished + # adding entries to an import, you should + # [submit](#mandate-imports-submit-a-mandate-import) it. # Example URL: /mandate_imports # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) @@ -49,10 +50,10 @@ def create(options = {}) Resources::MandateImport.new(unenvelope_body(response.body), response) end - # Returns a single mandate import. + # Returns a single mandate import. # Example URL: /mandate_imports/:identity # - # @param identity # Unique identifier, beginning with "IM". + # @param identity # Unique identifier, beginning with "IM". # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/mandate_imports/:identity', { @@ -68,20 +69,21 @@ def get(identity, options = {}) Resources::MandateImport.new(unenvelope_body(response.body), response) end - # Submits the mandate import, which allows it to be processed by a member of the - # GoCardless team. Once the import has been submitted, it can no longer have - # entries - # added to it. + # Submits the mandate import, which allows it to be processed by a member of + # the + # GoCardless team. Once the import has been submitted, it can no longer have + # entries + # added to it. # - # In our sandbox environment, to aid development, we automatically process - # mandate - # imports approximately 10 seconds after they are submitted. This will allow you - # to - # test both the "submitted" response and wait for the webhook to confirm the - # processing has begun. + # In our sandbox environment, to aid development, we automatically process + # mandate + # imports approximately 10 seconds after they are submitted. This will allow + # you to + # test both the "submitted" response and wait for the webhook to confirm the + # processing has begun. # Example URL: /mandate_imports/:identity/actions/submit # - # @param identity # Unique identifier, beginning with "IM". + # @param identity # Unique identifier, beginning with "IM". # @param options [Hash] parameters as a hash, under a params key. def submit(identity, options = {}) path = sub_url('/mandate_imports/:identity/actions/submit', { @@ -117,16 +119,16 @@ def submit(identity, options = {}) Resources::MandateImport.new(unenvelope_body(response.body), response) end - # Cancels the mandate import, which aborts the import process and stops the - # mandates - # being set up in GoCardless. Once the import has been cancelled, it can no - # longer have - # entries added to it. Mandate imports which have already been submitted or - # processed - # cannot be cancelled. + # Cancels the mandate import, which aborts the import process and stops the + # mandates + # being set up in GoCardless. Once the import has been cancelled, it can no + # longer have + # entries added to it. Mandate imports which have already been submitted or + # processed + # cannot be cancelled. # Example URL: /mandate_imports/:identity/actions/cancel # - # @param identity # Unique identifier, beginning with "IM". + # @param identity # Unique identifier, beginning with "IM". # @param options [Hash] parameters as a hash, under a params key. def cancel(identity, options = {}) path = sub_url('/mandate_imports/:identity/actions/cancel', { diff --git a/lib/gocardless_pro/services/mandate_pdfs_service.rb b/lib/gocardless_pro/services/mandate_pdfs_service.rb index 112507c5..edd216b5 100644 --- a/lib/gocardless_pro/services/mandate_pdfs_service.rb +++ b/lib/gocardless_pro/services/mandate_pdfs_service.rb @@ -10,49 +10,49 @@ module GoCardlessPro module Services # Service for making requests to the MandatePdf endpoints class MandatePdfsService < BaseService - # Generates a PDF mandate and returns its temporary URL. + # Generates a PDF mandate and returns its temporary URL. # - # Customer and bank account details can be left blank (for a blank mandate), - # provided manually, or inferred from the ID of an existing - # [mandate](#core-endpoints-mandates). + # Customer and bank account details can be left blank (for a blank mandate), + # provided manually, or inferred from the ID of an existing + # [mandate](#core-endpoints-mandates). # - # By default, we'll generate PDF mandates in English. + # By default, we'll generate PDF mandates in English. # - # To generate a PDF mandate in another language, set the `Accept-Language` - # header when creating the PDF mandate to the relevant [ISO - # 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code - # supported for the scheme. + # To generate a PDF mandate in another language, set the `Accept-Language` + # header when creating the PDF mandate to the relevant [ISO + # 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code + # supported for the scheme. # - # | Scheme | Supported languages + # | Scheme | Supported languages # - # | - # | :--------------- | - # :------------------------------------------------------------------------------------------------------------------------------------------- - # | - # | ACH | English (`en`) + # | + # | :--------------- | + # :------------------------------------------------------------------------------------------------------------------------------------------- + # | + # | ACH | English (`en`) # - # | - # | Autogiro | English (`en`), Swedish (`sv`) + # | + # | Autogiro | English (`en`), Swedish (`sv`) # - # | - # | Bacs | English (`en`) + # | + # | Bacs | English (`en`) # - # | - # | BECS | English (`en`) + # | + # | BECS | English (`en`) # - # | - # | BECS NZ | English (`en`) + # | + # | BECS NZ | English (`en`) # - # | - # | Betalingsservice | Danish (`da`), English (`en`) + # | + # | Betalingsservice | Danish (`da`), English (`en`) # - # | - # | PAD | English (`en`) + # | + # | PAD | English (`en`) # - # | - # | SEPA Core | Danish (`da`), Dutch (`nl`), English (`en`), French - # (`fr`), German (`de`), Italian (`it`), Portuguese (`pt`), Spanish (`es`), - # Swedish (`sv`) | + # | + # | SEPA Core | Danish (`da`), Dutch (`nl`), English (`en`), French + # (`fr`), German (`de`), Italian (`it`), Portuguese (`pt`), Spanish (`es`), + # Swedish (`sv`) | # Example URL: /mandate_pdfs # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) diff --git a/lib/gocardless_pro/services/mandates_service.rb b/lib/gocardless_pro/services/mandates_service.rb index 6b1cc0dc..368f876f 100644 --- a/lib/gocardless_pro/services/mandates_service.rb +++ b/lib/gocardless_pro/services/mandates_service.rb @@ -10,7 +10,7 @@ module GoCardlessPro module Services # Service for making requests to the Mandate endpoints class MandatesService < BaseService - # Creates a new mandate object. + # Creates a new mandate object. # Example URL: /mandates # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) @@ -45,8 +45,8 @@ def create(options = {}) Resources::Mandate.new(unenvelope_body(response.body), response) end - # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your - # mandates. + # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your + # mandates. # Example URL: /mandates # @param options [Hash] parameters as a hash, under a params key. def list(options = {}) @@ -74,11 +74,11 @@ def all(options = {}) ).enumerator end - # Retrieves the details of an existing mandate. + # Retrieves the details of an existing mandate. # Example URL: /mandates/:identity # - # @param identity # Unique identifier, beginning with "MD". Note that this prefix may not - # apply to mandates created before 2016. + # @param identity # Unique identifier, beginning with "MD". Note that this prefix may not + # apply to mandates created before 2016. # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/mandates/:identity', { @@ -94,11 +94,11 @@ def get(identity, options = {}) Resources::Mandate.new(unenvelope_body(response.body), response) end - # Updates a mandate object. This accepts only the metadata parameter. + # Updates a mandate object. This accepts only the metadata parameter. # Example URL: /mandates/:identity # - # @param identity # Unique identifier, beginning with "MD". Note that this prefix may not - # apply to mandates created before 2016. + # @param identity # Unique identifier, beginning with "MD". Note that this prefix may not + # apply to mandates created before 2016. # @param options [Hash] parameters as a hash, under a params key. def update(identity, options = {}) path = sub_url('/mandates/:identity', { @@ -118,16 +118,16 @@ def update(identity, options = {}) Resources::Mandate.new(unenvelope_body(response.body), response) end - # Immediately cancels a mandate and all associated cancellable payments. Any - # metadata supplied to this endpoint will be stored on the mandate cancellation - # event it causes. + # Immediately cancels a mandate and all associated cancellable payments. Any + # metadata supplied to this endpoint will be stored on the mandate cancellation + # event it causes. # - # This will fail with a `cancellation_failed` error if the mandate is already - # cancelled. + # This will fail with a `cancellation_failed` error if the mandate is already + # cancelled. # Example URL: /mandates/:identity/actions/cancel # - # @param identity # Unique identifier, beginning with "MD". Note that this prefix may not - # apply to mandates created before 2016. + # @param identity # Unique identifier, beginning with "MD". Note that this prefix may not + # apply to mandates created before 2016. # @param options [Hash] parameters as a hash, under a params key. def cancel(identity, options = {}) path = sub_url('/mandates/:identity/actions/cancel', { @@ -163,21 +163,22 @@ def cancel(identity, options = {}) Resources::Mandate.new(unenvelope_body(response.body), response) end - # Reinstates a cancelled or expired mandate - # to the banks. You will receive a `resubmission_requested` webhook, but after - # that reinstating the mandate follows the same process as its initial creation, - # so you will receive a `submitted` webhook, followed by a `reinstated` or - # `failed` webhook up to two working days later. Any metadata supplied to this - # endpoint will be stored on the `resubmission_requested` event it causes. + # Reinstates a cancelled or expired mandate + # to the banks. You will receive a `resubmission_requested` webhook, but after + # that reinstating the mandate follows the same process as its initial + # creation, so you will receive a `submitted` webhook, followed by a + # `reinstated` or `failed` webhook up to two working days later. Any metadata + # supplied to this endpoint will be stored on the `resubmission_requested` + # event it causes. # - # This will fail with a `mandate_not_inactive` error if the mandate is already - # being submitted, or is active. + # This will fail with a `mandate_not_inactive` error if the mandate is already + # being submitted, or is active. # - # Mandates can be resubmitted up to 10 times. + # Mandates can be resubmitted up to 10 times. # Example URL: /mandates/:identity/actions/reinstate # - # @param identity # Unique identifier, beginning with "MD". Note that this prefix may not - # apply to mandates created before 2016. + # @param identity # Unique identifier, beginning with "MD". Note that this prefix may not + # apply to mandates created before 2016. # @param options [Hash] parameters as a hash, under a params key. def reinstate(identity, options = {}) path = sub_url('/mandates/:identity/actions/reinstate', { diff --git a/lib/gocardless_pro/services/negative_balance_limits_service.rb b/lib/gocardless_pro/services/negative_balance_limits_service.rb index e57e94d4..9d2cebea 100644 --- a/lib/gocardless_pro/services/negative_balance_limits_service.rb +++ b/lib/gocardless_pro/services/negative_balance_limits_service.rb @@ -10,8 +10,8 @@ module GoCardlessPro module Services # Service for making requests to the NegativeBalanceLimit endpoints class NegativeBalanceLimitsService < BaseService - # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of negative - # balance limits. + # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of negative + # balance limits. # Example URL: /negative_balance_limits # @param options [Hash] parameters as a hash, under a params key. def list(options = {}) diff --git a/lib/gocardless_pro/services/outbound_payments_service.rb b/lib/gocardless_pro/services/outbound_payments_service.rb index a459cae1..17bafd7b 100644 --- a/lib/gocardless_pro/services/outbound_payments_service.rb +++ b/lib/gocardless_pro/services/outbound_payments_service.rb @@ -45,8 +45,8 @@ def create(options = {}) Resources::OutboundPayment.new(unenvelope_body(response.body), response) end - # Creates an outbound payment to your verified business bank account as the - # recipient. + # Creates an outbound payment to your verified business bank account as the + # recipient. # Example URL: /outbound_payments/withdrawal # @param options [Hash] parameters as a hash, under a params key. def withdraw(options = {}) @@ -81,13 +81,13 @@ def withdraw(options = {}) Resources::OutboundPayment.new(unenvelope_body(response.body), response) end - # Cancels an outbound payment. Only outbound payments with either `verifying`, - # `pending_approval`, or `scheduled` status can be cancelled. - # Once an outbound payment is `executing`, the money moving process has begun - # and cannot be reversed. + # Cancels an outbound payment. Only outbound payments with either `verifying`, + # `pending_approval`, or `scheduled` status can be cancelled. + # Once an outbound payment is `executing`, the money moving process has begun + # and cannot be reversed. # Example URL: /outbound_payments/:identity/actions/cancel # - # @param identity # Unique identifier of the outbound payment. + # @param identity # Unique identifier of the outbound payment. # @param options [Hash] parameters as a hash, under a params key. def cancel(identity, options = {}) path = sub_url('/outbound_payments/:identity/actions/cancel', { @@ -123,11 +123,11 @@ def cancel(identity, options = {}) Resources::OutboundPayment.new(unenvelope_body(response.body), response) end - # Approves an outbound payment. Only outbound payments with the - # “pending_approval” status can be approved. + # Approves an outbound payment. Only outbound payments with the + # “pending_approval” status can be approved. # Example URL: /outbound_payments/:identity/actions/approve # - # @param identity # Unique identifier of the outbound payment. + # @param identity # Unique identifier of the outbound payment. # @param options [Hash] parameters as a hash, under a params key. def approve(identity, options = {}) path = sub_url('/outbound_payments/:identity/actions/approve', { @@ -163,10 +163,10 @@ def approve(identity, options = {}) Resources::OutboundPayment.new(unenvelope_body(response.body), response) end - # Fetches an outbound_payment by ID + # Fetches an outbound_payment by ID # Example URL: /outbound_payments/:identity # - # @param identity # Unique identifier of the outbound payment. + # @param identity # Unique identifier of the outbound payment. # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/outbound_payments/:identity', { @@ -182,8 +182,8 @@ def get(identity, options = {}) Resources::OutboundPayment.new(unenvelope_body(response.body), response) end - # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of outbound - # payments. + # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of outbound + # payments. # Example URL: /outbound_payments # @param options [Hash] parameters as a hash, under a params key. def list(options = {}) @@ -211,10 +211,10 @@ def all(options = {}) ).enumerator end - # Updates an outbound payment object. This accepts only the metadata parameter. + # Updates an outbound payment object. This accepts only the metadata parameter. # Example URL: /outbound_payments/:identity # - # @param identity # Unique identifier of the outbound payment. + # @param identity # Unique identifier of the outbound payment. # @param options [Hash] parameters as a hash, under a params key. def update(identity, options = {}) path = sub_url('/outbound_payments/:identity', { @@ -234,7 +234,7 @@ def update(identity, options = {}) Resources::OutboundPayment.new(unenvelope_body(response.body), response) end - # Retrieve aggregate statistics on outbound payments. + # Retrieve aggregate statistics on outbound payments. # Example URL: /outbound_payments/stats # @param options [Hash] parameters as a hash, under a params key. def stats(options = {}) diff --git a/lib/gocardless_pro/services/payer_authorisations_service.rb b/lib/gocardless_pro/services/payer_authorisations_service.rb index 6322c445..66af6df6 100644 --- a/lib/gocardless_pro/services/payer_authorisations_service.rb +++ b/lib/gocardless_pro/services/payer_authorisations_service.rb @@ -10,11 +10,11 @@ module GoCardlessPro module Services # Service for making requests to the PayerAuthorisation endpoints class PayerAuthorisationsService < BaseService - # Retrieves the details of a single existing Payer Authorisation. It can be used - # for polling the status of a Payer Authorisation. + # Retrieves the details of a single existing Payer Authorisation. It can be + # used for polling the status of a Payer Authorisation. # Example URL: /payer_authorisations/:identity # - # @param identity # Unique identifier, beginning with "PA". + # @param identity # Unique identifier, beginning with "PA". # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/payer_authorisations/:identity', { @@ -30,12 +30,12 @@ def get(identity, options = {}) Resources::PayerAuthorisation.new(unenvelope_body(response.body), response) end - # Creates a Payer Authorisation. The resource is saved to the database even if - # incomplete. An empty array of incomplete_fields means that the resource is - # valid. The ID of the resource is used for the other actions. This endpoint has - # been designed this way so you do not need to save any payer data on your - # servers or the browser while still being able to implement a progressive - # solution, such as a multi-step form. + # Creates a Payer Authorisation. The resource is saved to the database even if + # incomplete. An empty array of incomplete_fields means that the resource is + # valid. The ID of the resource is used for the other actions. This endpoint + # has been designed this way so you do not need to save any payer data on your + # servers or the browser while still being able to implement a progressive + # solution, such as a multi-step form. # Example URL: /payer_authorisations # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) @@ -70,18 +70,18 @@ def create(options = {}) Resources::PayerAuthorisation.new(unenvelope_body(response.body), response) end - # Updates a Payer Authorisation. Updates the Payer Authorisation with the - # request data. Can be invoked as many times as needed. Only fields present in - # the request will be modified. An empty array of incomplete_fields means that - # the resource is valid. This endpoint has been designed this way so you do not - # need to save any payer data on your servers or the browser while still being - # able to implement a progressive solution, such a multi-step form.Note that in order to update the `metadata` attribute values - # it must be sent completely as it overrides the previously existing values. - #
+ # Updates a Payer Authorisation. Updates the Payer Authorisation with the + # request data. Can be invoked as many times as needed. Only fields present in + # the request will be modified. An empty array of incomplete_fields means that + # the resource is valid. This endpoint has been designed this way so you do not + # need to save any payer data on your servers or the browser while still being + # able to implement a progressive solution, such a multi-step form.Note that in order to update the `metadata` attribute values + # it must be sent completely as it overrides the previously existing values. + #
# Example URL: /payer_authorisations/:identity # - # @param identity # Unique identifier, beginning with "PA". + # @param identity # Unique identifier, beginning with "PA". # @param options [Hash] parameters as a hash, under a params key. def update(identity, options = {}) path = sub_url('/payer_authorisations/:identity', { @@ -101,13 +101,13 @@ def update(identity, options = {}) Resources::PayerAuthorisation.new(unenvelope_body(response.body), response) end - # Submits all the data previously pushed to this PayerAuthorisation for - # verification. This time, a 200 HTTP status is returned if the resource is - # valid and a 422 error response in case of validation errors. After it is - # successfully submitted, the Payer Authorisation can no longer be edited. + # Submits all the data previously pushed to this PayerAuthorisation for + # verification. This time, a 200 HTTP status is returned if the resource is + # valid and a 422 error response in case of validation errors. After it is + # successfully submitted, the Payer Authorisation can no longer be edited. # Example URL: /payer_authorisations/:identity/actions/submit # - # @param identity # Unique identifier, beginning with "PA". + # @param identity # Unique identifier, beginning with "PA". # @param options [Hash] parameters as a hash, under a params key. def submit(identity, options = {}) path = sub_url('/payer_authorisations/:identity/actions/submit', { @@ -143,20 +143,20 @@ def submit(identity, options = {}) Resources::PayerAuthorisation.new(unenvelope_body(response.body), response) end - # Confirms the Payer Authorisation, indicating that the resources are ready to - # be created. - # A Payer Authorisation cannot be confirmed if it hasn't been submitted yet. + # Confirms the Payer Authorisation, indicating that the resources are ready to + # be created. + # A Payer Authorisation cannot be confirmed if it hasn't been submitted yet. # - #- # The main use of the confirm endpoint is to enable integrators to acknowledge - # the end of the setup process. - # They might want to make the payers go through some other steps after they go - # through our flow or make them go through the necessary verification mechanism - # (upcoming feature). - #
+ #+ # The main use of the confirm endpoint is to enable integrators to + # acknowledge the end of the setup process. + # They might want to make the payers go through some other steps after they + # go through our flow or make them go through the necessary verification + # mechanism (upcoming feature). + #
# Example URL: /payer_authorisations/:identity/actions/confirm # - # @param identity # Unique identifier, beginning with "PA". + # @param identity # Unique identifier, beginning with "PA". # @param options [Hash] parameters as a hash, under a params key. def confirm(identity, options = {}) path = sub_url('/payer_authorisations/:identity/actions/confirm', { diff --git a/lib/gocardless_pro/services/payer_themes_service.rb b/lib/gocardless_pro/services/payer_themes_service.rb index 290d8456..5fb9c3e3 100644 --- a/lib/gocardless_pro/services/payer_themes_service.rb +++ b/lib/gocardless_pro/services/payer_themes_service.rb @@ -10,9 +10,9 @@ module GoCardlessPro module Services # Service for making requests to the PayerTheme endpoints class PayerThemesService < BaseService - # Creates a new payer theme associated with a creditor. If a creditor already - # has payer themes, this will update the existing payer theme linked to the - # creditor. + # Creates a new payer theme associated with a creditor. If a creditor already + # has payer themes, this will update the existing payer theme linked to the + # creditor. # Example URL: /branding/payer_themes # @param options [Hash] parameters as a hash, under a params key. def create_for_creditor(options = {}) diff --git a/lib/gocardless_pro/services/payment_account_transactions_service.rb b/lib/gocardless_pro/services/payment_account_transactions_service.rb index d2f23b1e..e8cb3e9b 100644 --- a/lib/gocardless_pro/services/payment_account_transactions_service.rb +++ b/lib/gocardless_pro/services/payment_account_transactions_service.rb @@ -10,12 +10,12 @@ module GoCardlessPro module Services # Service for making requests to the PaymentAccountTransaction endpoints class PaymentAccountTransactionsService < BaseService - # List transactions for a given payment account. + # List transactions for a given payment account. # Example URL: /payment_accounts/:identity/transactions # - # @param identity # The unique ID of the [bank - # account](#core-endpoints-creditor-bank-accounts) which happens to be the - # payment account. + # @param identity # The unique ID of the [bank + # account](#core-endpoints-creditor-bank-accounts) which happens to be + # the payment account. # @param options [Hash] parameters as a hash, under a params key. def list(identity, options = {}) path = sub_url('/payment_accounts/:identity/transactions', { @@ -35,9 +35,9 @@ def list(identity, options = {}) # Get a lazily enumerated list of all the items returned. This is similar to the `list` method but will paginate for you automatically. # - # @param identity # The unique ID of the [bank - # account](#core-endpoints-creditor-bank-accounts) which happens to be the - # payment account. + # @param identity # The unique ID of the [bank + # account](#core-endpoints-creditor-bank-accounts) which happens to be + # the payment account. # @param options [Hash] parameters as a hash. If the request is a GET, these will be converted to query parameters. # Otherwise they will be the body of the request. def all(identity, options = {}) diff --git a/lib/gocardless_pro/services/payment_accounts_service.rb b/lib/gocardless_pro/services/payment_accounts_service.rb index c586ad69..f07f5a18 100644 --- a/lib/gocardless_pro/services/payment_accounts_service.rb +++ b/lib/gocardless_pro/services/payment_accounts_service.rb @@ -10,10 +10,10 @@ module GoCardlessPro module Services # Service for making requests to the PaymentAccount endpoints class PaymentAccountsService < BaseService - # Retrieves the details of an existing payment account. + # Retrieves the details of an existing payment account. # Example URL: /payment_accounts/:identity # - # @param identity # Unique identifier, beginning with "BA". + # @param identity # Unique identifier, beginning with "BA". # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/payment_accounts/:identity', { @@ -29,8 +29,8 @@ def get(identity, options = {}) Resources::PaymentAccount.new(unenvelope_body(response.body), response) end - # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your - # payment accounts. + # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your + # payment accounts. # Example URL: /payment_accounts # @param options [Hash] parameters as a hash, under a params key. def list(options = {}) diff --git a/lib/gocardless_pro/services/payments_service.rb b/lib/gocardless_pro/services/payments_service.rb index af97d5d0..bcb87e09 100644 --- a/lib/gocardless_pro/services/payments_service.rb +++ b/lib/gocardless_pro/services/payments_service.rb @@ -10,12 +10,12 @@ module GoCardlessPro module Services # Service for making requests to the Payment endpoints class PaymentsService < BaseService - # Creates a new payment object. + # Creates a new payment object. # - # This fails with a `mandate_is_inactive` error if the linked - # [mandate](#core-endpoints-mandates) is cancelled or has failed. Payments can - # be created against mandates with status of: `pending_customer_approval`, - # `pending_submission`, `submitted`, and `active`. + # This fails with a `mandate_is_inactive` error if the linked + # [mandate](#core-endpoints-mandates) is cancelled or has failed. Payments can + # be created against mandates with status of: `pending_customer_approval`, + # `pending_submission`, `submitted`, and `active`. # Example URL: /payments # @param options [Hash] parameters as a hash, under a params key. def create(options = {}) @@ -50,8 +50,8 @@ def create(options = {}) Resources::Payment.new(unenvelope_body(response.body), response) end - # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your - # payments. + # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your + # payments. # Example URL: /payments # @param options [Hash] parameters as a hash, under a params key. def list(options = {}) @@ -79,10 +79,10 @@ def all(options = {}) ).enumerator end - # Retrieves the details of a single existing payment. + # Retrieves the details of a single existing payment. # Example URL: /payments/:identity # - # @param identity # Unique identifier, beginning with "PM". + # @param identity # Unique identifier, beginning with "PM". # @param options [Hash] parameters as a hash, under a params key. def get(identity, options = {}) path = sub_url('/payments/:identity', { @@ -98,10 +98,10 @@ def get(identity, options = {}) Resources::Payment.new(unenvelope_body(response.body), response) end - # Updates a payment object. This accepts only the metadata parameter. + # Updates a payment object. This accepts only the metadata parameter. # Example URL: /payments/:identity # - # @param identity # Unique identifier, beginning with "PM". + # @param identity # Unique identifier, beginning with "PM". # @param options [Hash] parameters as a hash, under a params key. def update(identity, options = {}) path = sub_url('/payments/:identity', { @@ -121,15 +121,15 @@ def update(identity, options = {}) Resources::Payment.new(unenvelope_body(response.body), response) end - # Cancels the payment if it has not already been submitted to the banks. Any - # metadata supplied to this endpoint will be stored on the payment cancellation - # event it causes. + # Cancels the payment if it has not already been submitted to the banks. Any + # metadata supplied to this endpoint will be stored on the payment cancellation + # event it causes. # - # This will fail with a `cancellation_failed` error unless the payment's status - # is `pending_submission`. + # This will fail with a `cancellation_failed` error unless the payment's status + # is `pending_submission`. # Example URL: /payments/:identity/actions/cancel # - # @param identity # Unique identifier, beginning with "PM". + # @param identity # Unique identifier, beginning with "PM". # @param options [Hash] parameters as a hash, under a params key. def cancel(identity, options = {}) path = sub_url('/payments/:identity/actions/cancel', { @@ -165,19 +165,19 @@ def cancel(identity, options = {}) Resources::Payment.new(unenvelope_body(response.body), response) end - # Retries a failed payment if the underlying mandate - # is active. You will receive a `resubmission_requested` webhook, but after that - # retrying the payment follows the same process as its initial creation, so you - # will receive a `submitted` webhook, followed by a `confirmed` or `failed` - # event. Any metadata supplied to this endpoint will be stored against the - # payment submission event it causes. + # Retries a failed payment if the underlying mandate + # is active. You will receive a `resubmission_requested` webhook, but after + # that retrying the payment follows the same process as its initial creation, + # so you will receive a `submitted` webhook, followed by a `confirmed` or + # `failed` event. Any metadata supplied to this endpoint will be stored against + # the payment submission event it causes. # - # This will return a `retry_failed` error if the payment has not failed. + # This will return a `retry_failed` error if the payment has not failed. # - # Payments can be retried up to 3 times. + # Payments can be retried up to 3 times. # Example URL: /payments/:identity/actions/retry # - # @param identity # Unique identifier, beginning with "PM". + # @param identity # Unique identifier, beginning with "PM". # @param options [Hash] parameters as a hash, under a params key. def retry(identity, options = {}) path = sub_url('/payments/:identity/actions/retry', { diff --git a/lib/gocardless_pro/services/payout_items_service.rb b/lib/gocardless_pro/services/payout_items_service.rb index 818c9038..7d4e223f 100644 --- a/lib/gocardless_pro/services/payout_items_service.rb +++ b/lib/gocardless_pro/services/payout_items_service.rb @@ -10,12 +10,12 @@ module GoCardlessPro module Services # Service for making requests to the PayoutItem endpoints class PayoutItemsService < BaseService - # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of items in - # the payout. + # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of items in + # the payout. # - # This endpoint only serves requests for payouts created in the last 6 - # months. Requests for older payouts will return an HTTP status410
- # Gone.
+ # This endpoint only serves requests for payouts created in the last 6
+ # months. Requests for older payouts will return an HTTP status 410
+ # Gone.
#
# Example URL: /payout_items
# @param options [Hash] parameters as a hash, under a params key.
diff --git a/lib/gocardless_pro/services/payouts_service.rb b/lib/gocardless_pro/services/payouts_service.rb
index cf210a20..a98a5bd1 100644
--- a/lib/gocardless_pro/services/payouts_service.rb
+++ b/lib/gocardless_pro/services/payouts_service.rb
@@ -10,8 +10,8 @@ module GoCardlessPro
module Services
# Service for making requests to the Payout endpoints
class PayoutsService < BaseService
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
- # payouts.
+ # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
+ # payouts.
# Example URL: /payouts
# @param options [Hash] parameters as a hash, under a params key.
def list(options = {})
@@ -39,12 +39,12 @@ def all(options = {})
).enumerator
end
- # Retrieves the details of a single payout. For an example of how to reconcile
- # the transactions in a payout, see [this
- # guide](#events-reconciling-payouts-with-events).
+ # Retrieves the details of a single payout. For an example of how to reconcile
+ # the transactions in a payout, see [this
+ # guide](#events-reconciling-payouts-with-events).
# Example URL: /payouts/:identity
#
- # @param identity # Unique identifier, beginning with "PO".
+ # @param identity # Unique identifier, beginning with "PO".
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/payouts/:identity', {
@@ -60,10 +60,10 @@ def get(identity, options = {})
Resources::Payout.new(unenvelope_body(response.body), response)
end
- # Updates a payout object. This accepts only the metadata parameter.
+ # Updates a payout object. This accepts only the metadata parameter.
# Example URL: /payouts/:identity
#
- # @param identity # Unique identifier, beginning with "PO".
+ # @param identity # Unique identifier, beginning with "PO".
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/payouts/:identity', {
diff --git a/lib/gocardless_pro/services/redirect_flows_service.rb b/lib/gocardless_pro/services/redirect_flows_service.rb
index b200e2ac..2c91b303 100644
--- a/lib/gocardless_pro/services/redirect_flows_service.rb
+++ b/lib/gocardless_pro/services/redirect_flows_service.rb
@@ -10,8 +10,8 @@ module GoCardlessPro
module Services
# Service for making requests to the RedirectFlow endpoints
class RedirectFlowsService < BaseService
- # Creates a redirect flow object which can then be used to redirect your
- # customer to the GoCardless hosted payment pages.
+ # Creates a redirect flow object which can then be used to redirect your
+ # customer to the GoCardless hosted payment pages.
# Example URL: /redirect_flows
# @param options [Hash] parameters as a hash, under a params key.
def create(options = {})
@@ -46,10 +46,10 @@ def create(options = {})
Resources::RedirectFlow.new(unenvelope_body(response.body), response)
end
- # Returns all details about a single redirect flow
+ # Returns all details about a single redirect flow
# Example URL: /redirect_flows/:identity
#
- # @param identity # Unique identifier, beginning with "RE".
+ # @param identity # Unique identifier, beginning with "RE".
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/redirect_flows/:identity', {
@@ -65,19 +65,20 @@ def get(identity, options = {})
Resources::RedirectFlow.new(unenvelope_body(response.body), response)
end
- # This creates a [customer](#core-endpoints-customers), [customer bank
- # account](#core-endpoints-customer-bank-accounts), and
- # [mandate](#core-endpoints-mandates) using the details supplied by your
- # customer and returns the ID of the created mandate.
+ # This creates a [customer](#core-endpoints-customers), [customer bank
+ # account](#core-endpoints-customer-bank-accounts), and
+ # [mandate](#core-endpoints-mandates) using the details supplied by your
+ # customer and returns the ID of the created mandate.
#
- # This will return a `redirect_flow_incomplete` error if your customer has not
- # yet been redirected back to your site, and a `redirect_flow_already_completed`
- # error if your integration has already completed this flow. It will return a
- # `bad_request` error if the `session_token` differs to the one supplied when
- # the redirect flow was created.
+ # This will return a `redirect_flow_incomplete` error if your customer has not
+ # yet been redirected back to your site, and a
+ # `redirect_flow_already_completed` error if your integration has already
+ # completed this flow. It will return a `bad_request` error if the
+ # `session_token` differs to the one supplied when the redirect flow was
+ # created.
# Example URL: /redirect_flows/:identity/actions/complete
#
- # @param identity # Unique identifier, beginning with "RE".
+ # @param identity # Unique identifier, beginning with "RE".
# @param options [Hash] parameters as a hash, under a params key.
def complete(identity, options = {})
path = sub_url('/redirect_flows/:identity/actions/complete', {
diff --git a/lib/gocardless_pro/services/refunds_service.rb b/lib/gocardless_pro/services/refunds_service.rb
index 19303265..d022690f 100644
--- a/lib/gocardless_pro/services/refunds_service.rb
+++ b/lib/gocardless_pro/services/refunds_service.rb
@@ -10,19 +10,19 @@ module GoCardlessPro
module Services
# Service for making requests to the Refund endpoints
class RefundsService < BaseService
- # Creates a new refund object.
+ # Creates a new refund object.
#
- # This fails with:
+ # This fails with:
#
- # - `total_amount_confirmation_invalid` if the confirmation amount doesn't match
- # the total amount refunded for the payment. This safeguard is there to prevent
- # two processes from creating refunds without awareness of each other.
+ # - `total_amount_confirmation_invalid` if the confirmation amount doesn't
+ # match the total amount refunded for the payment. This safeguard is there to
+ # prevent two processes from creating refunds without awareness of each other.
#
- # - `available_refund_amount_insufficient` if the creditor does not have
- # sufficient balance for refunds available to cover the cost of the requested
- # refund.
+ # - `available_refund_amount_insufficient` if the creditor does not have
+ # sufficient balance for refunds available to cover the cost of the requested
+ # refund.
#
# Example URL: /refunds
# @param options [Hash] parameters as a hash, under a params key.
@@ -58,8 +58,8 @@ def create(options = {})
Resources::Refund.new(unenvelope_body(response.body), response)
end
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
- # refunds.
+ # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
+ # refunds.
# Example URL: /refunds
# @param options [Hash] parameters as a hash, under a params key.
def list(options = {})
@@ -87,10 +87,10 @@ def all(options = {})
).enumerator
end
- # Retrieves all details for a single refund
+ # Retrieves all details for a single refund
# Example URL: /refunds/:identity
#
- # @param identity # Unique identifier, beginning with "RF".
+ # @param identity # Unique identifier, beginning with "RF".
# @param options [Hash] parameters as a hash, under a params key.
def get(identity, options = {})
path = sub_url('/refunds/:identity', {
@@ -106,10 +106,10 @@ def get(identity, options = {})
Resources::Refund.new(unenvelope_body(response.body), response)
end
- # Updates a refund object.
+ # Updates a refund object.
# Example URL: /refunds/:identity
#
- # @param identity # Unique identifier, beginning with "RF".
+ # @param identity # Unique identifier, beginning with "RF".
# @param options [Hash] parameters as a hash, under a params key.
def update(identity, options = {})
path = sub_url('/refunds/:identity', {
diff --git a/lib/gocardless_pro/services/scenario_simulators_service.rb b/lib/gocardless_pro/services/scenario_simulators_service.rb
index 43c98298..91f49596 100644
--- a/lib/gocardless_pro/services/scenario_simulators_service.rb
+++ b/lib/gocardless_pro/services/scenario_simulators_service.rb
@@ -10,140 +10,141 @@ module GoCardlessPro
module Services
# Service for making requests to the ScenarioSimulator endpoints
class ScenarioSimulatorsService < BaseService
- # Runs the specific scenario simulator against the specific resource
+ # Runs the specific scenario simulator against the specific resource
# Example URL: /scenario_simulators/:identity/actions/run
#
- # @param identity # The unique identifier of the simulator, used to initiate simulations.
- # One of:
- #