gocardless_pro 4.3.0 → 4.4.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +16 -0
  3. data/lib/gocardless_pro/client.rb +11 -1
  4. data/lib/gocardless_pro/list_response.rb +2 -2
  5. data/lib/gocardless_pro/resources/billing_request.rb +7 -8
  6. data/lib/gocardless_pro/resources/billing_request_with_action.rb +4 -4
  7. data/lib/gocardless_pro/resources/block.rb +4 -6
  8. data/lib/gocardless_pro/resources/creditor.rb +6 -4
  9. data/lib/gocardless_pro/resources/creditor_bank_account.rb +6 -5
  10. data/lib/gocardless_pro/resources/customer.rb +4 -3
  11. data/lib/gocardless_pro/resources/customer_bank_account.rb +13 -8
  12. data/lib/gocardless_pro/resources/customer_notification.rb +3 -4
  13. data/lib/gocardless_pro/resources/event.rb +13 -2
  14. data/lib/gocardless_pro/resources/export.rb +2 -0
  15. data/lib/gocardless_pro/resources/instalment_schedule.rb +0 -1
  16. data/lib/gocardless_pro/resources/institution.rb +3 -3
  17. data/lib/gocardless_pro/resources/logo.rb +2 -1
  18. data/lib/gocardless_pro/resources/mandate.rb +7 -4
  19. data/lib/gocardless_pro/resources/mandate_import.rb +25 -21
  20. data/lib/gocardless_pro/resources/mandate_import_entry.rb +13 -16
  21. data/lib/gocardless_pro/resources/mandate_pdf.rb +3 -3
  22. data/lib/gocardless_pro/resources/negative_balance_limit.rb +0 -1
  23. data/lib/gocardless_pro/resources/outbound_payment.rb +11 -4
  24. data/lib/gocardless_pro/resources/outbound_payment_import.rb +81 -0
  25. data/lib/gocardless_pro/resources/outbound_payment_import_entry.rb +77 -0
  26. data/lib/gocardless_pro/resources/payer_authorisation.rb +27 -31
  27. data/lib/gocardless_pro/resources/payment.rb +9 -6
  28. data/lib/gocardless_pro/resources/payment_account.rb +2 -1
  29. data/lib/gocardless_pro/resources/payment_account_transaction.rb +2 -1
  30. data/lib/gocardless_pro/resources/payout.rb +7 -6
  31. data/lib/gocardless_pro/resources/payout_item.rb +1 -2
  32. data/lib/gocardless_pro/resources/redirect_flow.rb +34 -23
  33. data/lib/gocardless_pro/resources/refund.rb +8 -6
  34. data/lib/gocardless_pro/resources/scheme_identifier.rb +0 -1
  35. data/lib/gocardless_pro/resources/subscription.rb +17 -14
  36. data/lib/gocardless_pro/resources/tax_rate.rb +2 -2
  37. data/lib/gocardless_pro/resources/verification_detail.rb +10 -6
  38. data/lib/gocardless_pro/services/balances_service.rb +11 -3
  39. data/lib/gocardless_pro/services/bank_account_details_service.rb +10 -4
  40. data/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb +7 -1
  41. data/lib/gocardless_pro/services/bank_authorisations_service.rb +7 -1
  42. data/lib/gocardless_pro/services/bank_details_lookups_service.rb +14 -6
  43. data/lib/gocardless_pro/services/billing_request_flows_service.rb +7 -1
  44. data/lib/gocardless_pro/services/billing_request_templates_service.rb +10 -3
  45. data/lib/gocardless_pro/services/billing_request_with_actions_service.rb +7 -1
  46. data/lib/gocardless_pro/services/billing_requests_service.rb +18 -13
  47. data/lib/gocardless_pro/services/blocks_service.rb +10 -3
  48. data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +10 -3
  49. data/lib/gocardless_pro/services/creditors_service.rb +10 -3
  50. data/lib/gocardless_pro/services/currency_exchange_rates_service.rb +10 -3
  51. data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +20 -10
  52. data/lib/gocardless_pro/services/customer_notifications_service.rb +7 -2
  53. data/lib/gocardless_pro/services/customers_service.rb +11 -5
  54. data/lib/gocardless_pro/services/events_service.rb +15 -3
  55. data/lib/gocardless_pro/services/exports_service.rb +7 -1
  56. data/lib/gocardless_pro/services/funds_availabilities_service.rb +7 -1
  57. data/lib/gocardless_pro/services/instalment_schedules_service.rb +15 -7
  58. data/lib/gocardless_pro/services/institutions_service.rb +7 -1
  59. data/lib/gocardless_pro/services/logos_service.rb +9 -3
  60. data/lib/gocardless_pro/services/mandate_import_entries_service.rb +10 -4
  61. data/lib/gocardless_pro/services/mandate_imports_service.rb +10 -2
  62. data/lib/gocardless_pro/services/mandate_pdfs_service.rb +11 -5
  63. data/lib/gocardless_pro/services/mandates_service.rb +16 -9
  64. data/lib/gocardless_pro/services/negative_balance_limits_service.rb +10 -3
  65. data/lib/gocardless_pro/services/outbound_payment_import_entries_service.rb +64 -0
  66. data/lib/gocardless_pro/services/outbound_payment_imports_service.rb +118 -0
  67. data/lib/gocardless_pro/services/outbound_payments_service.rb +11 -4
  68. data/lib/gocardless_pro/services/payer_authorisations_service.rb +11 -8
  69. data/lib/gocardless_pro/services/payer_themes_service.rb +7 -1
  70. data/lib/gocardless_pro/services/payment_account_transactions_service.rb +34 -7
  71. data/lib/gocardless_pro/services/payment_accounts_service.rb +10 -3
  72. data/lib/gocardless_pro/services/payments_service.rb +22 -14
  73. data/lib/gocardless_pro/services/payout_items_service.rb +12 -7
  74. data/lib/gocardless_pro/services/payouts_service.rb +12 -5
  75. data/lib/gocardless_pro/services/redirect_flows_service.rb +15 -5
  76. data/lib/gocardless_pro/services/refunds_service.rb +15 -10
  77. data/lib/gocardless_pro/services/scenario_simulators_service.rb +85 -82
  78. data/lib/gocardless_pro/services/scheme_identifiers_service.rb +13 -7
  79. data/lib/gocardless_pro/services/subscriptions_service.rb +48 -38
  80. data/lib/gocardless_pro/services/tax_rates_service.rb +10 -3
  81. data/lib/gocardless_pro/services/transferred_mandates_service.rb +7 -1
  82. data/lib/gocardless_pro/services/verification_details_service.rb +7 -1
  83. data/lib/gocardless_pro/services/webhooks_service.rb +10 -3
  84. data/lib/gocardless_pro/version.rb +1 -1
  85. data/lib/gocardless_pro/webhook.rb +45 -0
  86. data/lib/gocardless_pro.rb +6 -0
  87. metadata +7 -7
@@ -19,23 +19,25 @@ module GoCardlessPro
19
19
  # number match the details held by
20
20
  # the relevant bank.
21
21
  #
22
- # If your request returns an [error](#api-usage-errors) or the
22
+ # If your request returns an error
23
+ # (https://developer.gocardless.com/api-reference/#api-usage-errors) or the
23
24
  # `available_debit_schemes`
24
25
  # attribute is an empty array, you will not be able to collect payments from the
25
26
  # specified bank account. GoCardless may be able to collect payments from an
26
27
  # account
27
28
  # even if no `bic` is returned.
28
29
  #
29
- # Bank account details may be supplied using [local
30
- # details](#appendix-local-bank-details) or an IBAN.
30
+ # Bank account details may be supplied using local details
31
+ # (https://developer.gocardless.com/api-reference/#appendix-local-bank-details)
32
+ # or an IBAN.
31
33
  #
32
- # _ACH scheme_ For compliance reasons, an extra validation step is done using
34
+ # ACH scheme For compliance reasons, an extra validation step is done using
33
35
  # a third-party provider to make sure the customer's bank account can accept
34
36
  # Direct Debit. If a bank account is discovered to be closed or invalid, the
35
37
  # customer is requested to adjust the account number/routing number and
36
38
  # succeed in this check to continue with the flow.
37
39
  #
38
- # _Note:_ Usage of this endpoint is monitored. If your organisation relies on
40
+ # Note: Usage of this endpoint is monitored. If your organisation relies on
39
41
  # GoCardless for
40
42
  # modulus or reachability checking but not for payment collection, please get in
41
43
  # touch.
@@ -63,7 +65,13 @@ module GoCardlessPro
63
65
  #
64
66
  # @param body [Hash]
65
67
  def unenvelope_body(body)
66
- body[envelope_key] || body['data']
68
+ if body.key?(envelope_key)
69
+ body[envelope_key]
70
+ elsif body.key?('data')
71
+ body['data']
72
+ else
73
+ body
74
+ end
67
75
  end
68
76
 
69
77
  # return the key which API responses will envelope data under
@@ -60,7 +60,13 @@ module GoCardlessPro
60
60
  #
61
61
  # @param body [Hash]
62
62
  def unenvelope_body(body)
63
- body[envelope_key] || body['data']
63
+ if body.key?(envelope_key)
64
+ body[envelope_key]
65
+ elsif body.key?('data')
66
+ body['data']
67
+ else
68
+ body
69
+ end
64
70
  end
65
71
 
66
72
  # return the key which API responses will envelope data under
@@ -10,8 +10,9 @@ module GoCardlessPro
10
10
  module Services
11
11
  # Service for making requests to the BillingRequestTemplate endpoints
12
12
  class BillingRequestTemplatesService < BaseService
13
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
14
- # Billing Request Templates.
13
+ # Returns a cursor-paginated
14
+ # (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
15
+ # list of your Billing Request Templates.
15
16
  # Example URL: /billing_request_templates
16
17
  # @param options [Hash] parameters as a hash, under a params key.
17
18
  def list(options = {})
@@ -123,7 +124,13 @@ module GoCardlessPro
123
124
  #
124
125
  # @param body [Hash]
125
126
  def unenvelope_body(body)
126
- body[envelope_key] || body['data']
127
+ if body.key?(envelope_key)
128
+ body[envelope_key]
129
+ elsif body.key?('data')
130
+ body['data']
131
+ else
132
+ body
133
+ end
127
134
  end
128
135
 
129
136
  # return the key which API responses will envelope data under
@@ -40,7 +40,13 @@ module GoCardlessPro
40
40
  #
41
41
  # @param body [Hash]
42
42
  def unenvelope_body(body)
43
- body[envelope_key] || body['data']
43
+ if body.key?(envelope_key)
44
+ body[envelope_key]
45
+ elsif body.key?('data')
46
+ body['data']
47
+ else
48
+ body
49
+ end
44
50
  end
45
51
 
46
52
  # return the key which API responses will envelope data under
@@ -10,9 +10,8 @@ module GoCardlessPro
10
10
  module Services
11
11
  # Service for making requests to the BillingRequest endpoints
12
12
  class BillingRequestsService < BaseService
13
- # <p class="notice"><strong>Important</strong>: All properties associated with
14
- # `subscription_request` and `instalment_schedule_request` are only supported
15
- # for ACH and PAD schemes.</p>
13
+ # Important: All properties associated with `subscription_request` and
14
+ # `instalment_schedule_request` are only supported for ACH and PAD schemes.
16
15
  # Example URL: /billing_requests
17
16
  # @param options [Hash] parameters as a hash, under a params key.
18
17
  def create(options = {})
@@ -47,7 +46,7 @@ module GoCardlessPro
47
46
  Resources::BillingRequest.new(unenvelope_body(response.body), response)
48
47
  end
49
48
 
50
- # If the billing request has a pending <code>collect_customer_details</code>
49
+ # If the billing request has a pending collect_customer_details
51
50
  # action, this endpoint can be used to collect the details in order to
52
51
  # complete it.
53
52
  #
@@ -96,7 +95,7 @@ module GoCardlessPro
96
95
  end
97
96
 
98
97
  # If the billing request has a pending
99
- # <code>collect_bank_account</code> action, this endpoint can be
98
+ # collect_bank_account action, this endpoint can be
100
99
  # used to collect the details in order to complete it.
101
100
  #
102
101
  # The endpoint takes the same payload as Customer Bank Accounts, but check
@@ -107,14 +106,14 @@ module GoCardlessPro
107
106
  # the payload along with the
108
107
  # country_code.
109
108
  #
110
- # _ACH scheme_ For compliance reasons, an extra validation step is done using
109
+ # ACH scheme For compliance reasons, an extra validation step is done using
111
110
  # a third-party provider to make sure the customer's bank account can accept
112
111
  # Direct Debit. If a bank account is discovered to be closed or invalid, the
113
112
  # customer is requested to adjust the account number/routing number and
114
113
  # succeed in this check to continue with the flow.
115
114
  #
116
- # _BACS scheme_ [Payer Name
117
- # Verification](https://hub.gocardless.com/s/article/Introduction-to-Payer-Name-Verification?language=en_GB)
115
+ # BACS scheme Payer Name Verification
116
+ # (https://hub.gocardless.com/s/article/Introduction-to-Payer-Name-Verification?language=en_GB)
118
117
  # is enabled by default for UK based bank accounts, meaning we verify the
119
118
  # account holder name and bank account
120
119
  # number match the details held by the relevant bank.
@@ -277,8 +276,9 @@ module GoCardlessPro
277
276
  Resources::BillingRequest.new(unenvelope_body(response.body), response)
278
277
  end
279
278
 
280
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
281
- # billing requests.
279
+ # Returns a cursor-paginated
280
+ # (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
281
+ # list of your billing requests.
282
282
  # Example URL: /billing_requests
283
283
  # @param options [Hash] parameters as a hash, under a params key.
284
284
  def list(options = {})
@@ -329,8 +329,7 @@ module GoCardlessPro
329
329
  # it.
330
330
  # Currently, the customer can only be notified by email.
331
331
  #
332
- # This endpoint is currently supported only for Instant Bank Pay Billing
333
- # Requests.
332
+ # This endpoint is currently supported only for Pay by Bank Billing Requests.
334
333
  # Example URL: /billing_requests/:identity/actions/notify
335
334
  #
336
335
  # @param identity # Unique identifier, beginning with "BRQ".
@@ -499,7 +498,13 @@ module GoCardlessPro
499
498
  #
500
499
  # @param body [Hash]
501
500
  def unenvelope_body(body)
502
- body[envelope_key] || body['data']
501
+ if body.key?(envelope_key)
502
+ body[envelope_key]
503
+ elsif body.key?('data')
504
+ body['data']
505
+ else
506
+ body
507
+ end
503
508
  end
504
509
 
505
510
  # return the key which API responses will envelope data under
@@ -64,8 +64,9 @@ module GoCardlessPro
64
64
  Resources::Block.new(unenvelope_body(response.body), response)
65
65
  end
66
66
 
67
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
68
- # blocks.
67
+ # Returns a cursor-paginated
68
+ # (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
69
+ # list of your blocks.
69
70
  # Example URL: /blocks
70
71
  # @param options [Hash] parameters as a hash, under a params key.
71
72
  def list(options = {})
@@ -217,7 +218,13 @@ module GoCardlessPro
217
218
  #
218
219
  # @param body [Hash]
219
220
  def unenvelope_body(body)
220
- body[envelope_key] || body['data']
221
+ if body.key?(envelope_key)
222
+ body[envelope_key]
223
+ elsif body.key?('data')
224
+ body['data']
225
+ else
226
+ body
227
+ end
221
228
  end
222
229
 
223
230
  # return the key which API responses will envelope data under
@@ -45,8 +45,9 @@ module GoCardlessPro
45
45
  Resources::CreditorBankAccount.new(unenvelope_body(response.body), response)
46
46
  end
47
47
 
48
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
49
- # creditor bank accounts.
48
+ # Returns a cursor-paginated
49
+ # (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
50
+ # list of your creditor bank accounts.
50
51
  # Example URL: /creditor_bank_accounts
51
52
  # @param options [Hash] parameters as a hash, under a params key.
52
53
  def list(options = {})
@@ -145,7 +146,13 @@ module GoCardlessPro
145
146
  #
146
147
  # @param body [Hash]
147
148
  def unenvelope_body(body)
148
- body[envelope_key] || body['data']
149
+ if body.key?(envelope_key)
150
+ body[envelope_key]
151
+ elsif body.key?('data')
152
+ body['data']
153
+ else
154
+ body
155
+ end
149
156
  end
150
157
 
151
158
  # return the key which API responses will envelope data under
@@ -45,8 +45,9 @@ module GoCardlessPro
45
45
  Resources::Creditor.new(unenvelope_body(response.body), response)
46
46
  end
47
47
 
48
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
49
- # creditors.
48
+ # Returns a cursor-paginated
49
+ # (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
50
+ # list of your creditors.
50
51
  # Example URL: /creditors
51
52
  # @param options [Hash] parameters as a hash, under a params key.
52
53
  def list(options = {})
@@ -123,7 +124,13 @@ module GoCardlessPro
123
124
  #
124
125
  # @param body [Hash]
125
126
  def unenvelope_body(body)
126
- body[envelope_key] || body['data']
127
+ if body.key?(envelope_key)
128
+ body[envelope_key]
129
+ elsif body.key?('data')
130
+ body['data']
131
+ else
132
+ body
133
+ end
127
134
  end
128
135
 
129
136
  # return the key which API responses will envelope data under
@@ -10,8 +10,9 @@ module GoCardlessPro
10
10
  module Services
11
11
  # Service for making requests to the CurrencyExchangeRate endpoints
12
12
  class CurrencyExchangeRatesService < BaseService
13
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of all
14
- # exchange rates.
13
+ # Returns a cursor-paginated
14
+ # (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
15
+ # list of all exchange rates.
15
16
  # Example URL: /currency_exchange_rates
16
17
  # @param options [Hash] parameters as a hash, under a params key.
17
18
  def list(options = {})
@@ -45,7 +46,13 @@ module GoCardlessPro
45
46
  #
46
47
  # @param body [Hash]
47
48
  def unenvelope_body(body)
48
- body[envelope_key] || body['data']
49
+ if body.key?(envelope_key)
50
+ body[envelope_key]
51
+ elsif body.key?('data')
52
+ body['data']
53
+ else
54
+ body
55
+ end
49
56
  end
50
57
 
51
58
  # return the key which API responses will envelope data under
@@ -14,15 +14,18 @@ module GoCardlessPro
14
14
  #
15
15
  # There are three different ways to supply bank account details:
16
16
  #
17
- # - [Local details](#appendix-local-bank-details)
18
- #
19
- # - IBAN
20
- #
21
- # - [Customer Bank Account
22
- # Tokens](#javascript-flow-create-a-customer-bank-account-token)
17
+ # -
18
+ # Local details
19
+ # (https://developer.gocardless.com/api-reference/#appendix-local-bank-details)
20
+ # -
21
+ # IBAN
22
+ # -
23
+ # Customer Bank Account Tokens
24
+ # (https://developer.gocardless.com/api-reference/#javascript-flow-create-a-customer-bank-account-token)
23
25
  #
24
26
  # For more information on the different fields required in each country, see
25
- # [local bank details](#appendix-local-bank-details).
27
+ # local bank details
28
+ # (https://developer.gocardless.com/api-reference/#appendix-local-bank-details).
26
29
  # Example URL: /customer_bank_accounts
27
30
  # @param options [Hash] parameters as a hash, under a params key.
28
31
  def create(options = {})
@@ -57,8 +60,9 @@ module GoCardlessPro
57
60
  Resources::CustomerBankAccount.new(unenvelope_body(response.body), response)
58
61
  end
59
62
 
60
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your bank
61
- # accounts.
63
+ # Returns a cursor-paginated
64
+ # (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
65
+ # list of your bank accounts.
62
66
  # Example URL: /customer_bank_accounts
63
67
  # @param options [Hash] parameters as a hash, under a params key.
64
68
  def list(options = {})
@@ -180,7 +184,13 @@ module GoCardlessPro
180
184
  #
181
185
  # @param body [Hash]
182
186
  def unenvelope_body(body)
183
- body[envelope_key] || body['data']
187
+ if body.key?(envelope_key)
188
+ body[envelope_key]
189
+ elsif body.key?('data')
190
+ body['data']
191
+ else
192
+ body
193
+ end
184
194
  end
185
195
 
186
196
  # return the key which API responses will envelope data under
@@ -17,7 +17,6 @@ module GoCardlessPro
17
17
  # passed,
18
18
  # this endpoint will return an `already_actioned` error and you should not take
19
19
  # further action. This endpoint takes no additional parameters.
20
- #
21
20
  # Example URL: /customer_notifications/:identity/actions/handle
22
21
  #
23
22
  # @param identity # The id of the notification.
@@ -46,7 +45,13 @@ module GoCardlessPro
46
45
  #
47
46
  # @param body [Hash]
48
47
  def unenvelope_body(body)
49
- body[envelope_key] || body['data']
48
+ if body.key?(envelope_key)
49
+ body[envelope_key]
50
+ elsif body.key?('data')
51
+ body['data']
52
+ else
53
+ body
54
+ end
50
55
  end
51
56
 
52
57
  # return the key which API responses will envelope data under
@@ -45,8 +45,9 @@ module GoCardlessPro
45
45
  Resources::Customer.new(unenvelope_body(response.body), response)
46
46
  end
47
47
 
48
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
49
- # customers.
48
+ # Returns a cursor-paginated
49
+ # (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
50
+ # list of your customers.
50
51
  # Example URL: /customers
51
52
  # @param options [Hash] parameters as a hash, under a params key.
52
53
  def list(options = {})
@@ -123,8 +124,7 @@ module GoCardlessPro
123
124
  # customer by
124
125
  # ID.
125
126
  #
126
- # <p class="restricted-notice"><strong>The action of removing a customer cannot
127
- # be reversed, so please use with care.</strong></p>
127
+ # The action of removing a customer cannot be reversed, so please use with care.
128
128
  # Example URL: /customers/:identity
129
129
  #
130
130
  # @param identity # Unique identifier, beginning with "CU".
@@ -149,7 +149,13 @@ module GoCardlessPro
149
149
  #
150
150
  # @param body [Hash]
151
151
  def unenvelope_body(body)
152
- body[envelope_key] || body['data']
152
+ if body.key?(envelope_key)
153
+ body[envelope_key]
154
+ elsif body.key?('data')
155
+ body['data']
156
+ else
157
+ body
158
+ end
153
159
  end
154
160
 
155
161
  # return the key which API responses will envelope data under
@@ -10,8 +10,14 @@ module GoCardlessPro
10
10
  module Services
11
11
  # Service for making requests to the Event endpoints
12
12
  class EventsService < BaseService
13
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
14
- # events.
13
+ # Returns a cursor-paginated
14
+ # (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
15
+ # list of your events.
16
+ #
17
+ # Important: This endpoint will no longer return events older than 18 months,
18
+ # including when filtering by resource. This takes effect no sooner than 1
19
+ # August 2026 in sandbox environments, and no sooner than 1 October 2026 in live
20
+ # environments.
15
21
  # Example URL: /events
16
22
  # @param options [Hash] parameters as a hash, under a params key.
17
23
  def list(options = {})
@@ -64,7 +70,13 @@ module GoCardlessPro
64
70
  #
65
71
  # @param body [Hash]
66
72
  def unenvelope_body(body)
67
- body[envelope_key] || body['data']
73
+ if body.key?(envelope_key)
74
+ body[envelope_key]
75
+ elsif body.key?('data')
76
+ body['data']
77
+ else
78
+ body
79
+ end
68
80
  end
69
81
 
70
82
  # return the key which API responses will envelope data under
@@ -63,7 +63,13 @@ module GoCardlessPro
63
63
  #
64
64
  # @param body [Hash]
65
65
  def unenvelope_body(body)
66
- body[envelope_key] || body['data']
66
+ if body.key?(envelope_key)
67
+ body[envelope_key]
68
+ elsif body.key?('data')
69
+ body['data']
70
+ else
71
+ body
72
+ end
67
73
  end
68
74
 
69
75
  # return the key which API responses will envelope data under
@@ -38,7 +38,13 @@ module GoCardlessPro
38
38
  #
39
39
  # @param body [Hash]
40
40
  def unenvelope_body(body)
41
- body[envelope_key] || body['data']
41
+ if body.key?(envelope_key)
42
+ body[envelope_key]
43
+ elsif body.key?('data')
44
+ body['data']
45
+ else
46
+ body
47
+ end
42
48
  end
43
49
 
44
50
  # return the key which API responses will envelope data under
@@ -14,8 +14,8 @@ module GoCardlessPro
14
14
  # This
15
15
  # API is recommended if you know the specific dates you wish to charge.
16
16
  # Otherwise,
17
- # please check out the [scheduling
18
- # version](#instalment-schedules-create-with-schedule).
17
+ # please check out the scheduling version
18
+ # (https://developer.gocardless.com/api-reference/#instalment-schedules-create-with-schedule).
19
19
  #
20
20
  # The `instalments` property is an array of payment properties (`amount` and
21
21
  # `charge_date`).
@@ -67,8 +67,9 @@ module GoCardlessPro
67
67
  # This
68
68
  # API is recommended if you wish to use the GoCardless scheduling logic. For
69
69
  # finer
70
- # control over the individual dates, please check out the [alternative
71
- # version](#instalment-schedules-create-with-dates).
70
+ # control over the individual dates, please check out the alternative
71
+ # version
72
+ # (https://developer.gocardless.com/api-reference/#instalment-schedules-create-with-dates).
72
73
  #
73
74
  # It can take quite a while to create the associated payments, so the API will
74
75
  # return
@@ -111,8 +112,9 @@ module GoCardlessPro
111
112
  Resources::InstalmentSchedule.new(unenvelope_body(response.body), response)
112
113
  end
113
114
 
114
- # Returns a [cursor-paginated](#api-usage-cursor-pagination) list of your
115
- # instalment schedules.
115
+ # Returns a cursor-paginated
116
+ # (https://developer.gocardless.com/api-reference/#api-usage-cursor-pagination)
117
+ # list of your instalment schedules.
116
118
  # Example URL: /instalment_schedules
117
119
  # @param options [Hash] parameters as a hash, under a params key.
118
120
  def list(options = {})
@@ -231,7 +233,13 @@ module GoCardlessPro
231
233
  #
232
234
  # @param body [Hash]
233
235
  def unenvelope_body(body)
234
- body[envelope_key] || body['data']
236
+ if body.key?(envelope_key)
237
+ body[envelope_key]
238
+ elsif body.key?('data')
239
+ body['data']
240
+ else
241
+ body
242
+ end
235
243
  end
236
244
 
237
245
  # return the key which API responses will envelope data under
@@ -67,7 +67,13 @@ module GoCardlessPro
67
67
  #
68
68
  # @param body [Hash]
69
69
  def unenvelope_body(body)
70
- body[envelope_key] || body['data']
70
+ if body.key?(envelope_key)
71
+ body[envelope_key]
72
+ elsif body.key?('data')
73
+ body['data']
74
+ else
75
+ body
76
+ end
71
77
  end
72
78
 
73
79
  # return the key which API responses will envelope data under
@@ -15,8 +15,8 @@ module GoCardlessPro
15
15
  #
16
16
  # We support JPG and PNG formats. Your logo will be scaled to a maximum of 300px
17
17
  # by 40px. For more guidance on how to upload logos that will look
18
- # great across your customer payment page and notification emails see
19
- # [here](https://developer.gocardless.com/gc-embed/setting-up-branding#tips_for_uploading_your_logo).
18
+ # great across your customer payment page and notification emails see here
19
+ # (https://developer.gocardless.com/gc-embed/setting-up-branding#tips_for_uploading_your_logo).
20
20
  # Example URL: /branding/logos
21
21
  # @param options [Hash] parameters as a hash, under a params key.
22
22
  def create_for_creditor(options = {})
@@ -41,7 +41,13 @@ module GoCardlessPro
41
41
  #
42
42
  # @param body [Hash]
43
43
  def unenvelope_body(body)
44
- body[envelope_key] || body['data']
44
+ if body.key?(envelope_key)
45
+ body[envelope_key]
46
+ elsif body.key?('data')
47
+ body['data']
48
+ else
49
+ body
50
+ end
45
51
  end
46
52
 
47
53
  # return the key which API responses will envelope data under
@@ -10,8 +10,9 @@ module GoCardlessPro
10
10
  module Services
11
11
  # Service for making requests to the MandateImportEntry endpoints
12
12
  class MandateImportEntriesService < BaseService
13
- # For an existing [mandate import](#core-endpoints-mandate-imports), this
14
- # endpoint can
13
+ # For an existing mandate import
14
+ # (https://developer.gocardless.com/api-reference/#core-endpoints-mandate-imports),
15
+ # this endpoint can
15
16
  # be used to add individual mandates to be imported into GoCardless.
16
17
  #
17
18
  # You can add no more than 30,000 rows to a single mandate import.
@@ -43,7 +44,6 @@ module GoCardlessPro
43
44
  # in your system (using the `record_identifier` that you provided when creating
44
45
  # the
45
46
  # mandate import).
46
- #
47
47
  # Example URL: /mandate_import_entries
48
48
  # @param options [Hash] parameters as a hash, under a params key.
49
49
  def list(options = {})
@@ -77,7 +77,13 @@ module GoCardlessPro
77
77
  #
78
78
  # @param body [Hash]
79
79
  def unenvelope_body(body)
80
- body[envelope_key] || body['data']
80
+ if body.key?(envelope_key)
81
+ body[envelope_key]
82
+ elsif body.key?('data')
83
+ body['data']
84
+ else
85
+ body
86
+ end
81
87
  end
82
88
 
83
89
  # return the key which API responses will envelope data under
@@ -14,7 +14,9 @@ module GoCardlessPro
14
14
  # this endpoint merely signals the start of the import process. Once you've
15
15
  # finished
16
16
  # adding entries to an import, you should
17
- # [submit](#mandate-imports-submit-a-mandate-import) it.
17
+ # submit
18
+ # (https://developer.gocardless.com/api-reference/#mandate-imports-submit-a-mandate-import)
19
+ # it.
18
20
  # Example URL: /mandate_imports
19
21
  # @param options [Hash] parameters as a hash, under a params key.
20
22
  def create(options = {})
@@ -168,7 +170,13 @@ module GoCardlessPro
168
170
  #
169
171
  # @param body [Hash]
170
172
  def unenvelope_body(body)
171
- body[envelope_key] || body['data']
173
+ if body.key?(envelope_key)
174
+ body[envelope_key]
175
+ elsif body.key?('data')
176
+ body['data']
177
+ else
178
+ body
179
+ end
172
180
  end
173
181
 
174
182
  # return the key which API responses will envelope data under
@@ -13,14 +13,14 @@ module GoCardlessPro
13
13
  # Generates a PDF mandate and returns its temporary URL.
14
14
  #
15
15
  # Customer and bank account details can be left blank (for a blank mandate),
16
- # provided manually, or inferred from the ID of an existing
17
- # [mandate](#core-endpoints-mandates).
16
+ # provided manually, or inferred from the ID of an existing mandate
17
+ # (https://developer.gocardless.com/api-reference/#core-endpoints-mandates).
18
18
  #
19
19
  # By default, we'll generate PDF mandates in English.
20
20
  #
21
21
  # To generate a PDF mandate in another language, set the `Accept-Language`
22
- # header when creating the PDF mandate to the relevant [ISO
23
- # 639-1](http://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code
22
+ # header when creating the PDF mandate to the relevant ISO 639-1
23
+ # (https://en.wikipedia.org/wiki/List_of_ISO_639-1_codes) language code
24
24
  # supported for the scheme.
25
25
  #
26
26
  # | Scheme | Supported languages
@@ -77,7 +77,13 @@ module GoCardlessPro
77
77
  #
78
78
  # @param body [Hash]
79
79
  def unenvelope_body(body)
80
- body[envelope_key] || body['data']
80
+ if body.key?(envelope_key)
81
+ body[envelope_key]
82
+ elsif body.key?('data')
83
+ body['data']
84
+ else
85
+ body
86
+ end
81
87
  end
82
88
 
83
89
  # return the key which API responses will envelope data under