gocardless-pro 0.1.1 → 0.2.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.
- checksums.yaml +4 -4
- data/README.md +2 -4
- data/lib/gocardless-pro.rb +1 -169
- data/lib/gocardless-pro/api_service.rb +2 -2
- data/lib/gocardless-pro/client.rb +135 -0
- data/lib/gocardless-pro/version.rb +1 -1
- data/spec/api_service_spec.rb +3 -2
- data/spec/client_spec.rb +4 -14
- data/spec/services/creditor_bank_account_service_spec.rb +1 -2
- data/spec/services/creditor_service_spec.rb +1 -2
- data/spec/services/customer_bank_account_service_spec.rb +1 -2
- data/spec/services/customer_service_spec.rb +1 -2
- data/spec/services/event_service_spec.rb +1 -2
- data/spec/services/helper_service_spec.rb +1 -2
- data/spec/services/mandate_service_spec.rb +1 -2
- data/spec/services/payment_service_spec.rb +1 -2
- data/spec/services/payout_service_spec.rb +1 -2
- data/spec/services/redirect_flow_service_spec.rb +1 -2
- data/spec/services/refund_service_spec.rb +1 -2
- data/spec/services/subscription_service_spec.rb +1 -2
- metadata +2 -25
- data/lib/gocardless-pro/resources/api_key.rb +0 -62
- data/lib/gocardless-pro/resources/publishable_api_key.rb +0 -51
- data/lib/gocardless-pro/resources/role.rb +0 -101
- data/lib/gocardless-pro/resources/user.rb +0 -60
- data/lib/gocardless-pro/services/api_key_service.rb +0 -130
- data/lib/gocardless-pro/services/publishable_api_key_service.rb +0 -130
- data/lib/gocardless-pro/services/role_service.rb +0 -127
- data/lib/gocardless-pro/services/user_service.rb +0 -148
- data/spec/resources/api_key_spec.rb +0 -85
- data/spec/resources/publishable_api_key_spec.rb +0 -63
- data/spec/resources/role_spec.rb +0 -63
- data/spec/resources/user_spec.rb +0 -85
- data/spec/services/api_key_service_spec.rb +0 -362
- data/spec/services/publishable_api_key_service_spec.rb +0 -336
- data/spec/services/role_service_spec.rb +0 -336
- data/spec/services/user_service_spec.rb +0 -433
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: gocardless-pro
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GoCardless
|
@@ -96,6 +96,7 @@ files:
|
|
96
96
|
- gocardless-pro.gemspec
|
97
97
|
- lib/gocardless-pro.rb
|
98
98
|
- lib/gocardless-pro/api_service.rb
|
99
|
+
- lib/gocardless-pro/client.rb
|
99
100
|
- lib/gocardless-pro/error.rb
|
100
101
|
- lib/gocardless-pro/error/gocardless_error.rb
|
101
102
|
- lib/gocardless-pro/error/invalid_api_usage_error.rb
|
@@ -104,7 +105,6 @@ files:
|
|
104
105
|
- lib/gocardless-pro/list_response.rb
|
105
106
|
- lib/gocardless-pro/paginator.rb
|
106
107
|
- lib/gocardless-pro/request.rb
|
107
|
-
- lib/gocardless-pro/resources/api_key.rb
|
108
108
|
- lib/gocardless-pro/resources/creditor.rb
|
109
109
|
- lib/gocardless-pro/resources/creditor_bank_account.rb
|
110
110
|
- lib/gocardless-pro/resources/customer.rb
|
@@ -114,14 +114,10 @@ files:
|
|
114
114
|
- lib/gocardless-pro/resources/mandate.rb
|
115
115
|
- lib/gocardless-pro/resources/payment.rb
|
116
116
|
- lib/gocardless-pro/resources/payout.rb
|
117
|
-
- lib/gocardless-pro/resources/publishable_api_key.rb
|
118
117
|
- lib/gocardless-pro/resources/redirect_flow.rb
|
119
118
|
- lib/gocardless-pro/resources/refund.rb
|
120
|
-
- lib/gocardless-pro/resources/role.rb
|
121
119
|
- lib/gocardless-pro/resources/subscription.rb
|
122
|
-
- lib/gocardless-pro/resources/user.rb
|
123
120
|
- lib/gocardless-pro/response.rb
|
124
|
-
- lib/gocardless-pro/services/api_key_service.rb
|
125
121
|
- lib/gocardless-pro/services/base_service.rb
|
126
122
|
- lib/gocardless-pro/services/creditor_bank_account_service.rb
|
127
123
|
- lib/gocardless-pro/services/creditor_service.rb
|
@@ -132,17 +128,13 @@ files:
|
|
132
128
|
- lib/gocardless-pro/services/mandate_service.rb
|
133
129
|
- lib/gocardless-pro/services/payment_service.rb
|
134
130
|
- lib/gocardless-pro/services/payout_service.rb
|
135
|
-
- lib/gocardless-pro/services/publishable_api_key_service.rb
|
136
131
|
- lib/gocardless-pro/services/redirect_flow_service.rb
|
137
132
|
- lib/gocardless-pro/services/refund_service.rb
|
138
|
-
- lib/gocardless-pro/services/role_service.rb
|
139
133
|
- lib/gocardless-pro/services/subscription_service.rb
|
140
|
-
- lib/gocardless-pro/services/user_service.rb
|
141
134
|
- lib/gocardless-pro/version.rb
|
142
135
|
- spec/api_service_spec.rb
|
143
136
|
- spec/client_spec.rb
|
144
137
|
- spec/error_spec.rb
|
145
|
-
- spec/resources/api_key_spec.rb
|
146
138
|
- spec/resources/creditor_bank_account_spec.rb
|
147
139
|
- spec/resources/creditor_spec.rb
|
148
140
|
- spec/resources/customer_bank_account_spec.rb
|
@@ -152,14 +144,10 @@ files:
|
|
152
144
|
- spec/resources/mandate_spec.rb
|
153
145
|
- spec/resources/payment_spec.rb
|
154
146
|
- spec/resources/payout_spec.rb
|
155
|
-
- spec/resources/publishable_api_key_spec.rb
|
156
147
|
- spec/resources/redirect_flow_spec.rb
|
157
148
|
- spec/resources/refund_spec.rb
|
158
|
-
- spec/resources/role_spec.rb
|
159
149
|
- spec/resources/subscription_spec.rb
|
160
|
-
- spec/resources/user_spec.rb
|
161
150
|
- spec/response_spec.rb
|
162
|
-
- spec/services/api_key_service_spec.rb
|
163
151
|
- spec/services/creditor_bank_account_service_spec.rb
|
164
152
|
- spec/services/creditor_service_spec.rb
|
165
153
|
- spec/services/customer_bank_account_service_spec.rb
|
@@ -169,12 +157,9 @@ files:
|
|
169
157
|
- spec/services/mandate_service_spec.rb
|
170
158
|
- spec/services/payment_service_spec.rb
|
171
159
|
- spec/services/payout_service_spec.rb
|
172
|
-
- spec/services/publishable_api_key_service_spec.rb
|
173
160
|
- spec/services/redirect_flow_service_spec.rb
|
174
161
|
- spec/services/refund_service_spec.rb
|
175
|
-
- spec/services/role_service_spec.rb
|
176
162
|
- spec/services/subscription_service_spec.rb
|
177
|
-
- spec/services/user_service_spec.rb
|
178
163
|
- spec/spec_helper.rb
|
179
164
|
homepage: https://github.com/gocardless/gocardless-pro-ruby
|
180
165
|
licenses:
|
@@ -204,7 +189,6 @@ test_files:
|
|
204
189
|
- spec/api_service_spec.rb
|
205
190
|
- spec/client_spec.rb
|
206
191
|
- spec/error_spec.rb
|
207
|
-
- spec/resources/api_key_spec.rb
|
208
192
|
- spec/resources/creditor_bank_account_spec.rb
|
209
193
|
- spec/resources/creditor_spec.rb
|
210
194
|
- spec/resources/customer_bank_account_spec.rb
|
@@ -214,14 +198,10 @@ test_files:
|
|
214
198
|
- spec/resources/mandate_spec.rb
|
215
199
|
- spec/resources/payment_spec.rb
|
216
200
|
- spec/resources/payout_spec.rb
|
217
|
-
- spec/resources/publishable_api_key_spec.rb
|
218
201
|
- spec/resources/redirect_flow_spec.rb
|
219
202
|
- spec/resources/refund_spec.rb
|
220
|
-
- spec/resources/role_spec.rb
|
221
203
|
- spec/resources/subscription_spec.rb
|
222
|
-
- spec/resources/user_spec.rb
|
223
204
|
- spec/response_spec.rb
|
224
|
-
- spec/services/api_key_service_spec.rb
|
225
205
|
- spec/services/creditor_bank_account_service_spec.rb
|
226
206
|
- spec/services/creditor_service_spec.rb
|
227
207
|
- spec/services/customer_bank_account_service_spec.rb
|
@@ -231,11 +211,8 @@ test_files:
|
|
231
211
|
- spec/services/mandate_service_spec.rb
|
232
212
|
- spec/services/payment_service_spec.rb
|
233
213
|
- spec/services/payout_service_spec.rb
|
234
|
-
- spec/services/publishable_api_key_service_spec.rb
|
235
214
|
- spec/services/redirect_flow_service_spec.rb
|
236
215
|
- spec/services/refund_service_spec.rb
|
237
|
-
- spec/services/role_service_spec.rb
|
238
216
|
- spec/services/subscription_service_spec.rb
|
239
|
-
- spec/services/user_service_spec.rb
|
240
217
|
- spec/spec_helper.rb
|
241
218
|
has_rdoc:
|
@@ -1,62 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# encoding: utf-8
|
4
|
-
#
|
5
|
-
# WARNING: Do not edit by hand, this file was generated by Crank:
|
6
|
-
#
|
7
|
-
# https://github.com/gocardless/crank
|
8
|
-
#
|
9
|
-
require 'uri'
|
10
|
-
|
11
|
-
module GoCardless
|
12
|
-
# A module containing classes for each of the resources in the GC Api
|
13
|
-
module Resources
|
14
|
-
# <a name="api_key_not_active"></a>API keys are designed to be used by any
|
15
|
-
# integrations you build. You should generate a key and then use it to make
|
16
|
-
# requests to the API and set the webhook URL for that integration. They do
|
17
|
-
# not expire, but can be disabled.
|
18
|
-
# Represents an instance of a api_key resource returned from the API
|
19
|
-
class ApiKey
|
20
|
-
attr_reader :created_at
|
21
|
-
|
22
|
-
attr_reader :enabled
|
23
|
-
|
24
|
-
attr_reader :id
|
25
|
-
|
26
|
-
attr_reader :key
|
27
|
-
|
28
|
-
attr_reader :name
|
29
|
-
|
30
|
-
attr_reader :webhook_url
|
31
|
-
# initialize a resource instance
|
32
|
-
# @param object [Hash] an object returned from the API
|
33
|
-
def initialize(object)
|
34
|
-
@object = object
|
35
|
-
|
36
|
-
@created_at = object['created_at']
|
37
|
-
@enabled = object['enabled']
|
38
|
-
@id = object['id']
|
39
|
-
@key = object['key']
|
40
|
-
@links = object['links']
|
41
|
-
@name = object['name']
|
42
|
-
@webhook_url = object['webhook_url']
|
43
|
-
end
|
44
|
-
|
45
|
-
# return the links that the resource has
|
46
|
-
def links
|
47
|
-
Struct.new(
|
48
|
-
*{
|
49
|
-
|
50
|
-
role: ''
|
51
|
-
|
52
|
-
}.keys.sort
|
53
|
-
).new(*@links.sort.map(&:last))
|
54
|
-
end
|
55
|
-
|
56
|
-
# Provides the resource as a hash of all it's readable attributes
|
57
|
-
def to_h
|
58
|
-
@object
|
59
|
-
end
|
60
|
-
end
|
61
|
-
end
|
62
|
-
end
|
@@ -1,51 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# encoding: utf-8
|
4
|
-
#
|
5
|
-
# WARNING: Do not edit by hand, this file was generated by Crank:
|
6
|
-
#
|
7
|
-
# https://github.com/gocardless/crank
|
8
|
-
#
|
9
|
-
require 'uri'
|
10
|
-
|
11
|
-
module GoCardless
|
12
|
-
# A module containing classes for each of the resources in the GC Api
|
13
|
-
module Resources
|
14
|
-
# Publishable API keys are designed to be used by the [js
|
15
|
-
# flow](https://developer.gocardless.com/pro/#api-endpoints-customer-bank-account-tokens).
|
16
|
-
# You should generate a key and then use it to make requests to the API. They
|
17
|
-
# do not expire, but can be disabled.
|
18
|
-
#
|
19
|
-
# Publishable API keys only have
|
20
|
-
# permissions to create [customer bank account
|
21
|
-
# tokens](https://developer.gocardless.com/pro/#api-endpoints-customer-bank-account-tokens).
|
22
|
-
# Represents an instance of a publishable_api_key resource returned from the API
|
23
|
-
class PublishableApiKey
|
24
|
-
attr_reader :created_at
|
25
|
-
|
26
|
-
attr_reader :enabled
|
27
|
-
|
28
|
-
attr_reader :id
|
29
|
-
|
30
|
-
attr_reader :key
|
31
|
-
|
32
|
-
attr_reader :name
|
33
|
-
# initialize a resource instance
|
34
|
-
# @param object [Hash] an object returned from the API
|
35
|
-
def initialize(object)
|
36
|
-
@object = object
|
37
|
-
|
38
|
-
@created_at = object['created_at']
|
39
|
-
@enabled = object['enabled']
|
40
|
-
@id = object['id']
|
41
|
-
@key = object['key']
|
42
|
-
@name = object['name']
|
43
|
-
end
|
44
|
-
|
45
|
-
# Provides the resource as a hash of all it's readable attributes
|
46
|
-
def to_h
|
47
|
-
@object
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
@@ -1,101 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# encoding: utf-8
|
4
|
-
#
|
5
|
-
# WARNING: Do not edit by hand, this file was generated by Crank:
|
6
|
-
#
|
7
|
-
# https://github.com/gocardless/crank
|
8
|
-
#
|
9
|
-
require 'uri'
|
10
|
-
|
11
|
-
module GoCardless
|
12
|
-
# A module containing classes for each of the resources in the GC Api
|
13
|
-
module Resources
|
14
|
-
# <a name="insufficient_permissions"></a>Roles represent a set of permissions
|
15
|
-
# that may be granted to a user. The permissions are specified at the
|
16
|
-
# resource-type level, and can be `full_access` or `read_only`. If a
|
17
|
-
# resource-type is not included that role's users will have no access to
|
18
|
-
# resources of that type, and will receive an `insufficient_permissions` error
|
19
|
-
# when trying to use those endpoints.
|
20
|
-
#
|
21
|
-
# A role's `permissions`
|
22
|
-
# attribute is used to set/show the permissions for a role and it's key/value
|
23
|
-
# pairs are restricted to the below:
|
24
|
-
#
|
25
|
-
# <dl>
|
26
|
-
#
|
27
|
-
# <dt><p><code>resource</code></p></dt>
|
28
|
-
# <dd><p>One of:</p>
|
29
|
-
# <ul>
|
30
|
-
|
31
|
-
# # <li><code>customers</code></li>
|
32
|
-
#
|
33
|
-
# <li><code>customer_bank_accounts</code></li>
|
34
|
-
#
|
35
|
-
# <li><code>mandates</code></li>
|
36
|
-
# <li><code>payments</code></li>
|
37
|
-
#
|
38
|
-
# <li><code>payouts</code></li>
|
39
|
-
#
|
40
|
-
# <li><code>creditors</code></li>
|
41
|
-
#
|
42
|
-
# <li><code>creditor_bank_accounts</code></li>
|
43
|
-
#
|
44
|
-
# <li><code>roles</code></li>
|
45
|
-
# <li><code>users</code></li>
|
46
|
-
#
|
47
|
-
# <li><code>events</code></li>
|
48
|
-
# <li><code>api_keys</code></li>
|
49
|
-
#
|
50
|
-
# <li><code>subscriptions</code></li>
|
51
|
-
#
|
52
|
-
# <li><code>redirect_flows</code></li>
|
53
|
-
# </ul>
|
54
|
-
# </dd>
|
55
|
-
# </dl>
|
56
|
-
#
|
57
|
-
#
|
58
|
-
# <dl>
|
59
|
-
# <dt><p><code>access</code></p></dt>
|
60
|
-
# <dd><p>One
|
61
|
-
# of:</p>
|
62
|
-
# <ul>
|
63
|
-
# <li><code>full_access</code>: read and write
|
64
|
-
# all records of this type</li>
|
65
|
-
# <li><code>read_only</code>: list and
|
66
|
-
# show endpoints available, but not create, update, delete, or actions</li>
|
67
|
-
|
68
|
-
# # </ul>
|
69
|
-
# </dd>
|
70
|
-
# </dl>
|
71
|
-
#
|
72
|
-
# Represents an instance of a role resource returned from the API
|
73
|
-
class Role
|
74
|
-
attr_reader :created_at
|
75
|
-
|
76
|
-
attr_reader :enabled
|
77
|
-
|
78
|
-
attr_reader :id
|
79
|
-
|
80
|
-
attr_reader :name
|
81
|
-
|
82
|
-
attr_reader :permissions
|
83
|
-
# initialize a resource instance
|
84
|
-
# @param object [Hash] an object returned from the API
|
85
|
-
def initialize(object)
|
86
|
-
@object = object
|
87
|
-
|
88
|
-
@created_at = object['created_at']
|
89
|
-
@enabled = object['enabled']
|
90
|
-
@id = object['id']
|
91
|
-
@name = object['name']
|
92
|
-
@permissions = object['permissions']
|
93
|
-
end
|
94
|
-
|
95
|
-
# Provides the resource as a hash of all it's readable attributes
|
96
|
-
def to_h
|
97
|
-
@object
|
98
|
-
end
|
99
|
-
end
|
100
|
-
end
|
101
|
-
end
|
@@ -1,60 +0,0 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
# encoding: utf-8
|
4
|
-
#
|
5
|
-
# WARNING: Do not edit by hand, this file was generated by Crank:
|
6
|
-
#
|
7
|
-
# https://github.com/gocardless/crank
|
8
|
-
#
|
9
|
-
require 'uri'
|
10
|
-
|
11
|
-
module GoCardless
|
12
|
-
# A module containing classes for each of the resources in the GC Api
|
13
|
-
module Resources
|
14
|
-
#
|
15
|
-
# Represents an instance of a user resource returned from the API
|
16
|
-
class User
|
17
|
-
attr_reader :created_at
|
18
|
-
|
19
|
-
attr_reader :email
|
20
|
-
|
21
|
-
attr_reader :enabled
|
22
|
-
|
23
|
-
attr_reader :family_name
|
24
|
-
|
25
|
-
attr_reader :given_name
|
26
|
-
|
27
|
-
attr_reader :id
|
28
|
-
|
29
|
-
# initialize a resource instance
|
30
|
-
# @param object [Hash] an object returned from the API
|
31
|
-
def initialize(object)
|
32
|
-
@object = object
|
33
|
-
|
34
|
-
@created_at = object['created_at']
|
35
|
-
@email = object['email']
|
36
|
-
@enabled = object['enabled']
|
37
|
-
@family_name = object['family_name']
|
38
|
-
@given_name = object['given_name']
|
39
|
-
@id = object['id']
|
40
|
-
@links = object['links']
|
41
|
-
end
|
42
|
-
|
43
|
-
# return the links that the resource has
|
44
|
-
def links
|
45
|
-
Struct.new(
|
46
|
-
*{
|
47
|
-
|
48
|
-
role: ''
|
49
|
-
|
50
|
-
}.keys.sort
|
51
|
-
).new(*@links.sort.map(&:last))
|
52
|
-
end
|
53
|
-
|
54
|
-
# Provides the resource as a hash of all it's readable attributes
|
55
|
-
def to_h
|
56
|
-
@object
|
57
|
-
end
|
58
|
-
end
|
59
|
-
end
|
60
|
-
end
|