gocardless_pro 2.24.0 → 2.29.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (82) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +23 -4
  3. data/lib/gocardless_pro/api_service.rb +4 -0
  4. data/lib/gocardless_pro/client.rb +46 -1
  5. data/lib/gocardless_pro/error/authentication_error.rb +4 -0
  6. data/lib/gocardless_pro/error/permission_error.rb +4 -0
  7. data/lib/gocardless_pro/error/rate_limit_error.rb +4 -0
  8. data/lib/gocardless_pro/middlewares/raise_gocardless_errors.rb +12 -1
  9. data/lib/gocardless_pro/resources/bank_authorisation.rb +81 -0
  10. data/lib/gocardless_pro/resources/billing_request.rb +108 -0
  11. data/lib/gocardless_pro/resources/billing_request_flow.rb +72 -0
  12. data/lib/gocardless_pro/resources/billing_request_template.rb +68 -0
  13. data/lib/gocardless_pro/resources/block.rb +66 -0
  14. data/lib/gocardless_pro/resources/creditor.rb +2 -3
  15. data/lib/gocardless_pro/resources/event.rb +20 -0
  16. data/lib/gocardless_pro/resources/institution.rb +47 -0
  17. data/lib/gocardless_pro/resources/payer_authorisation.rb +131 -0
  18. data/lib/gocardless_pro/resources/payout_item.rb +4 -0
  19. data/lib/gocardless_pro/resources/redirect_flow.rb +2 -0
  20. data/lib/gocardless_pro/resources/scenario_simulator.rb +42 -0
  21. data/lib/gocardless_pro/resources/webhook.rb +62 -0
  22. data/lib/gocardless_pro/services/bank_authorisations_service.rb +80 -0
  23. data/lib/gocardless_pro/services/billing_request_flows_service.rb +70 -0
  24. data/lib/gocardless_pro/services/billing_request_templates_service.rb +131 -0
  25. data/lib/gocardless_pro/services/billing_requests_service.rb +352 -0
  26. data/lib/gocardless_pro/services/blocks_service.rb +223 -0
  27. data/lib/gocardless_pro/services/creditor_bank_accounts_service.rb +1 -5
  28. data/lib/gocardless_pro/services/creditors_service.rb +1 -3
  29. data/lib/gocardless_pro/services/currency_exchange_rates_service.rb +1 -1
  30. data/lib/gocardless_pro/services/customer_bank_accounts_service.rb +1 -5
  31. data/lib/gocardless_pro/services/customers_service.rb +1 -3
  32. data/lib/gocardless_pro/services/events_service.rb +1 -1
  33. data/lib/gocardless_pro/services/instalment_schedules_service.rb +1 -7
  34. data/lib/gocardless_pro/services/institutions_service.rb +56 -0
  35. data/lib/gocardless_pro/services/mandate_import_entries_service.rb +1 -1
  36. data/lib/gocardless_pro/services/mandate_imports_service.rb +0 -6
  37. data/lib/gocardless_pro/services/mandates_service.rb +1 -7
  38. data/lib/gocardless_pro/services/payer_authorisations_service.rb +202 -0
  39. data/lib/gocardless_pro/services/payments_service.rb +1 -7
  40. data/lib/gocardless_pro/services/payout_items_service.rb +1 -1
  41. data/lib/gocardless_pro/services/payouts_service.rb +1 -1
  42. data/lib/gocardless_pro/services/redirect_flows_service.rb +0 -4
  43. data/lib/gocardless_pro/services/refunds_service.rb +1 -3
  44. data/lib/gocardless_pro/services/scenario_simulators_service.rb +170 -0
  45. data/lib/gocardless_pro/services/subscriptions_service.rb +10 -13
  46. data/lib/gocardless_pro/services/tax_rates_service.rb +1 -1
  47. data/lib/gocardless_pro/services/webhooks_service.rb +111 -0
  48. data/lib/gocardless_pro/version.rb +1 -1
  49. data/lib/gocardless_pro.rb +30 -0
  50. data/spec/api_service_spec.rb +12 -1
  51. data/spec/middlewares/raise_gocardless_errors_spec.rb +30 -0
  52. data/spec/resources/bank_authorisation_spec.rb +259 -0
  53. data/spec/resources/billing_request_flow_spec.rb +219 -0
  54. data/spec/resources/billing_request_spec.rb +782 -0
  55. data/spec/resources/billing_request_template_spec.rb +502 -0
  56. data/spec/resources/block_spec.rb +560 -0
  57. data/spec/resources/institution_spec.rb +108 -0
  58. data/spec/resources/payer_authorisation_spec.rb +418 -0
  59. data/spec/resources/redirect_flow_spec.rb +9 -0
  60. data/spec/resources/scenario_simulator_spec.rb +63 -0
  61. data/spec/resources/webhook_spec.rb +323 -0
  62. data/spec/services/bank_authorisations_service_spec.rb +353 -0
  63. data/spec/services/billing_request_flows_service_spec.rb +253 -0
  64. data/spec/services/billing_request_templates_service_spec.rb +789 -0
  65. data/spec/services/billing_requests_service_spec.rb +1082 -0
  66. data/spec/services/blocks_service_spec.rb +823 -0
  67. data/spec/services/creditor_bank_accounts_service_spec.rb +0 -13
  68. data/spec/services/creditors_service_spec.rb +0 -13
  69. data/spec/services/customer_bank_accounts_service_spec.rb +0 -13
  70. data/spec/services/customers_service_spec.rb +0 -13
  71. data/spec/services/instalment_schedules_service_spec.rb +0 -26
  72. data/spec/services/institutions_service_spec.rb +232 -0
  73. data/spec/services/mandate_imports_service_spec.rb +0 -13
  74. data/spec/services/mandates_service_spec.rb +0 -13
  75. data/spec/services/payer_authorisations_service_spec.rb +559 -0
  76. data/spec/services/payments_service_spec.rb +0 -13
  77. data/spec/services/redirect_flows_service_spec.rb +9 -13
  78. data/spec/services/refunds_service_spec.rb +0 -13
  79. data/spec/services/scenario_simulators_service_spec.rb +74 -0
  80. data/spec/services/subscriptions_service_spec.rb +0 -13
  81. data/spec/services/webhooks_service_spec.rb +545 -0
  82. metadata +64 -7
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: bac8c2899f9fd824c6dd5f94bcfa506694dc9f97839cb86a1b64149ccfc92e48
4
- data.tar.gz: f12c865ed4d9eaa0def7d20fea5e2b15e2c225898de92bee5758d9a6757e476c
3
+ metadata.gz: ae7ce2e7f276bbb9d36b64093e6be341e1f76325a7ced35710e8276360c2df22
4
+ data.tar.gz: 554e6c6c947c94c76d250fafabdc3867b65ca218269ce70395fe5a0079fdb5e5
5
5
  SHA512:
6
- metadata.gz: f3c76aad9bbaace084b8449366edc8b1f8b33f0b705e22050137bc3d2c31b43228addbea11943b337e8ac6c0a7da52117979dea6ee8e1e425dbca026d159e467
7
- data.tar.gz: '097fd8d09e04a316d2e37010eb78d36b8278e7ec8e9cbed867c772ccf3b522957d1fae644c4357a2b560917a16e90b6284841679c79e8525f8f3324795715139'
6
+ metadata.gz: fb5865c593f89c21fe7b1d9ea930c2683286753f9635dcb0e70350ac4fd5af02345a6c472c8b9940484242f6f39cfd05fcdbca0c5a96c3e7cad66f2bf5cf42e6
7
+ data.tar.gz: 55605f88d457f5a0e8bb3445b9a796dbe1332a94eb3c1ab86318c4bce49d4ab88fcaf6a27ed67c01e4195f6b73eb40ede88d86f3f5998b09b348eb5e5a7a26d0
data/.circleci/config.yml CHANGED
@@ -13,7 +13,19 @@ jobs:
13
13
  steps:
14
14
  - checkout
15
15
  - run: bundle install && bundle exec rspec
16
-
16
+ publish: &publish
17
+ docker:
18
+ - image: ruby:2.6
19
+ steps:
20
+ - checkout
21
+ - run: |
22
+ mkdir -p $HOME/.gem
23
+ touch $HOME/.gem/credentials
24
+ chmod 0600 $HOME/.gem/credentials
25
+ printf -- "---\n:rubygems_api_key: $RUBYGEM_PUBLISH_API_KEY\n" > $HOME/.gem/credentials
26
+ gem build *.gemspec
27
+ gem push *.gem
28
+
17
29
  workflows:
18
30
  version: 2
19
31
  tests:
@@ -22,11 +34,18 @@ workflows:
22
34
  matrix:
23
35
  parameters:
24
36
  faraday-version: ["0.9.2", "1.0"]
25
- ruby-version: ["2.0", "2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7"]
37
+ ruby-version: ["2.1", "2.2", "2.3", "2.4", "2.5", "2.6", "2.7", "3.0"]
26
38
  exclude:
27
- - faraday-version: "1.0"
28
- ruby-version: "2.0"
29
39
  - faraday-version: "1.0"
30
40
  ruby-version: "2.1"
31
41
  - faraday-version: "1.0"
32
42
  ruby-version: "2.2"
43
+ - faraday-version: "0.9.2"
44
+ ruby-version: "3.0"
45
+ - publish:
46
+ filters:
47
+ branches:
48
+ only:
49
+ - master
50
+ requires:
51
+ - test
@@ -34,6 +34,10 @@ module GoCardlessPro
34
34
  @headers = options[:default_headers] || {}
35
35
  @headers['Authorization'] = "Bearer #{token}"
36
36
  @on_idempotency_conflict = options[:on_idempotency_conflict] || :fetch
37
+
38
+ unless %i[fetch raise].include?(@on_idempotency_conflict)
39
+ raise ArgumentError, 'Unknown mode for :on_idempotency_conflict'
40
+ end
37
41
  end
38
42
 
39
43
  # Make a request to the API
@@ -3,11 +3,36 @@ module GoCardlessPro
3
3
  class Client
4
4
  extend Forwardable
5
5
 
6
+ # Access to the service for bank_authorisation to make API calls
7
+ def bank_authorisations
8
+ @bank_authorisations ||= Services::BankAuthorisationsService.new(@api_service)
9
+ end
10
+
6
11
  # Access to the service for bank_details_lookup to make API calls
7
12
  def bank_details_lookups
8
13
  @bank_details_lookups ||= Services::BankDetailsLookupsService.new(@api_service)
9
14
  end
10
15
 
16
+ # Access to the service for billing_request to make API calls
17
+ def billing_requests
18
+ @billing_requests ||= Services::BillingRequestsService.new(@api_service)
19
+ end
20
+
21
+ # Access to the service for billing_request_flow to make API calls
22
+ def billing_request_flows
23
+ @billing_request_flows ||= Services::BillingRequestFlowsService.new(@api_service)
24
+ end
25
+
26
+ # Access to the service for billing_request_template to make API calls
27
+ def billing_request_templates
28
+ @billing_request_templates ||= Services::BillingRequestTemplatesService.new(@api_service)
29
+ end
30
+
31
+ # Access to the service for block to make API calls
32
+ def blocks
33
+ @blocks ||= Services::BlocksService.new(@api_service)
34
+ end
35
+
11
36
  # Access to the service for creditor to make API calls
12
37
  def creditors
13
38
  @creditors ||= Services::CreditorsService.new(@api_service)
@@ -48,6 +73,11 @@ module GoCardlessPro
48
73
  @instalment_schedules ||= Services::InstalmentSchedulesService.new(@api_service)
49
74
  end
50
75
 
76
+ # Access to the service for institution to make API calls
77
+ def institutions
78
+ @institutions ||= Services::InstitutionsService.new(@api_service)
79
+ end
80
+
51
81
  # Access to the service for mandate to make API calls
52
82
  def mandates
53
83
  @mandates ||= Services::MandatesService.new(@api_service)
@@ -68,6 +98,11 @@ module GoCardlessPro
68
98
  @mandate_pdfs ||= Services::MandatePdfsService.new(@api_service)
69
99
  end
70
100
 
101
+ # Access to the service for payer_authorisation to make API calls
102
+ def payer_authorisations
103
+ @payer_authorisations ||= Services::PayerAuthorisationsService.new(@api_service)
104
+ end
105
+
71
106
  # Access to the service for payment to make API calls
72
107
  def payments
73
108
  @payments ||= Services::PaymentsService.new(@api_service)
@@ -93,6 +128,11 @@ module GoCardlessPro
93
128
  @refunds ||= Services::RefundsService.new(@api_service)
94
129
  end
95
130
 
131
+ # Access to the service for scenario_simulator to make API calls
132
+ def scenario_simulators
133
+ @scenario_simulators ||= Services::ScenarioSimulatorsService.new(@api_service)
134
+ end
135
+
96
136
  # Access to the service for subscription to make API calls
97
137
  def subscriptions
98
138
  @subscriptions ||= Services::SubscriptionsService.new(@api_service)
@@ -103,6 +143,11 @@ module GoCardlessPro
103
143
  @tax_rates ||= Services::TaxRatesService.new(@api_service)
104
144
  end
105
145
 
146
+ # Access to the service for webhook to make API calls
147
+ def webhooks
148
+ @webhooks ||= Services::WebhooksService.new(@api_service)
149
+ end
150
+
106
151
  # Get a Client configured to use HTTP Basic authentication with the GC Api
107
152
  #
108
153
  # @param options [Hash<Symbol,String>] configuration for creating the client
@@ -153,7 +198,7 @@ module GoCardlessPro
153
198
  'User-Agent' => user_agent.to_s,
154
199
  'Content-Type' => 'application/json',
155
200
  'GoCardless-Client-Library' => 'gocardless-pro-ruby',
156
- 'GoCardless-Client-Version' => '2.24.0',
201
+ 'GoCardless-Client-Version' => '2.29.0',
157
202
  },
158
203
  }
159
204
  end
@@ -0,0 +1,4 @@
1
+ module GoCardlessPro
2
+ class AuthenticationError < InvalidApiUsageError
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module GoCardlessPro
2
+ class PermissionError < InvalidApiUsageError
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module GoCardlessPro
2
+ class RateLimitError < InvalidApiUsageError
3
+ end
4
+ end
@@ -12,12 +12,23 @@ module GoCardlessPro
12
12
  if CLIENT_ERROR_STATUSES.include?(env.status)
13
13
  json_body ||= JSON.parse(env.body) unless env.body.empty?
14
14
  error_type = json_body['error']['type']
15
- raise(error_class_for_type(error_type), json_body['error'])
15
+
16
+ error_class = error_class_for_status(env.status) || error_class_for_type(error_type)
17
+
18
+ raise(error_class, json_body['error'])
16
19
  end
17
20
  end
18
21
 
19
22
  private
20
23
 
24
+ def error_class_for_status(code)
25
+ {
26
+ 401 => GoCardlessPro::AuthenticationError,
27
+ 403 => GoCardlessPro::PermissionError,
28
+ 429 => GoCardlessPro::RateLimitError,
29
+ }.fetch(code, nil)
30
+ end
31
+
21
32
  def error_class_for_type(type)
22
33
  {
23
34
  validation_failed: GoCardlessPro::ValidationError,
@@ -0,0 +1,81 @@
1
+ # encoding: utf-8
2
+
3
+ #
4
+ # This client is automatically generated from a template and JSON schema definition.
5
+ # See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
6
+ #
7
+
8
+ require 'uri'
9
+
10
+ module GoCardlessPro
11
+ # A module containing classes for each of the resources in the GC Api
12
+ module Resources
13
+ # Represents an instance of a bank_authorisation resource returned from the API
14
+
15
+ # Bank Authorisations can be used to authorise Billing Requests.
16
+ # Authorisations
17
+ # are created against a specific bank, usually the bank that provides the
18
+ # payer's
19
+ # account.
20
+ #
21
+ # Creation of Bank Authorisations is only permitted from GoCardless hosted
22
+ # UIs
23
+ # (see Billing Request Flows) to ensure we meet regulatory requirements for
24
+ # checkout flows.
25
+ class BankAuthorisation
26
+ attr_reader :authorisation_type
27
+ attr_reader :authorised_at
28
+ attr_reader :created_at
29
+ attr_reader :expires_at
30
+ attr_reader :id
31
+ attr_reader :last_visited_at
32
+ attr_reader :redirect_uri
33
+ attr_reader :url
34
+
35
+ # Initialize a bank_authorisation resource instance
36
+ # @param object [Hash] an object returned from the API
37
+ def initialize(object, response = nil)
38
+ @object = object
39
+
40
+ @authorisation_type = object['authorisation_type']
41
+ @authorised_at = object['authorised_at']
42
+ @created_at = object['created_at']
43
+ @expires_at = object['expires_at']
44
+ @id = object['id']
45
+ @last_visited_at = object['last_visited_at']
46
+ @links = object['links']
47
+ @redirect_uri = object['redirect_uri']
48
+ @url = object['url']
49
+ @response = response
50
+ end
51
+
52
+ def api_response
53
+ ApiResponse.new(@response)
54
+ end
55
+
56
+ # Return the links that the resource has
57
+ def links
58
+ @bank_authorisation_links ||= Links.new(@links)
59
+ end
60
+
61
+ # Provides the bank_authorisation resource as a hash of all its readable attributes
62
+ def to_h
63
+ @object
64
+ end
65
+
66
+ class Links
67
+ def initialize(links)
68
+ @links = links || {}
69
+ end
70
+
71
+ def billing_request
72
+ @links['billing_request']
73
+ end
74
+
75
+ def institution
76
+ @links['institution']
77
+ end
78
+ end
79
+ end
80
+ end
81
+ end
@@ -0,0 +1,108 @@
1
+ # encoding: utf-8
2
+
3
+ #
4
+ # This client is automatically generated from a template and JSON schema definition.
5
+ # See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
6
+ #
7
+
8
+ require 'uri'
9
+
10
+ module GoCardlessPro
11
+ # A module containing classes for each of the resources in the GC Api
12
+ module Resources
13
+ # Represents an instance of a billing_request resource returned from the API
14
+
15
+ # Billing Requests help create resources that require input or action from a
16
+ # customer. An example of required input might be additional customer
17
+ # billing
18
+ # details, while an action would be asking a customer to authorise a payment
19
+ # using their mobile banking app.
20
+ #
21
+ # See [Billing Requests:
22
+ # Overview](https://developer.gocardless.com/getting-started/billing-requests/overview/)
23
+ # for how-to's, explanations and tutorials.
24
+ class BillingRequest
25
+ attr_reader :actions
26
+ attr_reader :created_at
27
+ attr_reader :id
28
+ attr_reader :mandate_request
29
+ attr_reader :metadata
30
+ attr_reader :payment_request
31
+ attr_reader :resources
32
+ attr_reader :status
33
+
34
+ # Initialize a billing_request resource instance
35
+ # @param object [Hash] an object returned from the API
36
+ def initialize(object, response = nil)
37
+ @object = object
38
+
39
+ @actions = object['actions']
40
+ @created_at = object['created_at']
41
+ @id = object['id']
42
+ @links = object['links']
43
+ @mandate_request = object['mandate_request']
44
+ @metadata = object['metadata']
45
+ @payment_request = object['payment_request']
46
+ @resources = object['resources']
47
+ @status = object['status']
48
+ @response = response
49
+ end
50
+
51
+ def api_response
52
+ ApiResponse.new(@response)
53
+ end
54
+
55
+ # Return the links that the resource has
56
+ def links
57
+ @billing_request_links ||= Links.new(@links)
58
+ end
59
+
60
+ # Provides the billing_request resource as a hash of all its readable attributes
61
+ def to_h
62
+ @object
63
+ end
64
+
65
+ class Links
66
+ def initialize(links)
67
+ @links = links || {}
68
+ end
69
+
70
+ def bank_authorisation
71
+ @links['bank_authorisation']
72
+ end
73
+
74
+ def creditor
75
+ @links['creditor']
76
+ end
77
+
78
+ def customer
79
+ @links['customer']
80
+ end
81
+
82
+ def customer_bank_account
83
+ @links['customer_bank_account']
84
+ end
85
+
86
+ def customer_billing_detail
87
+ @links['customer_billing_detail']
88
+ end
89
+
90
+ def mandate_request
91
+ @links['mandate_request']
92
+ end
93
+
94
+ def mandate_request_mandate
95
+ @links['mandate_request_mandate']
96
+ end
97
+
98
+ def payment_request
99
+ @links['payment_request']
100
+ end
101
+
102
+ def payment_request_payment
103
+ @links['payment_request_payment']
104
+ end
105
+ end
106
+ end
107
+ end
108
+ end
@@ -0,0 +1,72 @@
1
+ # encoding: utf-8
2
+
3
+ #
4
+ # This client is automatically generated from a template and JSON schema definition.
5
+ # See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
6
+ #
7
+
8
+ require 'uri'
9
+
10
+ module GoCardlessPro
11
+ # A module containing classes for each of the resources in the GC Api
12
+ module Resources
13
+ # Represents an instance of a billing_request_flow resource returned from the API
14
+
15
+ # Billing Request Flows can be created to enable a payer to authorise a
16
+ # payment created for a scheme with strong payer
17
+ # authorisation (such as open banking single payments).
18
+ class BillingRequestFlow
19
+ attr_reader :authorisation_url
20
+ attr_reader :auto_fulfil
21
+ attr_reader :created_at
22
+ attr_reader :expires_at
23
+ attr_reader :id
24
+ attr_reader :lock_bank_account
25
+ attr_reader :lock_customer_details
26
+ attr_reader :redirect_uri
27
+ attr_reader :session_token
28
+
29
+ # Initialize a billing_request_flow resource instance
30
+ # @param object [Hash] an object returned from the API
31
+ def initialize(object, response = nil)
32
+ @object = object
33
+
34
+ @authorisation_url = object['authorisation_url']
35
+ @auto_fulfil = object['auto_fulfil']
36
+ @created_at = object['created_at']
37
+ @expires_at = object['expires_at']
38
+ @id = object['id']
39
+ @links = object['links']
40
+ @lock_bank_account = object['lock_bank_account']
41
+ @lock_customer_details = object['lock_customer_details']
42
+ @redirect_uri = object['redirect_uri']
43
+ @session_token = object['session_token']
44
+ @response = response
45
+ end
46
+
47
+ def api_response
48
+ ApiResponse.new(@response)
49
+ end
50
+
51
+ # Return the links that the resource has
52
+ def links
53
+ @billing_request_flow_links ||= Links.new(@links)
54
+ end
55
+
56
+ # Provides the billing_request_flow resource as a hash of all its readable attributes
57
+ def to_h
58
+ @object
59
+ end
60
+
61
+ class Links
62
+ def initialize(links)
63
+ @links = links || {}
64
+ end
65
+
66
+ def billing_request
67
+ @links['billing_request']
68
+ end
69
+ end
70
+ end
71
+ end
72
+ end
@@ -0,0 +1,68 @@
1
+ # encoding: utf-8
2
+
3
+ #
4
+ # This client is automatically generated from a template and JSON schema definition.
5
+ # See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
6
+ #
7
+
8
+ require 'uri'
9
+
10
+ module GoCardlessPro
11
+ # A module containing classes for each of the resources in the GC Api
12
+ module Resources
13
+ # Represents an instance of a billing_request_template resource returned from the API
14
+
15
+ # Billing Request Templates
16
+ class BillingRequestTemplate
17
+ attr_reader :authorisation_url
18
+ attr_reader :created_at
19
+ attr_reader :id
20
+ attr_reader :mandate_request_currency
21
+ attr_reader :mandate_request_metadata
22
+ attr_reader :mandate_request_scheme
23
+ attr_reader :mandate_request_verify
24
+ attr_reader :metadata
25
+ attr_reader :name
26
+ attr_reader :payment_request_amount
27
+ attr_reader :payment_request_currency
28
+ attr_reader :payment_request_description
29
+ attr_reader :payment_request_metadata
30
+ attr_reader :payment_request_scheme
31
+ attr_reader :redirect_uri
32
+ attr_reader :updated_at
33
+
34
+ # Initialize a billing_request_template resource instance
35
+ # @param object [Hash] an object returned from the API
36
+ def initialize(object, response = nil)
37
+ @object = object
38
+
39
+ @authorisation_url = object['authorisation_url']
40
+ @created_at = object['created_at']
41
+ @id = object['id']
42
+ @mandate_request_currency = object['mandate_request_currency']
43
+ @mandate_request_metadata = object['mandate_request_metadata']
44
+ @mandate_request_scheme = object['mandate_request_scheme']
45
+ @mandate_request_verify = object['mandate_request_verify']
46
+ @metadata = object['metadata']
47
+ @name = object['name']
48
+ @payment_request_amount = object['payment_request_amount']
49
+ @payment_request_currency = object['payment_request_currency']
50
+ @payment_request_description = object['payment_request_description']
51
+ @payment_request_metadata = object['payment_request_metadata']
52
+ @payment_request_scheme = object['payment_request_scheme']
53
+ @redirect_uri = object['redirect_uri']
54
+ @updated_at = object['updated_at']
55
+ @response = response
56
+ end
57
+
58
+ def api_response
59
+ ApiResponse.new(@response)
60
+ end
61
+
62
+ # Provides the billing_request_template resource as a hash of all its readable attributes
63
+ def to_h
64
+ @object
65
+ end
66
+ end
67
+ end
68
+ end
@@ -0,0 +1,66 @@
1
+ # encoding: utf-8
2
+
3
+ #
4
+ # This client is automatically generated from a template and JSON schema definition.
5
+ # See https://github.com/gocardless/gocardless-pro-ruby#contributing before editing.
6
+ #
7
+
8
+ require 'uri'
9
+
10
+ module GoCardlessPro
11
+ # A module containing classes for each of the resources in the GC Api
12
+ module Resources
13
+ # Represents an instance of a block resource returned from the API
14
+
15
+ # A block object is a simple rule, when matched, pushes a newly created
16
+ # mandate to a blocked state. These details can be an exact match, like a
17
+ # bank account
18
+ # or an email, or a more generic match such as an email domain. New block
19
+ # types may be added
20
+ # over time. Payments and subscriptions can't be created against mandates in
21
+ # blocked state.
22
+ #
23
+ # <p class="notice">
24
+ # Client libraries have not yet been updated for this API but will be
25
+ # released soon.
26
+ # This API is currently only available for approved integrators - please
27
+ # <a href="mailto:help@gocardless.com">get in touch</a> if you would like to
28
+ # use this API.
29
+ # </p>
30
+ class Block
31
+ attr_reader :active
32
+ attr_reader :block_type
33
+ attr_reader :created_at
34
+ attr_reader :id
35
+ attr_reader :reason_description
36
+ attr_reader :reason_type
37
+ attr_reader :resource_reference
38
+ attr_reader :updated_at
39
+
40
+ # Initialize a block resource instance
41
+ # @param object [Hash] an object returned from the API
42
+ def initialize(object, response = nil)
43
+ @object = object
44
+
45
+ @active = object['active']
46
+ @block_type = object['block_type']
47
+ @created_at = object['created_at']
48
+ @id = object['id']
49
+ @reason_description = object['reason_description']
50
+ @reason_type = object['reason_type']
51
+ @resource_reference = object['resource_reference']
52
+ @updated_at = object['updated_at']
53
+ @response = response
54
+ end
55
+
56
+ def api_response
57
+ ApiResponse.new(@response)
58
+ end
59
+
60
+ # Provides the block resource as a hash of all its readable attributes
61
+ def to_h
62
+ @object
63
+ end
64
+ end
65
+ end
66
+ end
@@ -17,9 +17,8 @@ module GoCardlessPro
17
17
  # organisation will have a single "creditor", but the API also supports
18
18
  # collecting payments on behalf of others.
19
19
  #
20
- # Please get in touch if you wish to use this endpoint. Currently, for Anti
21
- # Money Laundering reasons, any creditors you add must be directly related
22
- # to your organisation.
20
+ # Currently, for Anti Money Laundering reasons, any creditors you add must
21
+ # be directly related to your organisation.
23
22
  class Creditor
24
23
  attr_reader :address_line1
25
24
  attr_reader :address_line2
@@ -60,6 +60,18 @@ module GoCardlessPro
60
60
  @links = links || {}
61
61
  end
62
62
 
63
+ def bank_authorisation
64
+ @links['bank_authorisation']
65
+ end
66
+
67
+ def billing_request
68
+ @links['billing_request']
69
+ end
70
+
71
+ def billing_request_flow
72
+ @links['billing_request_flow']
73
+ end
74
+
63
75
  def creditor
64
76
  @links['creditor']
65
77
  end
@@ -80,6 +92,10 @@ module GoCardlessPro
80
92
  @links['mandate']
81
93
  end
82
94
 
95
+ def mandate_request_mandate
96
+ @links['mandate_request_mandate']
97
+ end
98
+
83
99
  def new_customer_bank_account
84
100
  @links['new_customer_bank_account']
85
101
  end
@@ -104,6 +120,10 @@ module GoCardlessPro
104
120
  @links['payment']
105
121
  end
106
122
 
123
+ def payment_request_payment
124
+ @links['payment_request_payment']
125
+ end
126
+
107
127
  def payout
108
128
  @links['payout']
109
129
  end