diff --git a/lib/gocardless_pro/client.rb b/lib/gocardless_pro/client.rb index ddc6412..7f9ba3c 100644 --- a/lib/gocardless_pro/client.rb +++ b/lib/gocardless_pro/client.rb @@ -233,8 +233,8 @@ def default_options 'User-Agent' => "#{user_agent}", 'Content-Type' => 'application/json', 'GoCardless-Client-Library' => 'gocardless-pro-ruby', - 'GoCardless-Client-Version' => '2.57.0', - }, + 'GoCardless-Client-Version' => '3.0.0' + } } end @@ -254,7 +254,7 @@ def user_agent comment = [ "#{ruby_engine}/#{ruby_version}", "#{RUBY_ENGINE}/#{interpreter_version}", - "#{RUBY_PLATFORM}", + "#{RUBY_PLATFORM}" ] comment << "faraday/#{Faraday::VERSION}" "#{gem_info} #{comment.join(' ')}" diff --git a/lib/gocardless_pro/error.rb b/lib/gocardless_pro/error.rb index 11ea393..8cf2bb7 100644 --- a/lib/gocardless_pro/error.rb +++ b/lib/gocardless_pro/error.rb @@ -23,9 +23,9 @@ def message def to_s if errors.any? - errors. - map { |err| "#{err['field']} #{err['message']}" }. - join(', ') + errors + .map { |err| "#{err['field']} #{err['message']}" } + .join(', ') else @error['message'] end diff --git a/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb b/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb index d31dbc8..38f7a18 100644 --- a/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb +++ b/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb @@ -26,7 +26,7 @@ def error_class_for_status(code) { 401 => GoCardlessPro::AuthenticationError, 403 => GoCardlessPro::PermissionError, - 429 => GoCardlessPro::RateLimitError, + 429 => GoCardlessPro::RateLimitError }.fetch(code, nil) end @@ -35,7 +35,7 @@ def error_class_for_type(type) validation_failed: GoCardlessPro::ValidationError, gocardless: GoCardlessPro::GoCardlessError, invalid_api_usage: GoCardlessPro::InvalidApiUsageError, - invalid_state: GoCardlessPro::InvalidStateError, + invalid_state: GoCardlessPro::InvalidStateError }.fetch(type.to_sym) end @@ -45,7 +45,7 @@ def generate_error_data(env) "code: #{env.status}\n" \ "headers: #{env.response_headers}\n" \ "body: #{env.body}", - 'code' => env.status, + 'code' => env.status } end diff --git a/lib/gocardless_pro/resources/bank_authorisation.rb b/lib/gocardless_pro/resources/bank_authorisation.rb index d7d9d1f..465a349 100644 --- a/lib/gocardless_pro/resources/bank_authorisation.rb +++ b/lib/gocardless_pro/resources/bank_authorisation.rb @@ -21,15 +21,8 @@ module Resources # (see Billing Request Flows) to ensure we meet regulatory requirements for # checkout flows. class BankAuthorisation - attr_reader :authorisation_type - attr_reader :authorised_at - attr_reader :created_at - attr_reader :expires_at - attr_reader :id - attr_reader :last_visited_at - attr_reader :qr_code_url - attr_reader :redirect_uri - attr_reader :url + attr_reader :authorisation_type, :authorised_at, :created_at, :expires_at, :id, :last_visited_at, :qr_code_url, + :redirect_uri, :url # Initialize a bank_authorisation resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/bank_details_lookup.rb b/lib/gocardless_pro/resources/bank_details_lookup.rb index 664113e..ca35e15 100644 --- a/lib/gocardless_pro/resources/bank_details_lookup.rb +++ b/lib/gocardless_pro/resources/bank_details_lookup.rb @@ -12,9 +12,7 @@ module Resources # Look up the name and reachability of a bank account. class BankDetailsLookup - attr_reader :available_debit_schemes - attr_reader :bank_name - attr_reader :bic + attr_reader :available_debit_schemes, :bank_name, :bic # Initialize a bank_details_lookup resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/billing_request.rb b/lib/gocardless_pro/resources/billing_request.rb index 92e4ab3..77ba2b8 100644 --- a/lib/gocardless_pro/resources/billing_request.rb +++ b/lib/gocardless_pro/resources/billing_request.rb @@ -20,16 +20,8 @@ module Resources # Overview](https://developer.gocardless.com/getting-started/billing-requests/overview/) # for how-to's, explanations and tutorials. class BillingRequest - attr_reader :actions - attr_reader :created_at - attr_reader :fallback_enabled - attr_reader :id - attr_reader :mandate_request - attr_reader :metadata - attr_reader :payment_request - attr_reader :purpose_code - attr_reader :resources - attr_reader :status + attr_reader :actions, :created_at, :fallback_enabled, :id, :mandate_request, :metadata, :payment_request, + :purpose_code, :resources, :status, :subscription_request # Initialize a billing_request resource instance # @param object [Hash] an object returned from the API @@ -47,6 +39,7 @@ def initialize(object, response = nil) @purpose_code = object['purpose_code'] @resources = object['resources'] @status = object['status'] + @subscription_request = object['subscription_request'] @response = response end @@ -112,6 +105,10 @@ def payment_request def payment_request_payment @links['payment_request_payment'] end + + def subscription_request + @links['subscription_request'] + end end end end diff --git a/lib/gocardless_pro/resources/billing_request_flow.rb b/lib/gocardless_pro/resources/billing_request_flow.rb index f15074a..fb42143 100644 --- a/lib/gocardless_pro/resources/billing_request_flow.rb +++ b/lib/gocardless_pro/resources/billing_request_flow.rb @@ -14,23 +14,8 @@ module Resources # 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 - attr_reader :created_at - attr_reader :customer_details_captured - attr_reader :exit_uri - attr_reader :expires_at - attr_reader :id - attr_reader :language - attr_reader :lock_bank_account - attr_reader :lock_currency - attr_reader :lock_customer_details - attr_reader :prefilled_bank_account - attr_reader :prefilled_customer - attr_reader :redirect_uri - attr_reader :session_token - attr_reader :show_redirect_buttons - attr_reader :show_success_redirect_button + attr_reader :authorisation_url, :auto_fulfil, :created_at, :customer_details_captured, :exit_uri, :expires_at, + :id, :language, :lock_bank_account, :lock_currency, :lock_customer_details, :prefilled_bank_account, :prefilled_customer, :redirect_uri, :session_token, :show_redirect_buttons, :show_success_redirect_button # Initialize a billing_request_flow resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/billing_request_template.rb b/lib/gocardless_pro/resources/billing_request_template.rb index b5fdd6d..0bc6c9c 100644 --- a/lib/gocardless_pro/resources/billing_request_template.rb +++ b/lib/gocardless_pro/resources/billing_request_template.rb @@ -26,23 +26,8 @@ module Resources # 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 - attr_reader :id - attr_reader :mandate_request_currency - attr_reader :mandate_request_description - attr_reader :mandate_request_metadata - attr_reader :mandate_request_scheme - attr_reader :mandate_request_verify - attr_reader :metadata - attr_reader :name - attr_reader :payment_request_amount - attr_reader :payment_request_currency - attr_reader :payment_request_description - attr_reader :payment_request_metadata - attr_reader :payment_request_scheme - attr_reader :redirect_uri - attr_reader :updated_at + attr_reader :authorisation_url, :created_at, :id, :mandate_request_currency, :mandate_request_description, + :mandate_request_metadata, :mandate_request_scheme, :mandate_request_verify, :metadata, :name, :payment_request_amount, :payment_request_currency, :payment_request_description, :payment_request_metadata, :payment_request_scheme, :redirect_uri, :updated_at # Initialize a billing_request_template resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/block.rb b/lib/gocardless_pro/resources/block.rb index 33d9236..a5bc08f 100644 --- a/lib/gocardless_pro/resources/block.rb +++ b/lib/gocardless_pro/resources/block.rb @@ -49,14 +49,8 @@ module Resources # would like to use this API. #
class Block - attr_reader :active - attr_reader :block_type - attr_reader :created_at - attr_reader :id - attr_reader :reason_description - attr_reader :reason_type - attr_reader :resource_reference - attr_reader :updated_at + attr_reader :active, :block_type, :created_at, :id, :reason_description, :reason_type, :resource_reference, + :updated_at # Initialize a block resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/creditor.rb b/lib/gocardless_pro/resources/creditor.rb index 1512136..c747fd1 100644 --- a/lib/gocardless_pro/resources/creditor.rb +++ b/lib/gocardless_pro/resources/creditor.rb @@ -18,26 +18,8 @@ module Resources # 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 - attr_reader :address_line3 - attr_reader :bank_reference_prefix - attr_reader :can_create_refunds - attr_reader :city - attr_reader :country_code - attr_reader :created_at - attr_reader :creditor_type - attr_reader :custom_payment_pages_enabled - attr_reader :fx_payout_currency - attr_reader :id - attr_reader :logo_url - attr_reader :mandate_imports_enabled - attr_reader :merchant_responsible_for_notifications - attr_reader :name - attr_reader :postal_code - attr_reader :region - attr_reader :scheme_identifiers - attr_reader :verification_status + attr_reader :address_line1, :address_line2, :address_line3, :bank_reference_prefix, :can_create_refunds, :city, + :country_code, :created_at, :creditor_type, :custom_payment_pages_enabled, :fx_payout_currency, :id, :logo_url, :mandate_imports_enabled, :merchant_responsible_for_notifications, :name, :postal_code, :region, :scheme_identifiers, :verification_status # Initialize a creditor resource instance # @param object [Hash] an object returned from the API diff --git a/lib/gocardless_pro/resources/creditor_bank_account.rb b/lib/gocardless_pro/resources/creditor_bank_account.rb index 277d10c..9cf19ae 100644 --- a/lib/gocardless_pro/resources/creditor_bank_account.rb +++ b/lib/gocardless_pro/resources/creditor_bank_account.rb @@ -23,17 +23,8 @@ module Resources #Restricted: This API is not # available for partner integrations.
class CreditorBankAccount - 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 + attr_reader :account_holder_name, :account_number_ending, :account_type, :bank_name, :country_code, :created_at, + :currency, :enabled, :id, :metadata, :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 cae5cf1..8067482 100644 --- a/lib/gocardless_pro/resources/currency_exchange_rate.rb +++ b/lib/gocardless_pro/resources/currency_exchange_rate.rb @@ -12,10 +12,7 @@ module Resources # Currency exchange rates from our foreign exchange provider. class CurrencyExchangeRate - attr_reader :rate - attr_reader :source - attr_reader :target - attr_reader :time + attr_reader :rate, :source, :target, :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 ea5f0f7..5a26430 100644 --- a/lib/gocardless_pro/resources/customer.rb +++ b/lib/gocardless_pro/resources/customer.rb @@ -15,24 +15,8 @@ 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 - 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 + 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 # 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 dfd57be..31fef05 100644 --- a/lib/gocardless_pro/resources/customer_bank_account.rb +++ b/lib/gocardless_pro/resources/customer_bank_account.rb @@ -28,16 +28,8 @@ 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 - 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 :account_holder_name, :account_number_ending, :account_type, :bank_account_token, :bank_name, + :country_code, :created_at, :currency, :enabled, :id, :metadata # Initialize a customer_bank_account resource instance # @param object [Hash] an object returned from the API @@ -47,6 +39,7 @@ def initialize(object, response = nil) @account_holder_name = object['account_holder_name'] @account_number_ending = object['account_number_ending'] @account_type = object['account_type'] + @bank_account_token = object['bank_account_token'] @bank_name = object['bank_name'] @country_code = object['country_code'] @created_at = object['created_at'] diff --git a/lib/gocardless_pro/resources/customer_notification.rb b/lib/gocardless_pro/resources/customer_notification.rb index ea31850..522d670 100644 --- a/lib/gocardless_pro/resources/customer_notification.rb +++ b/lib/gocardless_pro/resources/customer_notification.rb @@ -25,11 +25,7 @@ module Resources # href="mailto:help@gocardless.com">get in touch if you would like to # use this API. class CustomerNotification - attr_reader :action_taken - attr_reader :action_taken_at - attr_reader :action_taken_by - attr_reader :id - attr_reader :type + attr_reader :action_taken, :action_taken_at, :action_taken_by, :id, :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 f628668..fb543c6 100644 --- a/lib/gocardless_pro/resources/event.rb +++ b/lib/gocardless_pro/resources/event.rb @@ -17,14 +17,8 @@ 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 - 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 :action, :created_at, :customer_notifications, :details, :id, :metadata, :resource_metadata, + :resource_type # 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 d1f59ea..69a96ab 100644 --- a/lib/gocardless_pro/resources/export.rb +++ b/lib/gocardless_pro/resources/export.rb @@ -12,11 +12,7 @@ module Resources # File-based exports of data class Export - attr_reader :created_at - attr_reader :currency - attr_reader :download_url - attr_reader :export_type - attr_reader :id + attr_reader :created_at, :currency, :download_url, :export_type, :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 0f530ff..80c3198 100644 --- a/lib/gocardless_pro/resources/instalment_schedule.rb +++ b/lib/gocardless_pro/resources/instalment_schedule.rb @@ -28,14 +28,7 @@ module Resources # of collection. # class InstalmentSchedule - 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 + attr_reader :created_at, :currency, :id, :metadata, :name, :payment_errors, :status, :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 be2b84c..8efbc8b 100644 --- a/lib/gocardless_pro/resources/institution.rb +++ b/lib/gocardless_pro/resources/institution.rb @@ -17,12 +17,7 @@ module Resources # 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 - attr_reader :icon_url - attr_reader :id - attr_reader :logo_url - attr_reader :name + attr_reader :autocompletes_collect_bank_account, :country_code, :icon_url, :id, :logo_url, :name # 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 837ffa3..6a6892d 100644 --- a/lib/gocardless_pro/resources/mandate.rb +++ b/lib/gocardless_pro/resources/mandate.rb @@ -16,19 +16,8 @@ module Resources # 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 - 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 + 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 # Initialize a mandate resource instance # @param object [Hash] an object returned from the API @@ -37,6 +26,7 @@ def initialize(object, response = nil) @authorisation_source = object['authorisation_source'] @consent_parameters = object['consent_parameters'] + @consent_type = object['consent_type'] @created_at = object['created_at'] @funds_settlement = object['funds_settlement'] @id = object['id'] diff --git a/lib/gocardless_pro/resources/mandate_import.rb b/lib/gocardless_pro/resources/mandate_import.rb index 8dd94ed..98d08d9 100644 --- a/lib/gocardless_pro/resources/mandate_import.rb +++ b/lib/gocardless_pro/resources/mandate_import.rb @@ -53,10 +53,7 @@ module Resources # href="mailto:help@gocardless.com">get in touch if you would like to # use this API. class MandateImport - attr_reader :created_at - attr_reader :id - attr_reader :scheme - attr_reader :status + attr_reader :created_at, :id, :scheme, :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 cfb44d8..538dc78 100644 --- a/lib/gocardless_pro/resources/mandate_import_entry.rb +++ b/lib/gocardless_pro/resources/mandate_import_entry.rb @@ -41,8 +41,7 @@ module Resources # href="mailto:help@gocardless.com">get in touch if you would like to # use this API. class MandateImportEntry - attr_reader :created_at - attr_reader :record_identifier + attr_reader :created_at, :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 2293032..bd5428f 100644 --- a/lib/gocardless_pro/resources/mandate_pdf.rb +++ b/lib/gocardless_pro/resources/mandate_pdf.rb @@ -14,8 +14,7 @@ module Resources # compliant](#appendix-compliance-requirements) Direct Debit mandates to # your customers. class MandatePdf - attr_reader :expires_at - attr_reader :url + attr_reader :expires_at, :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 e51e149..167e804 100644 --- a/lib/gocardless_pro/resources/negative_balance_limit.rb +++ b/lib/gocardless_pro/resources/negative_balance_limit.rb @@ -16,10 +16,7 @@ module Resources # changed on a per-creditor basis. # class NegativeBalanceLimit - attr_reader :balance_limit - attr_reader :created_at - attr_reader :currency - attr_reader :id + attr_reader :balance_limit, :created_at, :currency, :id # Initialize a negative_balance_limit 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 79cce40..923dc34 100644 --- a/lib/gocardless_pro/resources/payer_authorisation.rb +++ b/lib/gocardless_pro/resources/payer_authorisation.rb @@ -69,13 +69,7 @@ module Resources # your servers. # class PayerAuthorisation - attr_reader :bank_account - attr_reader :created_at - attr_reader :customer - attr_reader :id - attr_reader :incomplete_fields - attr_reader :mandate - attr_reader :status + attr_reader :bank_account, :created_at, :customer, :id, :incomplete_fields, :mandate, :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 cb64466..56a82cd 100644 --- a/lib/gocardless_pro/resources/payment.rb +++ b/lib/gocardless_pro/resources/payment.rb @@ -18,19 +18,8 @@ module Resources # GoCardless will notify you via a [webhook](#appendix-webhooks) whenever # the state of a payment changes. class Payment - 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 :status + attr_reader :amount, :amount_refunded, :charge_date, :created_at, :currency, :description, :faster_ach, :fx, :id, + :metadata, :reference, :retry_if_possible, :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 b51aea4..484d5ef 100644 --- a/lib/gocardless_pro/resources/payout.rb +++ b/lib/gocardless_pro/resources/payout.rb @@ -17,18 +17,8 @@ module Resources # Payouts are created automatically after a payment has been successfully # collected. class Payout - 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 + attr_reader :amount, :arrival_date, :created_at, :currency, :deducted_fees, :fx, :id, :metadata, :payout_type, + :reference, :status, :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 d1bdd68..edf120d 100644 --- a/lib/gocardless_pro/resources/payout_item.rb +++ b/lib/gocardless_pro/resources/payout_item.rb @@ -33,9 +33,7 @@ module Resources #410 Gone
.
#
class PayoutItem
- attr_reader :amount
- attr_reader :taxes
- attr_reader :type
+ attr_reader :amount, :taxes, :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 1b0737f..c4525a4 100644
--- a/lib/gocardless_pro/resources/redirect_flow.rb
+++ b/lib/gocardless_pro/resources/redirect_flow.rb
@@ -49,16 +49,8 @@ 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
- 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
+ attr_reader :confirmation_url, :created_at, :description, :id, :mandate_reference, :metadata, :redirect_url,
+ :scheme, :session_token, :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 244c5b1..7f243f3 100644
--- a/lib/gocardless_pro/resources/refund.rb
+++ b/lib/gocardless_pro/resources/refund.rb
@@ -18,14 +18,7 @@ module Resources
# refund is created, and will update the `amount_refunded` property of the
# payment.
class Refund
- 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
+ attr_reader :amount, :created_at, :currency, :fx, :id, :metadata, :reference, :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 7a638f2..787052c 100644
--- a/lib/gocardless_pro/resources/scheme_identifier.rb
+++ b/lib/gocardless_pro/resources/scheme_identifier.rb
@@ -15,24 +15,8 @@ module Resources
# on customers' bank statements.
#
class SchemeIdentifier
- 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
+ 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
# 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 9a9badc..1f39e7e 100644
--- a/lib/gocardless_pro/resources/subscription.rb
+++ b/lib/gocardless_pro/resources/subscription.rb
@@ -68,26 +68,8 @@ module Resources
# - otherwise the charge date will be rolled __forwards__ to the next
# business day.
class Subscription
- 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
+ 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
# 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 a727b65..6df5171 100644
--- a/lib/gocardless_pro/resources/tax_rate.rb
+++ b/lib/gocardless_pro/resources/tax_rate.rb
@@ -15,12 +15,7 @@ module Resources
# 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
- attr_reader :jurisdiction
- attr_reader :percentage
- attr_reader :start_date
- attr_reader :type
+ attr_reader :end_date, :id, :jurisdiction, :percentage, :start_date, :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 55b437a..d67fd1d 100644
--- a/lib/gocardless_pro/resources/transferred_mandate.rb
+++ b/lib/gocardless_pro/resources/transferred_mandate.rb
@@ -12,9 +12,7 @@ module Resources
# Mandates that have been transferred using Current Account Switch Service
class TransferredMandate
- attr_reader :encrypted_customer_bank_details
- attr_reader :encrypted_decryption_key
- attr_reader :public_key_id
+ attr_reader :encrypted_customer_bank_details, :encrypted_decryption_key, :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 df411dd..29e34dd 100644
--- a/lib/gocardless_pro/resources/verification_detail.rb
+++ b/lib/gocardless_pro/resources/verification_detail.rb
@@ -22,15 +22,8 @@ module Resources
# your
# account.
class VerificationDetail
- 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
+ attr_reader :address_line1, :address_line2, :address_line3, :city, :company_number, :description, :directors,
+ :name, :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 691ae81..f7ca8cc 100644
--- a/lib/gocardless_pro/resources/webhook.rb
+++ b/lib/gocardless_pro/resources/webhook.rb
@@ -12,19 +12,8 @@ module Resources
# Basic description of a webhook
class Webhook
- 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
+ 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
# Initialize a webhook resource instance
# @param object [Hash] an object returned from the API
diff --git a/lib/gocardless_pro/services/bank_authorisations_service.rb b/lib/gocardless_pro/services/bank_authorisations_service.rb
index 8412f14..18ef3d4 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 66c4411..f4ac8f5 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 34c77ec..bab056c 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 8a199e5..f3b6fc9 100644
--- a/lib/gocardless_pro/services/billing_requests_service.rb
+++ b/lib/gocardless_pro/services/billing_requests_service.rb
@@ -61,7 +61,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) || {}
@@ -122,7 +122,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) || {}
@@ -163,7 +163,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) || {}
@@ -203,7 +203,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) || {}
@@ -243,7 +243,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) || {}
@@ -311,7 +311,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
@@ -335,7 +335,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) || {}
@@ -375,7 +375,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) || {}
@@ -420,7 +420,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) || {}
@@ -459,7 +459,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 8d57a98..eca428f 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 11becb9..aefd047 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 f7b1d07..8fe0999 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 5dbf167..8c62dbe 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 e242338..ac40175 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 3aed592..e176fa2 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 bea0c25..1f0ccb2 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 c958497..06acd6e 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 8eab203..2f75dce 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 0a154a9..333b4d4 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 4247631..d52f6cf 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 6b1cc0d..74a181f 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/payer_authorisations_service.rb b/lib/gocardless_pro/services/payer_authorisations_service.rb
index 6322c44..914aaa1 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 af97d5d..133b02e 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 cf210a2..6a44e49 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 b200e2a..17c988f 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 c210abf..bba23f6 100644
--- a/lib/gocardless_pro/services/refunds_service.rb
+++ b/lib/gocardless_pro/services/refunds_service.rb
@@ -97,7 +97,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
@@ -116,7 +116,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 5a8f285..0460b76 100644
--- a/lib/gocardless_pro/services/scenario_simulators_service.rb
+++ b/lib/gocardless_pro/services/scenario_simulators_service.rb
@@ -140,7 +140,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 478cc4a..62f8719 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 938ff08..fa98186 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 95b6458..16fe9f2 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 6dac69d..d919393 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 2de4cd6..9664be0 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/lib/gocardless_pro/version.rb b/lib/gocardless_pro/version.rb
index 22c003b..ba64b1c 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 = '2.57.0'
+ VERSION = '3.0.0'
end
diff --git a/spec/api_service_spec.rb b/spec/api_service_spec.rb
index 697a146..d75827b 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 67d9813..3673907 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 d7aee3a..4f0ce83 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 5adb4e4..3b9f8ef 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/bank_authorisation_spec.rb b/spec/resources/bank_authorisation_spec.rb
index 0498575..5d30424 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 384566a..0b6d311 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 6b6c1ad..106b901 100644
--- a/spec/resources/billing_request_flow_spec.rb
+++ b/spec/resources/billing_request_flow_spec.rb
@@ -32,13 +32,13 @@
'redirect_uri' => 'redirect_uri-input',
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
- 'show_success_redirect_button' => 'show_success_redirect_button-input',
+ 'show_success_redirect_button' => 'show_success_redirect_button-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' => {
@@ -59,11 +59,11 @@
'redirect_uri' => 'redirect_uri-input',
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
- 'show_success_redirect_button' => 'show_success_redirect_button-input',
- },
+ 'show_success_redirect_button' => 'show_success_redirect_button-input'
+ }
}
- ).
- to_return(
+ )
+ .to_return(
body: {
'billing_request_flows' =>
@@ -86,8 +86,8 @@
'redirect_uri' => 'redirect_uri-input',
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
- 'show_success_redirect_button' => 'show_success_redirect_button-input',
- },
+ 'show_success_redirect_button' => 'show_success_redirect_button-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 @@
'redirect_uri' => 'redirect_uri-input',
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
- 'show_success_redirect_button' => 'show_success_redirect_button-input',
+ 'show_success_redirect_button' => 'show_success_redirect_button-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
@@ -208,8 +208,8 @@
'redirect_uri' => 'redirect_uri-input',
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
- 'show_success_redirect_button' => 'show_success_redirect_button-input',
- },
+ 'show_success_redirect_button' => 'show_success_redirect_button-input'
+ }
}.to_json,
headers: response_headers
@@ -232,8 +232,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(
@@ -257,8 +257,8 @@
'redirect_uri' => 'redirect_uri-input',
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
- 'show_success_redirect_button' => 'show_success_redirect_button-input',
- },
+ 'show_success_redirect_button' => 'show_success_redirect_button-input'
+ }
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/billing_request_spec.rb b/spec/resources/billing_request_spec.rb
index fc69a64..bbb46b1 100644
--- a/spec/resources/billing_request_spec.rb
+++ b/spec/resources/billing_request_spec.rb
@@ -26,12 +26,13 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-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' => {
@@ -46,10 +47,11 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}
- ).
- to_return(
+ )
+ .to_return(
body: {
'billing_requests' =>
@@ -66,7 +68,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -88,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
@@ -119,6 +122,7 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
+ 'subscription_request' => 'subscription_request-input'
}
end
@@ -133,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
@@ -146,8 +150,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' => {
@@ -162,7 +166,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -199,7 +204,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -222,8 +228,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(
@@ -241,7 +247,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -272,7 +279,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -295,8 +303,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(
@@ -314,7 +322,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -345,7 +354,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -368,8 +378,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(
@@ -387,7 +397,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -418,7 +429,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -441,8 +453,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(
@@ -460,7 +472,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -491,7 +504,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -514,8 +528,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(
@@ -533,7 +547,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -561,13 +576,14 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
+ 'subscription_request' => 'subscription_request-input'
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123',
- },
- },
+ after: 'ABC123'
+ }
+ }
}.to_json,
headers: response_headers
)
@@ -597,6 +613,8 @@
expect(get_list_response.records.first.resources).to eq('resources-input')
expect(get_list_response.records.first.status).to eq('status-input')
+
+ expect(get_list_response.records.first.subscription_request).to eq('subscription_request-input')
end
it 'exposes the cursors for before and after' do
@@ -625,11 +643,12 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
+ 'subscription_request' => 'subscription_request-input'
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1,
- },
+ limit: 1
+ }
}.to_json,
headers: response_headers
)
@@ -651,11 +670,12 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
+ 'subscription_request' => 'subscription_request-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -676,9 +696,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' => {
@@ -693,7 +713,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -701,7 +722,7 @@
subject(:get_response) do
client.billing_requests.get(id, headers: {
- 'Foo' => 'Bar',
+ 'Foo' => 'Bar'
})
end
@@ -729,7 +750,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -786,7 +808,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -809,8 +832,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(
@@ -828,7 +851,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -859,7 +883,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -882,8 +907,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(
@@ -901,7 +926,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -932,7 +958,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -955,8 +982,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(
@@ -974,7 +1001,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -1005,7 +1033,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -1028,8 +1057,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(
@@ -1047,7 +1076,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-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 53caa46..1455136 100644
--- a/spec/resources/billing_request_template_spec.rb
+++ b/spec/resources/billing_request_template_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,
headers: response_headers
)
@@ -118,12 +118,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
)
@@ -150,12 +150,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
)
@@ -176,9 +176,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' => {
@@ -198,8 +198,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
)
@@ -207,7 +207,7 @@
subject(:get_response) do
client.billing_request_templates.get(id, headers: {
- 'Foo' => 'Bar',
+ 'Foo' => 'Bar'
})
end
@@ -240,8 +240,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
)
@@ -297,13 +297,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' => {
@@ -323,11 +323,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' =>
@@ -349,8 +349,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
@@ -372,9 +372,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
@@ -408,7 +408,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
@@ -423,11 +423,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
@@ -436,8 +436,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' => {
@@ -457,8 +457,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
)
@@ -501,8 +501,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/block_spec.rb b/spec/resources/block_spec.rb
index a3a3940..b9cb4ee 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 fb787d2..8dbe288 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 ee69ab2..36a1c08 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 d0f97ea..64e4512 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 7d52734..c6b2a6d 100644
--- a/spec/resources/customer_bank_account_spec.rb
+++ b/spec/resources/customer_bank_account_spec.rb
@@ -18,6 +18,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -25,19 +26,20 @@
'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' => {
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -45,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' =>
@@ -58,6 +60,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -65,8 +68,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
- },
+ 'metadata' => 'metadata-input'
+ }
}.to_json,
headers: response_headers
@@ -88,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
@@ -111,6 +114,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -118,7 +122,7 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
+ 'metadata' => 'metadata-input'
}
end
@@ -133,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
@@ -146,14 +150,15 @@
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' => {
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -161,8 +166,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
- },
+ 'metadata' => 'metadata-input'
+ }
}.to_json,
headers: response_headers
)
@@ -188,6 +193,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -195,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
)
@@ -219,6 +225,8 @@
expect(get_list_response.records.first.account_type).to eq('account_type-input')
+ expect(get_list_response.records.first.bank_account_token).to eq('bank_account_token-input')
+
expect(get_list_response.records.first.bank_name).to eq('bank_name-input')
expect(get_list_response.records.first.country_code).to eq('country_code-input')
@@ -252,6 +260,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -259,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
)
@@ -278,6 +287,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -285,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
)
@@ -311,15 +321,16 @@
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' => {
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -327,8 +338,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
- },
+ 'metadata' => 'metadata-input'
+ }
}.to_json,
headers: response_headers
)
@@ -336,7 +347,7 @@
subject(:get_response) do
client.customer_bank_accounts.get(id, headers: {
- 'Foo' => 'Bar',
+ 'Foo' => 'Bar'
})
end
@@ -356,6 +367,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -363,8 +375,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
- },
+ 'metadata' => 'metadata-input'
+ }
}.to_json,
headers: response_headers
)
@@ -414,6 +426,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -421,8 +434,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
- },
+ 'metadata' => 'metadata-input'
+ }
}.to_json,
headers: response_headers
)
@@ -450,6 +463,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -457,8 +471,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
- },
+ 'metadata' => 'metadata-input'
+ }
}.to_json,
headers: response_headers
@@ -481,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(
@@ -492,6 +506,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -499,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 8bf0d3d..31e4156 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 6f86622..2c0154d 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 3741794..2572161 100644
--- a/spec/resources/event_spec.rb
+++ b/spec/resources/event_spec.rb
@@ -26,14 +26,14 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
+ 'resource_type' => 'resource_type-input'
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123',
- },
- },
+ after: 'ABC123'
+ }
+ }
}.to_json,
headers: response_headers
)
@@ -82,12 +82,12 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
+ 'resource_type' => 'resource_type-input'
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1,
- },
+ limit: 1
+ }
}.to_json,
headers: response_headers
)
@@ -106,12 +106,12 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
+ 'resource_type' => 'resource_type-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -132,9 +132,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' => {
@@ -146,8 +146,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
- },
+ 'resource_type' => 'resource_type-input'
+ }
}.to_json,
headers: response_headers
)
@@ -155,7 +155,7 @@
subject(:get_response) do
client.events.get(id, headers: {
- 'Foo' => 'Bar',
+ 'Foo' => 'Bar'
})
end
@@ -180,8 +180,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
- },
+ 'resource_type' => 'resource_type-input'
+ }
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/export_spec.rb b/spec/resources/export_spec.rb
index 701e942..b54a7f2 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 c7b4029..b997690 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 cc7f549..ef1af87 100644
--- a/spec/resources/institution_spec.rb
+++ b/spec/resources/institution_spec.rb
@@ -23,14 +23,14 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
+ 'name' => 'name-input'
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123',
- },
- },
+ after: 'ABC123'
+ }
+ }
}.to_json,
headers: response_headers
)
@@ -72,12 +72,12 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
+ 'name' => 'name-input'
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1,
- },
+ limit: 1
+ }
}.to_json,
headers: response_headers
)
@@ -93,12 +93,12 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
+ 'name' => 'name-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -128,14 +128,14 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
+ 'name' => 'name-input'
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123',
- },
- },
+ after: 'ABC123'
+ }
+ }
}.to_json,
headers: response_headers
@@ -163,8 +163,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(
@@ -176,8 +176,8 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
- },
+ 'name' => 'name-input'
+ }
}.to_json,
headers: response_headers
)
diff --git a/spec/resources/logo_spec.rb b/spec/resources/logo_spec.rb
index 4e20624..289a2c8 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 5014b80..6df2995 100644
--- a/spec/resources/mandate_import_entry_spec.rb
+++ b/spec/resources/mandate_import_entry_spec.rb
@@ -17,23 +17,23 @@
'created_at' => 'created_at-input',
'links' => 'links-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',
- 'record_identifier' => 'record_identifier-input',
- },
+ 'record_identifier' => 'record_identifier-input'
+ }
}
- ).
- to_return(
+ )
+ .to_return(
body: {
'mandate_import_entries' =>
@@ -41,8 +41,8 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
- 'record_identifier' => 'record_identifier-input',
- },
+ 'record_identifier' => 'record_identifier-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 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
- 'record_identifier' => 'record_identifier-input',
+ 'record_identifier' => 'record_identifier-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
@@ -130,14 +130,14 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
- 'record_identifier' => 'record_identifier-input',
+ 'record_identifier' => 'record_identifier-input'
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123',
- },
- },
+ after: 'ABC123'
+ }
+ }
}.to_json,
headers: response_headers
)
@@ -170,12 +170,12 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
- 'record_identifier' => 'record_identifier-input',
+ 'record_identifier' => 'record_identifier-input'
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1,
- },
+ limit: 1
+ }
}.to_json,
headers: response_headers
)
@@ -188,12 +188,12 @@
'created_at' => 'created_at-input',
'links' => 'links-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 93322b4..c86ba3f 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 4d500f9..526cefa 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 62d8209..022be38 100644
--- a/spec/resources/mandate_spec.rb
+++ b/spec/resources/mandate_spec.rb
@@ -17,6 +17,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -28,18 +29,19 @@
'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' => {
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -51,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' =>
@@ -63,6 +65,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -74,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
@@ -97,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
@@ -119,6 +122,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -130,7 +134,7 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input',
+ 'verified_at' => 'verified_at-input'
}
end
@@ -145,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
@@ -158,13 +162,14 @@
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' => {
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -176,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
)
@@ -202,6 +207,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -213,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
)
@@ -233,6 +239,8 @@
expect(get_list_response.records.first.consent_parameters).to eq('consent_parameters-input')
+ expect(get_list_response.records.first.consent_type).to eq('consent_type-input')
+
expect(get_list_response.records.first.created_at).to eq('created_at-input')
expect(get_list_response.records.first.funds_settlement).to eq('funds_settlement-input')
@@ -273,6 +281,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -284,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
)
@@ -302,6 +311,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -313,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
)
@@ -339,14 +349,15 @@
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' => {
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -358,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
)
@@ -367,7 +378,7 @@
subject(:get_response) do
client.mandates.get(id, headers: {
- 'Foo' => 'Bar',
+ 'Foo' => 'Bar'
})
end
@@ -386,6 +397,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -397,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
)
@@ -447,6 +459,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -458,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
)
@@ -486,6 +499,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -497,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
@@ -521,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(
@@ -531,6 +545,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -542,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
)
@@ -565,6 +580,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -576,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
@@ -600,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(
@@ -610,6 +626,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -621,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 33dc2ce..5e65af9 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
)
@@ -116,13 +116,13 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input',
+ 'links' => 'links-input'
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/negative_balance_limits}).
- with(
+ stub_request(:post, %r{.*api.gocardless.com/negative_balance_limits})
+ .with(
body: {
'negative_balance_limits' => {
@@ -130,11 +130,11 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input',
- },
+ 'links' => 'links-input'
+ }
}
- ).
- to_return(
+ )
+ .to_return(
body: {
'negative_balance_limits' =>
@@ -144,8 +144,8 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input',
- },
+ 'links' => 'links-input'
+ }
}.to_json,
headers: response_headers
@@ -167,9 +167,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
@@ -191,7 +191,7 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input',
+ 'links' => 'links-input'
}
end
@@ -206,11 +206,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/payer_authorisation_spec.rb b/spec/resources/payer_authorisation_spec.rb
index d12f790..9c4c621 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 f5d0381..5eec7d5 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 1e07375..4dbdfac 100644
--- a/spec/resources/payment_spec.rb
+++ b/spec/resources/payment_spec.rb
@@ -28,13 +28,13 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-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' => {
@@ -51,11 +51,11 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}
- ).
- to_return(
+ )
+ .to_return(
body: {
'payments' =>
@@ -74,8 +74,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-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 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
+ 'status' => 'status-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 = "/payments/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/).
- to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/)
+ .to_return(
body: {
'payments' => {
@@ -176,8 +176,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
)
@@ -213,14 +213,14 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
+ 'status' => 'status-input'
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123',
- },
- },
+ after: 'ABC123'
+ }
+ }
}.to_json,
headers: response_headers
)
@@ -284,12 +284,12 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
+ 'status' => 'status-input'
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1,
- },
+ limit: 1
+ }
}.to_json,
headers: response_headers
)
@@ -313,12 +313,12 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
+ 'status' => 'status-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -339,9 +339,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' => {
@@ -358,8 +358,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
)
@@ -367,7 +367,7 @@
subject(:get_response) do
client.payments.get(id, headers: {
- 'Foo' => 'Bar',
+ 'Foo' => 'Bar'
})
end
@@ -397,8 +397,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
)
@@ -458,8 +458,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
)
@@ -497,8 +497,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
@@ -521,8 +521,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(
@@ -542,8 +542,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
)
@@ -576,8 +576,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
@@ -600,8 +600,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(
@@ -621,8 +621,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-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 37c8718..f6a79f6 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 bf01f26..c2f9b8f 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 620653c..8c277bc 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 e4ce121..773714f 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 1614879..f5595e7 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 0d03264..fc0beb4 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 afeca8d..dbb008a 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 0bb8e83..d306554 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 54f7562..91f9d19 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 bf3a507..e4cf45d 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 8171013..47cf7d1 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/bank_authorisations_service_spec.rb b/spec/services/bank_authorisations_service_spec.rb
index f80a3bb..f2da9c9 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 a5c166c..4fc1a81 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 c835f1f..4d0d852 100644
--- a/spec/services/billing_request_flows_service_spec.rb
+++ b/spec/services/billing_request_flows_service_spec.rb
@@ -32,13 +32,13 @@
'redirect_uri' => 'redirect_uri-input',
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
- 'show_success_redirect_button' => 'show_success_redirect_button-input',
+ 'show_success_redirect_button' => 'show_success_redirect_button-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' => {
@@ -59,11 +59,11 @@
'redirect_uri' => 'redirect_uri-input',
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
- 'show_success_redirect_button' => 'show_success_redirect_button-input',
- },
+ 'show_success_redirect_button' => 'show_success_redirect_button-input'
+ }
}
- ).
- to_return(
+ )
+ .to_return(
body: {
'billing_request_flows' =>
@@ -86,8 +86,8 @@
'redirect_uri' => 'redirect_uri-input',
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
- 'show_success_redirect_button' => 'show_success_redirect_button-input',
- },
+ 'show_success_redirect_button' => 'show_success_redirect_button-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/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
@@ -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 @@
'redirect_uri' => 'redirect_uri-input',
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
- 'show_success_redirect_button' => 'show_success_redirect_button-input',
+ 'show_success_redirect_button' => 'show_success_redirect_button-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
@@ -231,8 +231,8 @@
'redirect_uri' => 'redirect_uri-input',
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
- 'show_success_redirect_button' => 'show_success_redirect_button-input',
- },
+ 'show_success_redirect_button' => 'show_success_redirect_button-input'
+ }
}.to_json,
headers: response_headers
@@ -248,8 +248,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
@@ -266,8 +266,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(
@@ -291,8 +291,8 @@
'redirect_uri' => 'redirect_uri-input',
'session_token' => 'session_token-input',
'show_redirect_buttons' => 'show_redirect_buttons-input',
- 'show_success_redirect_button' => 'show_success_redirect_button-input',
- },
+ 'show_success_redirect_button' => 'show_success_redirect_button-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 fd90b44..fb34095 100644
--- a/spec/services/billing_request_templates_service_spec.rb
+++ b/spec/services/billing_request_templates_service_spec.rb
@@ -33,14 +33,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
@@ -102,19 +102,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
@@ -145,12 +145,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
)
@@ -177,12 +177,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
)
@@ -218,19 +218,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' => [{
@@ -250,12 +250,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
)
@@ -287,18 +287,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' }
@@ -322,12 +322,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
)
@@ -348,9 +348,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' => {
@@ -370,8 +370,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
)
@@ -379,7 +379,7 @@
subject(:get_response) do
client.billing_request_templates.get(id, headers: {
- 'Foo' => 'Bar',
+ 'Foo' => 'Bar'
})
end
@@ -412,8 +412,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
)
@@ -452,8 +452,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
@@ -462,11 +462,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
@@ -481,20 +481,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
@@ -524,13 +524,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' => {
@@ -550,11 +550,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' =>
@@ -576,8 +576,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
@@ -592,19 +592,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
@@ -622,9 +622,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
@@ -658,7 +658,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
@@ -673,11 +673,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
@@ -686,8 +686,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' => {
@@ -707,8 +707,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
)
@@ -731,8 +731,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
@@ -767,8 +767,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
)
@@ -784,8 +784,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
@@ -793,11 +793,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_requests_service_spec.rb b/spec/services/billing_requests_service_spec.rb
index b40e319..45e64b8 100644
--- a/spec/services/billing_requests_service_spec.rb
+++ b/spec/services/billing_requests_service_spec.rb
@@ -26,12 +26,13 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-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' => {
@@ -46,10 +47,11 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}
- ).
- to_return(
+ )
+ .to_return(
body: {
'billing_requests' =>
@@ -66,7 +68,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -81,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/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
@@ -111,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
@@ -142,6 +145,7 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
+ 'subscription_request' => 'subscription_request-input'
}
end
@@ -156,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
@@ -169,8 +173,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' => {
@@ -185,7 +189,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -208,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
@@ -238,7 +243,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -254,8 +260,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
@@ -272,8 +278,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(
@@ -291,7 +297,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -322,7 +329,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -338,8 +346,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
@@ -356,8 +364,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(
@@ -375,7 +383,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -406,7 +415,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -422,8 +432,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
@@ -440,8 +450,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(
@@ -459,7 +469,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -490,7 +501,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -506,8 +518,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
@@ -524,8 +536,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(
@@ -543,7 +555,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -574,7 +587,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -590,8 +604,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
@@ -608,8 +622,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(
@@ -627,7 +641,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -654,13 +669,14 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
+ 'subscription_request' => 'subscription_request-input'
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123',
- },
- },
+ after: 'ABC123'
+ }
+ }
}.to_json
end
@@ -695,6 +711,8 @@
expect(get_list_response.records.first.resources).to eq('resources-input')
expect(get_list_response.records.first.status).to eq('status-input')
+
+ expect(get_list_response.records.first.subscription_request).to eq('subscription_request-input')
end
it 'exposes the cursors for before and after' do
@@ -708,19 +726,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
@@ -746,11 +764,12 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
+ 'subscription_request' => 'subscription_request-input'
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1,
- },
+ limit: 1
+ }
}.to_json,
headers: response_headers
)
@@ -772,11 +791,12 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
+ 'subscription_request' => 'subscription_request-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -807,18 +827,19 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-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' => [{
@@ -833,11 +854,12 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
+ 'subscription_request' => 'subscription_request-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -864,17 +886,18 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-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' }
@@ -893,11 +916,12 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
+ 'subscription_request' => 'subscription_request-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -918,9 +942,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' => {
@@ -935,7 +959,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -943,7 +968,7 @@
subject(:get_response) do
client.billing_requests.get(id, headers: {
- 'Foo' => 'Bar',
+ 'Foo' => 'Bar'
})
end
@@ -971,7 +996,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -1010,8 +1036,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
@@ -1020,11 +1046,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
@@ -1039,20 +1065,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
@@ -1083,7 +1109,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -1099,8 +1126,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
@@ -1117,8 +1144,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(
@@ -1136,7 +1163,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -1167,7 +1195,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -1183,8 +1212,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
@@ -1201,8 +1230,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(
@@ -1220,7 +1249,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -1251,7 +1281,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -1267,8 +1298,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
@@ -1285,8 +1316,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(
@@ -1304,7 +1335,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
)
@@ -1335,7 +1367,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-input',
- },
+ 'subscription_request' => 'subscription_request-input'
+ }
}.to_json,
headers: response_headers
@@ -1351,8 +1384,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
@@ -1369,8 +1402,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(
@@ -1388,7 +1421,8 @@
'purpose_code' => 'purpose_code-input',
'resources' => 'resources-input',
'status' => 'status-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 422e028..698858a 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 dcb788a..dc2eae6 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 7a857a2..53e7f4d 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 5b7c210..7544f15 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 3947edf..63b403e 100644
--- a/spec/services/customer_bank_accounts_service_spec.rb
+++ b/spec/services/customer_bank_accounts_service_spec.rb
@@ -18,6 +18,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -25,19 +26,20 @@
'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' => {
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -45,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' =>
@@ -58,6 +60,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -65,8 +68,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
- },
+ 'metadata' => 'metadata-input'
+ }
}.to_json,
headers: response_headers
@@ -81,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
@@ -111,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
@@ -134,6 +137,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -141,7 +145,7 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
+ 'metadata' => 'metadata-input'
}
end
@@ -156,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
@@ -169,14 +173,15 @@
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' => {
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -184,8 +189,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
- },
+ 'metadata' => 'metadata-input'
+ }
}.to_json,
headers: response_headers
)
@@ -208,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
@@ -226,6 +231,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -233,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
@@ -262,6 +268,8 @@
expect(get_list_response.records.first.account_type).to eq('account_type-input')
+ expect(get_list_response.records.first.bank_account_token).to eq('bank_account_token-input')
+
expect(get_list_response.records.first.bank_name).to eq('bank_name-input')
expect(get_list_response.records.first.country_code).to eq('country_code-input')
@@ -288,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
@@ -318,6 +326,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -325,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
)
@@ -344,6 +353,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -351,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
)
@@ -379,6 +389,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -386,25 +397,26 @@
'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' => [{
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -412,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
)
@@ -436,6 +448,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -443,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' }
@@ -465,6 +478,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -472,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
)
@@ -498,15 +512,16 @@
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' => {
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -514,8 +529,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
- },
+ 'metadata' => 'metadata-input'
+ }
}.to_json,
headers: response_headers
)
@@ -523,7 +538,7 @@
subject(:get_response) do
client.customer_bank_accounts.get(id, headers: {
- 'Foo' => 'Bar',
+ 'Foo' => 'Bar'
})
end
@@ -543,6 +558,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -550,8 +566,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
- },
+ 'metadata' => 'metadata-input'
+ }
}.to_json,
headers: response_headers
)
@@ -590,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
@@ -600,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
@@ -619,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
@@ -656,6 +672,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -663,8 +680,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
- },
+ 'metadata' => 'metadata-input'
+ }
}.to_json,
headers: response_headers
)
@@ -680,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
@@ -689,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
@@ -717,6 +734,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -724,8 +742,8 @@
'enabled' => 'enabled-input',
'id' => 'id-input',
'links' => 'links-input',
- 'metadata' => 'metadata-input',
- },
+ 'metadata' => 'metadata-input'
+ }
}.to_json,
headers: response_headers
@@ -741,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
@@ -759,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(
@@ -770,6 +788,7 @@
'account_holder_name' => 'account_holder_name-input',
'account_number_ending' => 'account_number_ending-input',
'account_type' => 'account_type-input',
+ 'bank_account_token' => 'bank_account_token-input',
'bank_name' => 'bank_name-input',
'country_code' => 'country_code-input',
'created_at' => 'created_at-input',
@@ -777,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 afc461d..f4c1714 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 ab8f41f..96ead4f 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 af20a48..828ea0b 100644
--- a/spec/services/events_service_spec.rb
+++ b/spec/services/events_service_spec.rb
@@ -25,14 +25,14 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
+ 'resource_type' => 'resource_type-input'
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123',
- },
- },
+ after: 'ABC123'
+ }
+ }
}.to_json
end
@@ -74,19 +74,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
@@ -109,12 +109,12 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
+ 'resource_type' => 'resource_type-input'
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1,
- },
+ limit: 1
+ }
}.to_json,
headers: response_headers
)
@@ -133,12 +133,12 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
+ 'resource_type' => 'resource_type-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -166,19 +166,19 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
+ 'resource_type' => 'resource_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/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' => [{
@@ -190,12 +190,12 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
+ 'resource_type' => 'resource_type-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -219,18 +219,18 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
+ 'resource_type' => 'resource_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/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' }
@@ -246,12 +246,12 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
+ 'resource_type' => 'resource_type-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -272,9 +272,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' => {
@@ -286,8 +286,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
- },
+ 'resource_type' => 'resource_type-input'
+ }
}.to_json,
headers: response_headers
)
@@ -295,7 +295,7 @@
subject(:get_response) do
client.events.get(id, headers: {
- 'Foo' => 'Bar',
+ 'Foo' => 'Bar'
})
end
@@ -320,8 +320,8 @@
'links' => 'links-input',
'metadata' => 'metadata-input',
'resource_metadata' => 'resource_metadata-input',
- 'resource_type' => 'resource_type-input',
- },
+ 'resource_type' => 'resource_type-input'
+ }
}.to_json,
headers: response_headers
)
@@ -360,8 +360,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
@@ -370,11 +370,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
@@ -389,20 +389,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 081b4aa..239b8a6 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 12c42d1..e7398b0 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 f9cf1a5..4f41cb7 100644
--- a/spec/services/institutions_service_spec.rb
+++ b/spec/services/institutions_service_spec.rb
@@ -22,14 +22,14 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
+ 'name' => 'name-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/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
@@ -99,12 +99,12 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
+ 'name' => 'name-input'
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1,
- },
+ limit: 1
+ }
}.to_json,
headers: response_headers
)
@@ -120,12 +120,12 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
+ 'name' => 'name-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -150,19 +150,19 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
+ 'name' => 'name-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' => [{
@@ -171,12 +171,12 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
+ 'name' => 'name-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -197,18 +197,18 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
+ 'name' => 'name-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' }
@@ -221,12 +221,12 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
+ 'name' => 'name-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -256,14 +256,14 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
+ 'name' => 'name-input'
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123',
- },
- },
+ after: 'ABC123'
+ }
+ }
}.to_json,
headers: response_headers
@@ -284,8 +284,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
@@ -302,8 +302,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(
@@ -315,8 +315,8 @@
'icon_url' => 'icon_url-input',
'id' => 'id-input',
'logo_url' => 'logo_url-input',
- 'name' => 'name-input',
- },
+ 'name' => 'name-input'
+ }
}.to_json,
headers: response_headers
)
diff --git a/spec/services/logos_service_spec.rb b/spec/services/logos_service_spec.rb
index e8dcded..895ba01 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 8e48e60..149d3a6 100644
--- a/spec/services/mandate_import_entries_service_spec.rb
+++ b/spec/services/mandate_import_entries_service_spec.rb
@@ -17,23 +17,23 @@
'created_at' => 'created_at-input',
'links' => 'links-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',
- 'record_identifier' => 'record_identifier-input',
- },
+ 'record_identifier' => 'record_identifier-input'
+ }
}
- ).
- to_return(
+ )
+ .to_return(
body: {
'mandate_import_entries' =>
@@ -41,8 +41,8 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
- 'record_identifier' => 'record_identifier-input',
- },
+ 'record_identifier' => 'record_identifier-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/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
@@ -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 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
- 'record_identifier' => 'record_identifier-input',
+ 'record_identifier' => 'record_identifier-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
@@ -152,14 +152,14 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
- 'record_identifier' => 'record_identifier-input',
+ 'record_identifier' => 'record_identifier-input'
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123',
- },
- },
+ after: 'ABC123'
+ }
+ }
}.to_json
end
@@ -191,19 +191,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
@@ -220,12 +220,12 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
- 'record_identifier' => 'record_identifier-input',
+ 'record_identifier' => 'record_identifier-input'
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1,
- },
+ limit: 1
+ }
}.to_json,
headers: response_headers
)
@@ -238,12 +238,12 @@
'created_at' => 'created_at-input',
'links' => 'links-input',
- 'record_identifier' => 'record_identifier-input',
+ 'record_identifier' => 'record_identifier-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -265,30 +265,30 @@
'created_at' => 'created_at-input',
'links' => 'links-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',
- 'record_identifier' => 'record_identifier-input',
+ 'record_identifier' => 'record_identifier-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -306,18 +306,18 @@
'created_at' => 'created_at-input',
'links' => 'links-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' }
@@ -327,12 +327,12 @@
'created_at' => 'created_at-input',
'links' => 'links-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 f8aff6e..6d40a1a 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 0a908e9..87c738d 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 14e0707..84a2ea5 100644
--- a/spec/services/mandates_service_spec.rb
+++ b/spec/services/mandates_service_spec.rb
@@ -17,6 +17,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -28,18 +29,19 @@
'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' => {
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -51,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' =>
@@ -63,6 +65,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -74,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
@@ -90,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
@@ -120,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
@@ -142,6 +145,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -153,7 +157,7 @@
'reference' => 'reference-input',
'scheme' => 'scheme-input',
'status' => 'status-input',
- 'verified_at' => 'verified_at-input',
+ 'verified_at' => 'verified_at-input'
}
end
@@ -168,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
@@ -181,13 +185,14 @@
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' => {
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -199,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
)
@@ -223,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
@@ -240,6 +245,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -251,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
@@ -276,6 +282,8 @@
expect(get_list_response.records.first.consent_parameters).to eq('consent_parameters-input')
+ expect(get_list_response.records.first.consent_type).to eq('consent_type-input')
+
expect(get_list_response.records.first.created_at).to eq('created_at-input')
expect(get_list_response.records.first.funds_settlement).to eq('funds_settlement-input')
@@ -310,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
@@ -339,6 +347,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -350,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
)
@@ -368,6 +377,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -379,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
)
@@ -406,6 +416,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -417,24 +428,25 @@
'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' => [{
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -446,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
)
@@ -469,6 +481,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -480,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' }
@@ -501,6 +514,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -512,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
)
@@ -538,14 +552,15 @@
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' => {
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -557,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
)
@@ -566,7 +581,7 @@
subject(:get_response) do
client.mandates.get(id, headers: {
- 'Foo' => 'Bar',
+ 'Foo' => 'Bar'
})
end
@@ -585,6 +600,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -596,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
)
@@ -636,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
@@ -646,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
@@ -665,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
@@ -701,6 +717,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -712,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
)
@@ -729,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
@@ -738,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
@@ -765,6 +782,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -776,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
@@ -793,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
@@ -811,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(
@@ -821,6 +839,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -832,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
)
@@ -855,6 +874,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -866,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
@@ -883,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
@@ -901,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(
@@ -911,6 +931,7 @@
'authorisation_source' => 'authorisation_source-input',
'consent_parameters' => 'consent_parameters-input',
+ 'consent_type' => 'consent_type-input',
'created_at' => 'created_at-input',
'funds_settlement' => 'funds_settlement-input',
'id' => 'id-input',
@@ -922,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 8bb1250..a34bfda 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
)
@@ -240,13 +240,13 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input',
+ 'links' => 'links-input'
}
end
before do
- stub_request(:post, %r{.*api.gocardless.com/negative_balance_limits}).
- with(
+ stub_request(:post, %r{.*api.gocardless.com/negative_balance_limits})
+ .with(
body: {
'negative_balance_limits' => {
@@ -254,11 +254,11 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input',
- },
+ 'links' => 'links-input'
+ }
}
- ).
- to_return(
+ )
+ .to_return(
body: {
'negative_balance_limits' =>
@@ -268,8 +268,8 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input',
- },
+ 'links' => 'links-input'
+ }
}.to_json,
headers: response_headers
@@ -284,19 +284,19 @@
before { allow_any_instance_of(GoCardlessPro::Request).to receive(:sleep) }
it 'retries timeouts' do
- stub = stub_request(:post, %r{.*api.gocardless.com/negative_balance_limits}).
- to_timeout.then.to_return({ status: 200, headers: response_headers })
+ stub = stub_request(:post, %r{.*api.gocardless.com/negative_balance_limits})
+ .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/negative_balance_limits}).
- 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/negative_balance_limits})
+ .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
@@ -314,9 +314,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
@@ -338,7 +338,7 @@
'created_at' => 'created_at-input',
'currency' => 'currency-input',
'id' => 'id-input',
- 'links' => 'links-input',
+ 'links' => 'links-input'
}
end
@@ -353,11 +353,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/payer_authorisations_service_spec.rb b/spec/services/payer_authorisations_service_spec.rb
index 591b614..ed21a90 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 905a8f2..4513005 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 b8037b5..c0a6908 100644
--- a/spec/services/payments_service_spec.rb
+++ b/spec/services/payments_service_spec.rb
@@ -28,13 +28,13 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-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' => {
@@ -51,11 +51,11 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}
- ).
- to_return(
+ )
+ .to_return(
body: {
'payments' =>
@@ -74,8 +74,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-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/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
@@ -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 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
+ 'status' => 'status-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 = "/payments/#{id}"
- stub_request(:get, /.*api.gocardless.com#{stub_url}/).
- to_return(
+ stub_request(:get, /.*api.gocardless.com#{stub_url}/)
+ .to_return(
body: {
'payments' => {
@@ -199,8 +199,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-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
@@ -251,14 +251,14 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
+ 'status' => 'status-input'
}],
meta: {
cursors: {
before: nil,
- after: 'ABC123',
- },
- },
+ after: 'ABC123'
+ }
+ }
}.to_json
end
@@ -310,19 +310,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
@@ -350,12 +350,12 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
+ 'status' => 'status-input'
}],
meta: {
cursors: { after: 'AB345' },
- limit: 1,
- },
+ limit: 1
+ }
}.to_json,
headers: response_headers
)
@@ -379,12 +379,12 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
+ 'status' => 'status-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -417,19 +417,19 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-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' => [{
@@ -446,12 +446,12 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
+ 'status' => 'status-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -480,18 +480,18 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-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' }
@@ -512,12 +512,12 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
+ 'status' => 'status-input'
}],
meta: {
limit: 2,
- cursors: {},
- },
+ cursors: {}
+ }
}.to_json,
headers: response_headers
)
@@ -538,9 +538,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' => {
@@ -557,8 +557,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
)
@@ -566,7 +566,7 @@
subject(:get_response) do
client.payments.get(id, headers: {
- 'Foo' => 'Bar',
+ 'Foo' => 'Bar'
})
end
@@ -596,8 +596,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
)
@@ -636,8 +636,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
@@ -646,11 +646,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
@@ -665,20 +665,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
@@ -712,8 +712,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
)
@@ -729,8 +729,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
@@ -738,11 +738,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
@@ -776,8 +776,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
@@ -793,8 +793,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
@@ -811,8 +811,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(
@@ -832,8 +832,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
)
@@ -866,8 +866,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-input',
- 'status' => 'status-input',
- },
+ 'status' => 'status-input'
+ }
}.to_json,
headers: response_headers
@@ -883,8 +883,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
@@ -901,8 +901,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(
@@ -922,8 +922,8 @@
'metadata' => 'metadata-input',
'reference' => 'reference-input',
'retry_if_possible' => 'retry_if_possible-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 7101753..ef699c5 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 91730b2..66b69a0 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 3ccf3d2..b462068 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 79d1161..82942cf 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 e418035..beb129b 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 e5f39b2..337aea9 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 060f553..f947376 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 7ac82a9..f3a8758 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 3d78d3f..3f2f369 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 f3ce3d1..ab0fe04 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 76b705b..32b5ccc 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 37a1a45..aa370a2 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