gocardless_pro 4.2.0 → 4.3.0

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 (83) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +0 -12
  3. data/lib/gocardless_pro/client.rb +23 -3
  4. data/lib/gocardless_pro/error.rb +3 -3
  5. data/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb +11 -3
  6. data/lib/gocardless_pro/paginator.rb +3 -2
  7. data/lib/gocardless_pro/resources/balance.rb +4 -1
  8. data/lib/gocardless_pro/resources/bank_account_detail.rb +5 -1
  9. data/lib/gocardless_pro/resources/bank_account_holder_verification.rb +44 -0
  10. data/lib/gocardless_pro/resources/bank_authorisation.rb +9 -2
  11. data/lib/gocardless_pro/resources/bank_details_lookup.rb +3 -1
  12. data/lib/gocardless_pro/resources/billing_request.rb +17 -2
  13. data/lib/gocardless_pro/resources/billing_request_flow.rb +18 -2
  14. data/lib/gocardless_pro/resources/billing_request_template.rb +18 -2
  15. data/lib/gocardless_pro/resources/billing_request_with_action.rb +2 -1
  16. data/lib/gocardless_pro/resources/block.rb +8 -2
  17. data/lib/gocardless_pro/resources/creditor.rb +20 -2
  18. data/lib/gocardless_pro/resources/creditor_bank_account.rb +11 -2
  19. data/lib/gocardless_pro/resources/currency_exchange_rate.rb +4 -1
  20. data/lib/gocardless_pro/resources/customer.rb +18 -2
  21. data/lib/gocardless_pro/resources/customer_bank_account.rb +11 -2
  22. data/lib/gocardless_pro/resources/customer_notification.rb +5 -1
  23. data/lib/gocardless_pro/resources/event.rb +19 -3
  24. data/lib/gocardless_pro/resources/export.rb +5 -1
  25. data/lib/gocardless_pro/resources/funds_availability.rb +38 -0
  26. data/lib/gocardless_pro/resources/instalment_schedule.rb +8 -1
  27. data/lib/gocardless_pro/resources/institution.rb +8 -1
  28. data/lib/gocardless_pro/resources/mandate.rb +14 -2
  29. data/lib/gocardless_pro/resources/mandate_import.rb +4 -1
  30. data/lib/gocardless_pro/resources/mandate_import_entry.rb +3 -1
  31. data/lib/gocardless_pro/resources/mandate_pdf.rb +2 -1
  32. data/lib/gocardless_pro/resources/negative_balance_limit.rb +4 -1
  33. data/lib/gocardless_pro/resources/outbound_payment.rb +23 -9
  34. data/lib/gocardless_pro/resources/payer_authorisation.rb +7 -1
  35. data/lib/gocardless_pro/resources/payment.rb +15 -2
  36. data/lib/gocardless_pro/resources/payment_account.rb +63 -0
  37. data/lib/gocardless_pro/resources/payment_account_transaction.rb +78 -0
  38. data/lib/gocardless_pro/resources/payout.rb +12 -2
  39. data/lib/gocardless_pro/resources/payout_item.rb +3 -1
  40. data/lib/gocardless_pro/resources/redirect_flow.rb +10 -2
  41. data/lib/gocardless_pro/resources/refund.rb +8 -1
  42. data/lib/gocardless_pro/resources/scheme_identifier.rb +18 -2
  43. data/lib/gocardless_pro/resources/subscription.rb +20 -2
  44. data/lib/gocardless_pro/resources/tax_rate.rb +6 -1
  45. data/lib/gocardless_pro/resources/transferred_mandate.rb +3 -1
  46. data/lib/gocardless_pro/resources/verification_detail.rb +9 -2
  47. data/lib/gocardless_pro/resources/webhook.rb +13 -2
  48. data/lib/gocardless_pro/services/bank_account_details_service.rb +7 -2
  49. data/lib/gocardless_pro/services/bank_account_holder_verifications_service.rb +86 -0
  50. data/lib/gocardless_pro/services/bank_authorisations_service.rb +2 -2
  51. data/lib/gocardless_pro/services/billing_request_flows_service.rb +1 -1
  52. data/lib/gocardless_pro/services/billing_request_templates_service.rb +4 -4
  53. data/lib/gocardless_pro/services/billing_requests_service.rb +20 -20
  54. data/lib/gocardless_pro/services/blocks_service.rb +7 -7
  55. data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +4 -4
  56. data/lib/gocardless_pro/services/creditors_service.rb +3 -3
  57. data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +5 -5
  58. data/lib/gocardless_pro/services/customer_notifications_service.rb +1 -1
  59. data/lib/gocardless_pro/services/customers_service.rb +4 -4
  60. data/lib/gocardless_pro/services/events_service.rb +1 -1
  61. data/lib/gocardless_pro/services/exports_service.rb +1 -1
  62. data/lib/gocardless_pro/services/funds_availabilities_service.rb +50 -0
  63. data/lib/gocardless_pro/services/instalment_schedules_service.rb +6 -6
  64. data/lib/gocardless_pro/services/institutions_service.rb +1 -1
  65. data/lib/gocardless_pro/services/mandate_imports_service.rb +6 -6
  66. data/lib/gocardless_pro/services/mandates_service.rb +7 -7
  67. data/lib/gocardless_pro/services/outbound_payments_service.rb +23 -8
  68. data/lib/gocardless_pro/services/payer_authorisations_service.rb +7 -7
  69. data/lib/gocardless_pro/services/payment_account_transactions_service.rb +66 -0
  70. data/lib/gocardless_pro/services/payment_accounts_service.rb +76 -0
  71. data/lib/gocardless_pro/services/payments_service.rb +7 -7
  72. data/lib/gocardless_pro/services/payouts_service.rb +2 -2
  73. data/lib/gocardless_pro/services/redirect_flows_service.rb +4 -4
  74. data/lib/gocardless_pro/services/refunds_service.rb +3 -3
  75. data/lib/gocardless_pro/services/scenario_simulators_service.rb +10 -4
  76. data/lib/gocardless_pro/services/scheme_identifiers_service.rb +2 -2
  77. data/lib/gocardless_pro/services/subscriptions_service.rb +9 -9
  78. data/lib/gocardless_pro/services/tax_rates_service.rb +1 -1
  79. data/lib/gocardless_pro/services/transferred_mandates_service.rb +1 -1
  80. data/lib/gocardless_pro/services/webhooks_service.rb +3 -3
  81. data/lib/gocardless_pro/version.rb +1 -1
  82. data/lib/gocardless_pro.rb +12 -0
  83. metadata +33 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 324f2075e7f922125fa514b785a008cf798f8f3ecc7091a484fe509507ea8170
4
- data.tar.gz: 3fdb7faec2ddcdce67049f0f4c1369815a41bdfd678b40b7fc105ebfed0b7401
3
+ metadata.gz: 52c8eb47da5317720b3527b44e2897d64a4f1ca2ad7c85c8ee15bfb753291e3f
4
+ data.tar.gz: 114e42e6b542344d4f335f1e6709bcc6e8631e3d8811f4a49e7419e0fd78aa9f
5
5
  SHA512:
6
- metadata.gz: ac379f7f21848f4bb8b491ad21f5badf39f0846c1452b0b91a082ca9f41b1afce0a771dea444c0dda775712789ec2ed72e8d8184615a8188eee13ff1961b48b7
7
- data.tar.gz: b7f63bfc31a8415044928edb1c65a0d748bb0498c42f7319b3e15759a6969184731be96cc01fa39917356741a75c45cb0b2531c44653b100888821b534fb70bd
6
+ metadata.gz: bc873ef338b211e379cbb8256342d1c35131bce737643f7555c3ccaa570e53f0e3b2eda494f405add95316f886bb87f0ef68ca211dad80aecf8a09c023445f69
7
+ data.tar.gz: f75b2d5745317a0f93ea0582fda2f63830f495cb5239af0658330799907ff5bdf189fed85f533f5e5576c38353a36b5f5611899b4f75b6ca5ef3c97dfb1e37c3
data/README.md CHANGED
@@ -260,18 +260,6 @@ OAuth simply provides a means by which you obtain an access token - once you hav
260
260
 
261
261
  We recommend using the [oauth2](https://github.com/intridea/oauth2) gem to handle the authorisation process and gain a token. For an example of this in action, see our [open-source OAuth demo app](https://github.com/gocardless/oauth-demo/blob/master/app.rb#L46).
262
262
 
263
- ## Supporting Ruby < 2.0.0
264
- The client only supports Ruby >= 2.0.0 out of the box due to our use of
265
- Enumerable::Lazy for lazy loading of paginated API resources.
266
-
267
- If you wish to use this gem with a previous ruby version, you should be able to
268
- do so with the [backports](https://github.com/marcandre/backports) gem:
269
-
270
- 1. Add backports to your Gemfile
271
- ```gem 'backports'```
272
- 2. Require lazy enumerables
273
- ```require 'backports/2.0.0/enumerable/lazy.rb'```
274
-
275
263
  ## Contributing
276
264
 
277
265
  This client is auto-generated from Crank, a toolchain that we hope to open source soon. For now, issues should be reported on this repository. __Please do not modify the source code yourself, your changes will be overriden!__
@@ -13,6 +13,11 @@ module GoCardlessPro
13
13
  @bank_account_details ||= Services::BankAccountDetailsService.new(@api_service)
14
14
  end
15
15
 
16
+ # Access to the service for bank_account_holder_verification to make API calls
17
+ def bank_account_holder_verifications
18
+ @bank_account_holder_verifications ||= Services::BankAccountHolderVerificationsService.new(@api_service)
19
+ end
20
+
16
21
  # Access to the service for bank_authorisation to make API calls
17
22
  def bank_authorisations
18
23
  @bank_authorisations ||= Services::BankAuthorisationsService.new(@api_service)
@@ -88,6 +93,11 @@ module GoCardlessPro
88
93
  @exports ||= Services::ExportsService.new(@api_service)
89
94
  end
90
95
 
96
+ # Access to the service for funds_availability to make API calls
97
+ def funds_availabilities
98
+ @funds_availabilities ||= Services::FundsAvailabilitiesService.new(@api_service)
99
+ end
100
+
91
101
  # Access to the service for instalment_schedule to make API calls
92
102
  def instalment_schedules
93
103
  @instalment_schedules ||= Services::InstalmentSchedulesService.new(@api_service)
@@ -148,6 +158,16 @@ module GoCardlessPro
148
158
  @payments ||= Services::PaymentsService.new(@api_service)
149
159
  end
150
160
 
161
+ # Access to the service for payment_account to make API calls
162
+ def payment_accounts
163
+ @payment_accounts ||= Services::PaymentAccountsService.new(@api_service)
164
+ end
165
+
166
+ # Access to the service for payment_account_transaction to make API calls
167
+ def payment_account_transactions
168
+ @payment_account_transactions ||= Services::PaymentAccountTransactionsService.new(@api_service)
169
+ end
170
+
151
171
  # Access to the service for payout to make API calls
152
172
  def payouts
153
173
  @payouts ||= Services::PayoutsService.new(@api_service)
@@ -253,8 +273,8 @@ module GoCardlessPro
253
273
  'User-Agent' => "#{user_agent}",
254
274
  'Content-Type' => 'application/json',
255
275
  'GoCardless-Client-Library' => 'gocardless-pro-ruby',
256
- 'GoCardless-Client-Version' => '4.2.0'
257
- }
276
+ 'GoCardless-Client-Version' => '4.3.0',
277
+ },
258
278
  }
259
279
  end
260
280
 
@@ -274,7 +294,7 @@ module GoCardlessPro
274
294
  comment = [
275
295
  "#{ruby_engine}/#{ruby_version}",
276
296
  "#{RUBY_ENGINE}/#{interpreter_version}",
277
- "#{RUBY_PLATFORM}"
297
+ "#{RUBY_PLATFORM}",
278
298
  ]
279
299
  comment << "faraday/#{Faraday::VERSION}"
280
300
  "#{gem_info} #{comment.join(' ')}"
@@ -23,9 +23,9 @@ module GoCardlessPro
23
23
 
24
24
  def to_s
25
25
  if errors.any?
26
- errors
27
- .map { |err| "#{err['field']} #{err['message']}" }
28
- .join(', ')
26
+ errors.
27
+ map { |err| "#{err['field']} #{err['message']}" }.
28
+ join(', ')
29
29
  else
30
30
  @error['message']
31
31
  end
@@ -13,6 +13,13 @@ module GoCardlessPro
13
13
  return unless CLIENT_ERROR_STATUSES.include?(env.status)
14
14
 
15
15
  json_body ||= JSON.parse(env.body) unless env.body.empty?
16
+ if json_body['error'].is_a?(String)
17
+ # Some errors are returned as string rather than objects, wrap in standard format
18
+ json_body['error'] = {
19
+ 'message' => json_body['error'],
20
+ 'status' => env.status,
21
+ }
22
+ end
16
23
  error_type = json_body['error']['type']
17
24
 
18
25
  error_class = error_class_for_status(env.status) || error_class_for_type(error_type)
@@ -24,9 +31,10 @@ module GoCardlessPro
24
31
 
25
32
  def error_class_for_status(code)
26
33
  {
34
+ 400 => GoCardlessPro::InvalidApiUsageError,
27
35
  401 => GoCardlessPro::AuthenticationError,
28
36
  403 => GoCardlessPro::PermissionError,
29
- 429 => GoCardlessPro::RateLimitError
37
+ 429 => GoCardlessPro::RateLimitError,
30
38
  }.fetch(code, nil)
31
39
  end
32
40
 
@@ -35,7 +43,7 @@ module GoCardlessPro
35
43
  validation_failed: GoCardlessPro::ValidationError,
36
44
  gocardless: GoCardlessPro::GoCardlessError,
37
45
  invalid_api_usage: GoCardlessPro::InvalidApiUsageError,
38
- invalid_state: GoCardlessPro::InvalidStateError
46
+ invalid_state: GoCardlessPro::InvalidStateError,
39
47
  }.fetch(type.to_sym)
40
48
  end
41
49
 
@@ -45,7 +53,7 @@ module GoCardlessPro
45
53
  "code: #{env.status}\n" \
46
54
  "headers: #{env.response_headers}\n" \
47
55
  "body: #{env.body}",
48
- 'code' => env.status
56
+ 'code' => env.status,
49
57
  }
50
58
  end
51
59
 
@@ -8,6 +8,7 @@ module GoCardlessPro
8
8
  def initialize(options = {})
9
9
  @service = options.fetch(:service)
10
10
  @options = options.fetch(:options)
11
+ @uri_params = options.reject { |k, _| %i[service options].include?(k) }
11
12
  end
12
13
 
13
14
  # Get a lazy enumerable for listing data from the API
@@ -22,7 +23,7 @@ module GoCardlessPro
22
23
 
23
24
  @options[:params] ||= {}
24
25
  @options[:params] = @options[:params].merge(after: after_cursor)
25
- response = @service.list(@options.merge(after: after_cursor))
26
+ response = @service.list(*@uri_params.values, @options.merge(after: after_cursor))
26
27
  end
27
28
  end.lazy
28
29
  end
@@ -30,7 +31,7 @@ module GoCardlessPro
30
31
  private
31
32
 
32
33
  def get_initial_response
33
- @initial_response ||= @service.list(@options)
34
+ @initial_response ||= @service.list(*@uri_params.values, @options)
34
35
  end
35
36
  end
36
37
  end
@@ -18,7 +18,10 @@ module GoCardlessPro
18
18
  # likely won’t match what’s shown in the dashboard as the dashboard balances
19
19
  # are updated much less frequently (once per day).
20
20
  class Balance
21
- attr_reader :amount, :balance_type, :currency, :last_updated_at
21
+ attr_reader :amount
22
+ attr_reader :balance_type
23
+ attr_reader :currency
24
+ attr_reader :last_updated_at
22
25
 
23
26
  # Initialize a balance resource instance
24
27
  # @param object [Hash] an object returned from the API
@@ -12,7 +12,11 @@ module GoCardlessPro
12
12
 
13
13
  # Retrieve bank account details in JWE encrypted format
14
14
  class BankAccountDetail
15
- attr_reader :ciphertext, :encrypted_key, :iv, :protected, :tag
15
+ attr_reader :ciphertext
16
+ attr_reader :encrypted_key
17
+ attr_reader :iv
18
+ attr_reader :protected
19
+ attr_reader :tag
16
20
 
17
21
  # Initialize a bank_account_detail resource instance
18
22
  # @param object [Hash] an object returned from the API
@@ -0,0 +1,44 @@
1
+ #
2
+ # This client is automatically generated from a template and JSON schema definition.
3
+ # See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
4
+ #
5
+
6
+ require 'uri'
7
+
8
+ module GoCardlessPro
9
+ # A module containing classes for each of the resources in the GC Api
10
+ module Resources
11
+ # Represents an instance of a bank_account_holder_verification resource returned from the API
12
+
13
+ # Create a bank account holder verification for a bank account.
14
+ class BankAccountHolderVerification
15
+ attr_reader :actual_account_name
16
+ attr_reader :id
17
+ attr_reader :result
18
+ attr_reader :status
19
+ attr_reader :type
20
+
21
+ # Initialize a bank_account_holder_verification resource instance
22
+ # @param object [Hash] an object returned from the API
23
+ def initialize(object, response = nil)
24
+ @object = object
25
+
26
+ @actual_account_name = object['actual_account_name']
27
+ @id = object['id']
28
+ @result = object['result']
29
+ @status = object['status']
30
+ @type = object['type']
31
+ @response = response
32
+ end
33
+
34
+ def api_response
35
+ ApiResponse.new(@response)
36
+ end
37
+
38
+ # Provides the bank_account_holder_verification resource as a hash of all its readable attributes
39
+ def to_h
40
+ @object
41
+ end
42
+ end
43
+ end
44
+ end
@@ -21,8 +21,15 @@ module GoCardlessPro
21
21
  # (see Billing Request Flows) to ensure we meet regulatory requirements for
22
22
  # checkout flows.
23
23
  class BankAuthorisation
24
- attr_reader :authorisation_type, :authorised_at, :created_at, :expires_at, :id, :last_visited_at, :qr_code_url,
25
- :redirect_uri, :url
24
+ attr_reader :authorisation_type
25
+ attr_reader :authorised_at
26
+ attr_reader :created_at
27
+ attr_reader :expires_at
28
+ attr_reader :id
29
+ attr_reader :last_visited_at
30
+ attr_reader :qr_code_url
31
+ attr_reader :redirect_uri
32
+ attr_reader :url
26
33
 
27
34
  # Initialize a bank_authorisation resource instance
28
35
  # @param object [Hash] an object returned from the API
@@ -12,7 +12,9 @@ module GoCardlessPro
12
12
 
13
13
  # Look up the name and reachability of a bank account.
14
14
  class BankDetailsLookup
15
- attr_reader :available_debit_schemes, :bank_name, :bic
15
+ attr_reader :available_debit_schemes
16
+ attr_reader :bank_name
17
+ attr_reader :bic
16
18
 
17
19
  # Initialize a bank_details_lookup resource instance
18
20
  # @param object [Hash] an object returned from the API
@@ -22,8 +22,21 @@ module GoCardlessPro
22
22
  # `subscription_request` and `instalment_schedule_request` are only
23
23
  # supported for ACH and PAD schemes.</p>
24
24
  class BillingRequest
25
- attr_reader :actions, :created_at, :fallback_enabled, :fallback_occurred, :id, :instalment_schedule_request,
26
- :mandate_request, :metadata, :payment_request, :purpose_code, :resources, :status, :subscription_request
25
+ attr_reader :actions
26
+ attr_reader :created_at
27
+ attr_reader :fallback_enabled
28
+ attr_reader :fallback_occurred
29
+ attr_reader :id
30
+ attr_reader :instalment_schedule_request
31
+ attr_reader :mandate_request
32
+ attr_reader :metadata
33
+ attr_reader :payment_context_code
34
+ attr_reader :payment_purpose_code
35
+ attr_reader :payment_request
36
+ attr_reader :purpose_code
37
+ attr_reader :resources
38
+ attr_reader :status
39
+ attr_reader :subscription_request
27
40
 
28
41
  # Initialize a billing_request resource instance
29
42
  # @param object [Hash] an object returned from the API
@@ -39,6 +52,8 @@ module GoCardlessPro
39
52
  @links = object['links']
40
53
  @mandate_request = object['mandate_request']
41
54
  @metadata = object['metadata']
55
+ @payment_context_code = object['payment_context_code']
56
+ @payment_purpose_code = object['payment_purpose_code']
42
57
  @payment_request = object['payment_request']
43
58
  @purpose_code = object['purpose_code']
44
59
  @resources = object['resources']
@@ -14,8 +14,24 @@ module GoCardlessPro
14
14
  # payment created for a scheme with strong payer
15
15
  # authorisation (such as open banking single payments).
16
16
  class BillingRequestFlow
17
- attr_reader :authorisation_url, :auto_fulfil, :created_at, :customer_details_captured, :exit_uri, :expires_at,
18
- :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, :skip_success_screen
17
+ attr_reader :authorisation_url
18
+ attr_reader :auto_fulfil
19
+ attr_reader :created_at
20
+ attr_reader :customer_details_captured
21
+ attr_reader :exit_uri
22
+ attr_reader :expires_at
23
+ attr_reader :id
24
+ attr_reader :language
25
+ attr_reader :lock_bank_account
26
+ attr_reader :lock_currency
27
+ attr_reader :lock_customer_details
28
+ attr_reader :prefilled_bank_account
29
+ attr_reader :prefilled_customer
30
+ attr_reader :redirect_uri
31
+ attr_reader :session_token
32
+ attr_reader :show_redirect_buttons
33
+ attr_reader :show_success_redirect_button
34
+ attr_reader :skip_success_screen
19
35
 
20
36
  # Initialize a billing_request_flow resource instance
21
37
  # @param object [Hash] an object returned from the API
@@ -26,8 +26,24 @@ module GoCardlessPro
26
26
  # for single-use and is designed to cater to the unique needs of individual
27
27
  # customers.
28
28
  class BillingRequestTemplate
29
- attr_reader :authorisation_url, :created_at, :id, :mandate_request_constraints, :mandate_request_currency,
30
- :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
29
+ attr_reader :authorisation_url
30
+ attr_reader :created_at
31
+ attr_reader :id
32
+ attr_reader :mandate_request_constraints
33
+ attr_reader :mandate_request_currency
34
+ attr_reader :mandate_request_description
35
+ attr_reader :mandate_request_metadata
36
+ attr_reader :mandate_request_scheme
37
+ attr_reader :mandate_request_verify
38
+ attr_reader :metadata
39
+ attr_reader :name
40
+ attr_reader :payment_request_amount
41
+ attr_reader :payment_request_currency
42
+ attr_reader :payment_request_description
43
+ attr_reader :payment_request_metadata
44
+ attr_reader :payment_request_scheme
45
+ attr_reader :redirect_uri
46
+ attr_reader :updated_at
31
47
 
32
48
  # Initialize a billing_request_template resource instance
33
49
  # @param object [Hash] an object returned from the API
@@ -19,7 +19,8 @@ module GoCardlessPro
19
19
  # Overview](https://developer.gocardless.com/getting-started/billing-requests/overview/)
20
20
  # for how-to's, explanations and tutorials.
21
21
  class BillingRequestWithAction
22
- attr_reader :bank_authorisations, :billing_requests
22
+ attr_reader :bank_authorisations
23
+ attr_reader :billing_requests
23
24
 
24
25
  # Initialize a billing_request_with_action resource instance
25
26
  # @param object [Hash] an object returned from the API
@@ -49,8 +49,14 @@ module GoCardlessPro
49
49
  # would like to use this API.
50
50
  # </p>
51
51
  class Block
52
- attr_reader :active, :block_type, :created_at, :id, :reason_description, :reason_type, :resource_reference,
53
- :updated_at
52
+ attr_reader :active
53
+ attr_reader :block_type
54
+ attr_reader :created_at
55
+ attr_reader :id
56
+ attr_reader :reason_description
57
+ attr_reader :reason_type
58
+ attr_reader :resource_reference
59
+ attr_reader :updated_at
54
60
 
55
61
  # Initialize a block resource instance
56
62
  # @param object [Hash] an object returned from the API
@@ -18,8 +18,26 @@ module GoCardlessPro
18
18
  # Currently, for Anti Money Laundering reasons, any creditors you add must
19
19
  # be directly related to your organisation.
20
20
  class Creditor
21
- attr_reader :address_line1, :address_line2, :address_line3, :bank_reference_prefix, :can_create_refunds, :city,
22
- :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
21
+ attr_reader :address_line1
22
+ attr_reader :address_line2
23
+ attr_reader :address_line3
24
+ attr_reader :bank_reference_prefix
25
+ attr_reader :can_create_refunds
26
+ attr_reader :city
27
+ attr_reader :country_code
28
+ attr_reader :created_at
29
+ attr_reader :creditor_type
30
+ attr_reader :custom_payment_pages_enabled
31
+ attr_reader :fx_payout_currency
32
+ attr_reader :id
33
+ attr_reader :logo_url
34
+ attr_reader :mandate_imports_enabled
35
+ attr_reader :merchant_responsible_for_notifications
36
+ attr_reader :name
37
+ attr_reader :postal_code
38
+ attr_reader :region
39
+ attr_reader :scheme_identifiers
40
+ attr_reader :verification_status
23
41
 
24
42
  # Initialize a creditor resource instance
25
43
  # @param object [Hash] an object returned from the API
@@ -23,8 +23,17 @@ module GoCardlessPro
23
23
  # <p class="restricted-notice"><strong>Restricted</strong>: This API is not
24
24
  # available for partner integrations.</p>
25
25
  class CreditorBankAccount
26
- attr_reader :account_holder_name, :account_number_ending, :account_type, :bank_name, :country_code, :created_at,
27
- :currency, :enabled, :id, :metadata, :verification_status
26
+ attr_reader :account_holder_name
27
+ attr_reader :account_number_ending
28
+ attr_reader :account_type
29
+ attr_reader :bank_name
30
+ attr_reader :country_code
31
+ attr_reader :created_at
32
+ attr_reader :currency
33
+ attr_reader :enabled
34
+ attr_reader :id
35
+ attr_reader :metadata
36
+ attr_reader :verification_status
28
37
 
29
38
  # Initialize a creditor_bank_account resource instance
30
39
  # @param object [Hash] an object returned from the API
@@ -12,7 +12,10 @@ module GoCardlessPro
12
12
 
13
13
  # Currency exchange rates from our foreign exchange provider.
14
14
  class CurrencyExchangeRate
15
- attr_reader :rate, :source, :target, :time
15
+ attr_reader :rate
16
+ attr_reader :source
17
+ attr_reader :target
18
+ attr_reader :time
16
19
 
17
20
  # Initialize a currency_exchange_rate resource instance
18
21
  # @param object [Hash] an object returned from the API
@@ -15,8 +15,24 @@ module GoCardlessPro
15
15
  # accounts](#core-endpoints-customer-bank-accounts), which in turn can have
16
16
  # several Direct Debit [mandates](#core-endpoints-mandates).
17
17
  class Customer
18
- attr_reader :address_line1, :address_line2, :address_line3, :city, :company_name, :country_code, :created_at,
19
- :danish_identity_number, :email, :family_name, :given_name, :id, :language, :metadata, :phone_number, :postal_code, :region, :swedish_identity_number
18
+ attr_reader :address_line1
19
+ attr_reader :address_line2
20
+ attr_reader :address_line3
21
+ attr_reader :city
22
+ attr_reader :company_name
23
+ attr_reader :country_code
24
+ attr_reader :created_at
25
+ attr_reader :danish_identity_number
26
+ attr_reader :email
27
+ attr_reader :family_name
28
+ attr_reader :given_name
29
+ attr_reader :id
30
+ attr_reader :language
31
+ attr_reader :metadata
32
+ attr_reader :phone_number
33
+ attr_reader :postal_code
34
+ attr_reader :region
35
+ attr_reader :swedish_identity_number
20
36
 
21
37
  # Initialize a customer resource instance
22
38
  # @param object [Hash] an object returned from the API
@@ -28,8 +28,17 @@ module GoCardlessPro
28
28
  # [bank_details_lookups](#bank-details-lookups-perform-a-bank-details-lookup),
29
29
  # before proceeding with creating the accounts
30
30
  class CustomerBankAccount
31
- attr_reader :account_holder_name, :account_number_ending, :account_type, :bank_account_token, :bank_name,
32
- :country_code, :created_at, :currency, :enabled, :id, :metadata
31
+ attr_reader :account_holder_name
32
+ attr_reader :account_number_ending
33
+ attr_reader :account_type
34
+ attr_reader :bank_account_token
35
+ attr_reader :bank_name
36
+ attr_reader :country_code
37
+ attr_reader :created_at
38
+ attr_reader :currency
39
+ attr_reader :enabled
40
+ attr_reader :id
41
+ attr_reader :metadata
33
42
 
34
43
  # Initialize a customer_bank_account resource instance
35
44
  # @param object [Hash] an object returned from the API
@@ -25,7 +25,11 @@ module GoCardlessPro
25
25
  # href="mailto:help@gocardless.com">get in touch</a> if you would like to
26
26
  # use this API.</p>
27
27
  class CustomerNotification
28
- attr_reader :action_taken, :action_taken_at, :action_taken_by, :id, :type
28
+ attr_reader :action_taken
29
+ attr_reader :action_taken_at
30
+ attr_reader :action_taken_by
31
+ attr_reader :id
32
+ attr_reader :type
29
33
 
30
34
  # Initialize a customer_notification resource instance
31
35
  # @param object [Hash] an object returned from the API
@@ -15,10 +15,17 @@ module GoCardlessPro
15
15
  # mandate which has been transferred. Event creation is an asynchronous
16
16
  # process, so it can take some time between an action occurring and its
17
17
  # corresponding event getting included in API responses. See
18
- # [here](#event-actions) for a complete list of event types.
18
+ # [here](#event-types) for a complete list of event types.
19
19
  class Event
20
- attr_reader :action, :created_at, :customer_notifications, :details, :id, :metadata, :resource_metadata,
21
- :resource_type
20
+ attr_reader :action
21
+ attr_reader :created_at
22
+ attr_reader :customer_notifications
23
+ attr_reader :details
24
+ attr_reader :id
25
+ attr_reader :metadata
26
+ attr_reader :resource_metadata
27
+ attr_reader :resource_type
28
+ attr_reader :source
22
29
 
23
30
  # Initialize a event resource instance
24
31
  # @param object [Hash] an object returned from the API
@@ -34,6 +41,7 @@ module GoCardlessPro
34
41
  @metadata = object['metadata']
35
42
  @resource_metadata = object['resource_metadata']
36
43
  @resource_type = object['resource_type']
44
+ @source = object['source']
37
45
  @response = response
38
46
  end
39
47
 
@@ -88,6 +96,10 @@ module GoCardlessPro
88
96
  @links['mandate']
89
97
  end
90
98
 
99
+ def mandate_request
100
+ @links['mandate_request']
101
+ end
102
+
91
103
  def mandate_request_mandate
92
104
  @links['mandate_request_mandate']
93
105
  end
@@ -104,6 +116,10 @@ module GoCardlessPro
104
116
  @links['organisation']
105
117
  end
106
118
 
119
+ def outbound_payment
120
+ @links['outbound_payment']
121
+ end
122
+
107
123
  def parent_event
108
124
  @links['parent_event']
109
125
  end
@@ -12,7 +12,11 @@ module GoCardlessPro
12
12
 
13
13
  # File-based exports of data
14
14
  class Export
15
- attr_reader :created_at, :currency, :download_url, :export_type, :id
15
+ attr_reader :created_at
16
+ attr_reader :currency
17
+ attr_reader :download_url
18
+ attr_reader :export_type
19
+ attr_reader :id
16
20
 
17
21
  # Initialize a export resource instance
18
22
  # @param object [Hash] an object returned from the API
@@ -0,0 +1,38 @@
1
+ #
2
+ # This client is automatically generated from a template and JSON schema definition.
3
+ # See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
4
+ #
5
+
6
+ require 'uri'
7
+
8
+ module GoCardlessPro
9
+ # A module containing classes for each of the resources in the GC Api
10
+ module Resources
11
+ # Represents an instance of a funds_availability resource returned from the API
12
+
13
+ # Checks if the payer's current balance is sufficient to cover the amount
14
+ # the merchant wants to charge within the consent parameters defined on the
15
+ # mandate.
16
+ class FundsAvailability
17
+ attr_reader :available
18
+
19
+ # Initialize a funds_availability resource instance
20
+ # @param object [Hash] an object returned from the API
21
+ def initialize(object, response = nil)
22
+ @object = object
23
+
24
+ @available = object['available']
25
+ @response = response
26
+ end
27
+
28
+ def api_response
29
+ ApiResponse.new(@response)
30
+ end
31
+
32
+ # Provides the funds_availability resource as a hash of all its readable attributes
33
+ def to_h
34
+ @object
35
+ end
36
+ end
37
+ end
38
+ end
@@ -28,7 +28,14 @@ module GoCardlessPro
28
28
  # of collection.
29
29
  #
30
30
  class InstalmentSchedule
31
- attr_reader :created_at, :currency, :id, :metadata, :name, :payment_errors, :status, :total_amount
31
+ attr_reader :created_at
32
+ attr_reader :currency
33
+ attr_reader :id
34
+ attr_reader :metadata
35
+ attr_reader :name
36
+ attr_reader :payment_errors
37
+ attr_reader :status
38
+ attr_reader :total_amount
32
39
 
33
40
  # Initialize a instalment_schedule resource instance
34
41
  # @param object [Hash] an object returned from the API
@@ -17,7 +17,14 @@ module GoCardlessPro
17
17
  # Not all institutions support both Payment Initiation (PIS) and Account
18
18
  # Information (AIS) services.
19
19
  class Institution
20
- attr_reader :autocompletes_collect_bank_account, :country_code, :icon_url, :id, :limits, :logo_url, :name, :status
20
+ attr_reader :autocompletes_collect_bank_account
21
+ attr_reader :country_code
22
+ attr_reader :icon_url
23
+ attr_reader :id
24
+ attr_reader :limits
25
+ attr_reader :logo_url
26
+ attr_reader :name
27
+ attr_reader :status
21
28
 
22
29
  # Initialize a institution resource instance
23
30
  # @param object [Hash] an object returned from the API