gocardless_pro 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: ecf319e84ed4dfe44efbdbccfa3b78fd3a2d21fa
4
- data.tar.gz: 62778f5f199f97beda830c8135d76c9b3b9db140
3
+ metadata.gz: 25c17c94e9c95d89c64ef541cba1ad27a4161034
4
+ data.tar.gz: f3e4363abacd1fd9762b6e93dc1f1a9be5108a11
5
5
  SHA512:
6
- metadata.gz: c44529e6d3b9d177f5c4cceded3dfb02dae73ee6c7ef5427e28574e6bb5466b804d01d4b519e60c91a948dc9b4409320701746214a4ae3f8d4e88239757a85a6
7
- data.tar.gz: d0539445ad58e6dbb99e1394466261ed8e8d7b415148bf5f55ff48e0cbbe8f440d68aead63008f30bc7f0ba921b8507e447004711476c614f32eec157db7aebc
6
+ metadata.gz: 25a5a1693d92817de49cd708ae348c0c86833fae5838c4691c877fbb298ca5c5e023671cdd5dbb4d0f374329837fc5d4273205ef2c380ce77192737771059265
7
+ data.tar.gz: b4ad5c3055093b64930ca5612940f75ad0f8db82c153a3b8e8b58680f08e379c8880f381f11dab061e914ae0d2276bf8a9ee18a3806bf6fb0b1edd2c0e30aae1
@@ -4,12 +4,9 @@ module GoCardlessPro
4
4
  # initialize a paginator
5
5
  # @param options [Hash]
6
6
  # @option options :service the service class to use to make requests to
7
- # @option options :path the path to make the request to
8
7
  # @option options :options additional options to send with the requests
9
8
  def initialize(options = {})
10
9
  @service = options.fetch(:service)
11
- @resource_class = options.fetch(:resource_class)
12
- @path = options.fetch(:path)
13
10
  @options = options.fetch(:options)
14
11
  end
15
12
 
@@ -18,18 +15,14 @@ module GoCardlessPro
18
15
  response = get_initial_response
19
16
  Enumerator.new do |yielder|
20
17
  loop do
21
- items = @service.unenvelope_body(response.body).map do |item|
22
- @resource_class.new(item)
23
- end
18
+ response.records.each { |item| yielder << item }
24
19
 
25
- items.each { |item| yielder << item }
26
-
27
- after_cursor = response.meta['cursors']['after']
20
+ after_cursor = response.after
28
21
  break if after_cursor.nil?
29
22
 
30
23
  @options[:params] ||= {}
31
24
  @options[:params] = @options[:params].merge(after: after_cursor)
32
- response = @service.make_request(:get, @path, @options.merge(after: after_cursor))
25
+ response = @service.list(@options.merge(after: after_cursor))
33
26
  end
34
27
  end.lazy
35
28
  end
@@ -37,7 +30,7 @@ module GoCardlessPro
37
30
  private
38
31
 
39
32
  def get_initial_response
40
- @initial_response ||= @service.make_request(:get, @path, @options)
33
+ @initial_response ||= @service.list(@options)
41
34
  end
42
35
  end
43
36
  end
@@ -26,6 +26,8 @@ module GoCardlessPro
26
26
 
27
27
  attr_reader :currency
28
28
 
29
+ attr_reader :deducted_fees
30
+
29
31
  attr_reader :id
30
32
 
31
33
  attr_reader :reference
@@ -40,6 +42,7 @@ module GoCardlessPro
40
42
  @arrival_date = object['arrival_date']
41
43
  @created_at = object['created_at']
42
44
  @currency = object['currency']
45
+ @deducted_fees = object['deducted_fees']
43
46
  @id = object['id']
44
47
  @links = object['links']
45
48
  @reference = object['reference']
@@ -38,6 +38,8 @@ module GoCardlessPro
38
38
  Resources::BankDetailsLookup.new(unenvelope_body(response.body), response)
39
39
  end
40
40
 
41
+ private
42
+
41
43
  # Unenvelope the response of the body using the service's `envelope_key`
42
44
  #
43
45
  # @param body [Hash]
@@ -45,8 +47,6 @@ module GoCardlessPro
45
47
  body[envelope_key] || body['data']
46
48
  end
47
49
 
48
- private
49
-
50
50
  # return the key which API responses will envelope data under
51
51
  def envelope_key
52
52
  'bank_details_lookups'
@@ -48,9 +48,7 @@ module GoCardlessPro
48
48
  def all(options = {})
49
49
  Paginator.new(
50
50
  service: self,
51
- path: '/creditor_bank_accounts',
52
- options: options,
53
- resource_class: Resources::CreditorBankAccount
51
+ options: options
54
52
  ).enumerator
55
53
  end
56
54
 
@@ -94,6 +92,8 @@ module GoCardlessPro
94
92
  Resources::CreditorBankAccount.new(unenvelope_body(response.body), response)
95
93
  end
96
94
 
95
+ private
96
+
97
97
  # Unenvelope the response of the body using the service's `envelope_key`
98
98
  #
99
99
  # @param body [Hash]
@@ -101,8 +101,6 @@ module GoCardlessPro
101
101
  body[envelope_key] || body['data']
102
102
  end
103
103
 
104
- private
105
-
106
104
  # return the key which API responses will envelope data under
107
105
  def envelope_key
108
106
  'creditor_bank_accounts'
@@ -48,9 +48,7 @@ module GoCardlessPro
48
48
  def all(options = {})
49
49
  Paginator.new(
50
50
  service: self,
51
- path: '/creditors',
52
- options: options,
53
- resource_class: Resources::Creditor
51
+ options: options
54
52
  ).enumerator
55
53
  end
56
54
 
@@ -88,6 +86,8 @@ module GoCardlessPro
88
86
  Resources::Creditor.new(unenvelope_body(response.body), response)
89
87
  end
90
88
 
89
+ private
90
+
91
91
  # Unenvelope the response of the body using the service's `envelope_key`
92
92
  #
93
93
  # @param body [Hash]
@@ -95,8 +95,6 @@ module GoCardlessPro
95
95
  body[envelope_key] || body['data']
96
96
  end
97
97
 
98
- private
99
-
100
98
  # return the key which API responses will envelope data under
101
99
  def envelope_key
102
100
  'creditors'
@@ -63,9 +63,7 @@ module GoCardlessPro
63
63
  def all(options = {})
64
64
  Paginator.new(
65
65
  service: self,
66
- path: '/customer_bank_accounts',
67
- options: options,
68
- resource_class: Resources::CustomerBankAccount
66
+ options: options
69
67
  ).enumerator
70
68
  end
71
69
 
@@ -128,6 +126,8 @@ module GoCardlessPro
128
126
  Resources::CustomerBankAccount.new(unenvelope_body(response.body), response)
129
127
  end
130
128
 
129
+ private
130
+
131
131
  # Unenvelope the response of the body using the service's `envelope_key`
132
132
  #
133
133
  # @param body [Hash]
@@ -135,8 +135,6 @@ module GoCardlessPro
135
135
  body[envelope_key] || body['data']
136
136
  end
137
137
 
138
- private
139
-
140
138
  # return the key which API responses will envelope data under
141
139
  def envelope_key
142
140
  'customer_bank_accounts'
@@ -48,9 +48,7 @@ module GoCardlessPro
48
48
  def all(options = {})
49
49
  Paginator.new(
50
50
  service: self,
51
- path: '/customers',
52
- options: options,
53
- resource_class: Resources::Customer
51
+ options: options
54
52
  ).enumerator
55
53
  end
56
54
 
@@ -88,6 +86,8 @@ module GoCardlessPro
88
86
  Resources::Customer.new(unenvelope_body(response.body), response)
89
87
  end
90
88
 
89
+ private
90
+
91
91
  # Unenvelope the response of the body using the service's `envelope_key`
92
92
  #
93
93
  # @param body [Hash]
@@ -95,8 +95,6 @@ module GoCardlessPro
95
95
  body[envelope_key] || body['data']
96
96
  end
97
97
 
98
- private
99
-
100
98
  # return the key which API responses will envelope data under
101
99
  def envelope_key
102
100
  'customers'
@@ -31,9 +31,7 @@ module GoCardlessPro
31
31
  def all(options = {})
32
32
  Paginator.new(
33
33
  service: self,
34
- path: '/events',
35
- options: options,
36
- resource_class: Resources::Event
34
+ options: options
37
35
  ).enumerator
38
36
  end
39
37
 
@@ -52,6 +50,8 @@ module GoCardlessPro
52
50
  Resources::Event.new(unenvelope_body(response.body), response)
53
51
  end
54
52
 
53
+ private
54
+
55
55
  # Unenvelope the response of the body using the service's `envelope_key`
56
56
  #
57
57
  # @param body [Hash]
@@ -59,8 +59,6 @@ module GoCardlessPro
59
59
  body[envelope_key] || body['data']
60
60
  end
61
61
 
62
- private
63
-
64
62
  # return the key which API responses will envelope data under
65
63
  def envelope_key
66
64
  'events'
@@ -37,6 +37,8 @@ module GoCardlessPro
37
37
  Resources::MandatePdf.new(unenvelope_body(response.body), response)
38
38
  end
39
39
 
40
+ private
41
+
40
42
  # Unenvelope the response of the body using the service's `envelope_key`
41
43
  #
42
44
  # @param body [Hash]
@@ -44,8 +46,6 @@ module GoCardlessPro
44
46
  body[envelope_key] || body['data']
45
47
  end
46
48
 
47
- private
48
-
49
49
  # return the key which API responses will envelope data under
50
50
  def envelope_key
51
51
  'mandate_pdfs'
@@ -48,9 +48,7 @@ module GoCardlessPro
48
48
  def all(options = {})
49
49
  Paginator.new(
50
50
  service: self,
51
- path: '/mandates',
52
- options: options,
53
- resource_class: Resources::Mandate
51
+ options: options
54
52
  ).enumerator
55
53
  end
56
54
 
@@ -139,6 +137,8 @@ module GoCardlessPro
139
137
  Resources::Mandate.new(unenvelope_body(response.body), response)
140
138
  end
141
139
 
140
+ private
141
+
142
142
  # Unenvelope the response of the body using the service's `envelope_key`
143
143
  #
144
144
  # @param body [Hash]
@@ -146,8 +146,6 @@ module GoCardlessPro
146
146
  body[envelope_key] || body['data']
147
147
  end
148
148
 
149
- private
150
-
151
149
  # return the key which API responses will envelope data under
152
150
  def envelope_key
153
151
  'mandates'
@@ -54,9 +54,7 @@ module GoCardlessPro
54
54
  def all(options = {})
55
55
  Paginator.new(
56
56
  service: self,
57
- path: '/payments',
58
- options: options,
59
- resource_class: Resources::Payment
57
+ options: options
60
58
  ).enumerator
61
59
  end
62
60
 
@@ -145,6 +143,8 @@ module GoCardlessPro
145
143
  Resources::Payment.new(unenvelope_body(response.body), response)
146
144
  end
147
145
 
146
+ private
147
+
148
148
  # Unenvelope the response of the body using the service's `envelope_key`
149
149
  #
150
150
  # @param body [Hash]
@@ -152,8 +152,6 @@ module GoCardlessPro
152
152
  body[envelope_key] || body['data']
153
153
  end
154
154
 
155
- private
156
-
157
155
  # return the key which API responses will envelope data under
158
156
  def envelope_key
159
157
  'payments'
@@ -32,9 +32,7 @@ module GoCardlessPro
32
32
  def all(options = {})
33
33
  Paginator.new(
34
34
  service: self,
35
- path: '/payouts',
36
- options: options,
37
- resource_class: Resources::Payout
35
+ options: options
38
36
  ).enumerator
39
37
  end
40
38
 
@@ -55,6 +53,8 @@ module GoCardlessPro
55
53
  Resources::Payout.new(unenvelope_body(response.body), response)
56
54
  end
57
55
 
56
+ private
57
+
58
58
  # Unenvelope the response of the body using the service's `envelope_key`
59
59
  #
60
60
  # @param body [Hash]
@@ -62,8 +62,6 @@ module GoCardlessPro
62
62
  body[envelope_key] || body['data']
63
63
  end
64
64
 
65
- private
66
-
67
65
  # return the key which API responses will envelope data under
68
66
  def envelope_key
69
67
  'payouts'
@@ -70,6 +70,8 @@ module GoCardlessPro
70
70
  Resources::RedirectFlow.new(unenvelope_body(response.body), response)
71
71
  end
72
72
 
73
+ private
74
+
73
75
  # Unenvelope the response of the body using the service's `envelope_key`
74
76
  #
75
77
  # @param body [Hash]
@@ -77,8 +79,6 @@ module GoCardlessPro
77
79
  body[envelope_key] || body['data']
78
80
  end
79
81
 
80
- private
81
-
82
82
  # return the key which API responses will envelope data under
83
83
  def envelope_key
84
84
  'redirect_flows'
@@ -66,9 +66,7 @@ module GoCardlessPro
66
66
  def all(options = {})
67
67
  Paginator.new(
68
68
  service: self,
69
- path: '/refunds',
70
- options: options,
71
- resource_class: Resources::Refund
69
+ options: options
72
70
  ).enumerator
73
71
  end
74
72
 
@@ -105,6 +103,8 @@ module GoCardlessPro
105
103
  Resources::Refund.new(unenvelope_body(response.body), response)
106
104
  end
107
105
 
106
+ private
107
+
108
108
  # Unenvelope the response of the body using the service's `envelope_key`
109
109
  #
110
110
  # @param body [Hash]
@@ -112,8 +112,6 @@ module GoCardlessPro
112
112
  body[envelope_key] || body['data']
113
113
  end
114
114
 
115
- private
116
-
117
115
  # return the key which API responses will envelope data under
118
116
  def envelope_key
119
117
  'refunds'
@@ -48,9 +48,7 @@ module GoCardlessPro
48
48
  def all(options = {})
49
49
  Paginator.new(
50
50
  service: self,
51
- path: '/subscriptions',
52
- options: options,
53
- resource_class: Resources::Subscription
51
+ options: options
54
52
  ).enumerator
55
53
  end
56
54
 
@@ -110,6 +108,8 @@ module GoCardlessPro
110
108
  Resources::Subscription.new(unenvelope_body(response.body), response)
111
109
  end
112
110
 
111
+ private
112
+
113
113
  # Unenvelope the response of the body using the service's `envelope_key`
114
114
  #
115
115
  # @param body [Hash]
@@ -117,8 +117,6 @@ module GoCardlessPro
117
117
  body[envelope_key] || body['data']
118
118
  end
119
119
 
120
- private
121
-
122
120
  # return the key which API responses will envelope data under
123
121
  def envelope_key
124
122
  'subscriptions'
@@ -4,5 +4,5 @@ end
4
4
 
5
5
  module GoCardlessPro
6
6
  # Current version of the GC gem
7
- VERSION = '1.0.4'
7
+ VERSION = '1.0.5'
8
8
  end
@@ -13,6 +13,8 @@ describe GoCardlessPro::Resources::Payout do
13
13
 
14
14
  'currency' => 'currency-input',
15
15
 
16
+ 'deducted_fees' => 'deducted_fees-input',
17
+
16
18
  'id' => 'id-input',
17
19
 
18
20
  'links' => {
@@ -41,6 +43,8 @@ describe GoCardlessPro::Resources::Payout do
41
43
 
42
44
  expect(resource.currency).to eq('currency-input')
43
45
 
46
+ expect(resource.deducted_fees).to eq('deducted_fees-input')
47
+
44
48
  expect(resource.id).to eq('id-input')
45
49
 
46
50
  expect(resource.links.creditor).to eq('creditor-input')
@@ -20,6 +20,7 @@ describe GoCardlessPro::Services::PayoutsService do
20
20
  'arrival_date' => 'arrival_date-input',
21
21
  'created_at' => 'created_at-input',
22
22
  'currency' => 'currency-input',
23
+ 'deducted_fees' => 'deducted_fees-input',
23
24
  'id' => 'id-input',
24
25
  'links' => 'links-input',
25
26
  'reference' => 'reference-input',
@@ -47,6 +48,8 @@ describe GoCardlessPro::Services::PayoutsService do
47
48
 
48
49
  expect(get_list_response.records.first.currency).to eq('currency-input')
49
50
 
51
+ expect(get_list_response.records.first.deducted_fees).to eq('deducted_fees-input')
52
+
50
53
  expect(get_list_response.records.first.id).to eq('id-input')
51
54
 
52
55
  expect(get_list_response.records.first.reference).to eq('reference-input')
@@ -73,6 +76,7 @@ describe GoCardlessPro::Services::PayoutsService do
73
76
  'arrival_date' => 'arrival_date-input',
74
77
  'created_at' => 'created_at-input',
75
78
  'currency' => 'currency-input',
79
+ 'deducted_fees' => 'deducted_fees-input',
76
80
  'id' => 'id-input',
77
81
  'links' => 'links-input',
78
82
  'reference' => 'reference-input',
@@ -96,6 +100,7 @@ describe GoCardlessPro::Services::PayoutsService do
96
100
  'arrival_date' => 'arrival_date-input',
97
101
  'created_at' => 'created_at-input',
98
102
  'currency' => 'currency-input',
103
+ 'deducted_fees' => 'deducted_fees-input',
99
104
  'id' => 'id-input',
100
105
  'links' => 'links-input',
101
106
  'reference' => 'reference-input',
@@ -135,6 +140,7 @@ describe GoCardlessPro::Services::PayoutsService do
135
140
  'arrival_date' => 'arrival_date-input',
136
141
  'created_at' => 'created_at-input',
137
142
  'currency' => 'currency-input',
143
+ 'deducted_fees' => 'deducted_fees-input',
138
144
  'id' => 'id-input',
139
145
  'links' => 'links-input',
140
146
  'reference' => 'reference-input',
@@ -168,6 +174,7 @@ describe GoCardlessPro::Services::PayoutsService do
168
174
  'arrival_date' => 'arrival_date-input',
169
175
  'created_at' => 'created_at-input',
170
176
  'currency' => 'currency-input',
177
+ 'deducted_fees' => 'deducted_fees-input',
171
178
  'id' => 'id-input',
172
179
  'links' => 'links-input',
173
180
  'reference' => 'reference-input',
metadata CHANGED
@@ -1,89 +1,89 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gocardless_pro
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.4
4
+ version: 1.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - GoCardless
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-07 00:00:00.000000000 Z
11
+ date: 2016-08-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rspec
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - "~>"
17
+ - - ~>
18
18
  - !ruby/object:Gem::Version
19
19
  version: '3.1'
20
20
  type: :development
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - "~>"
24
+ - - ~>
25
25
  - !ruby/object:Gem::Version
26
26
  version: '3.1'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: webmock
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - "~>"
31
+ - - ~>
32
32
  - !ruby/object:Gem::Version
33
33
  version: '1.18'
34
34
  type: :development
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - "~>"
38
+ - - ~>
39
39
  - !ruby/object:Gem::Version
40
40
  version: '1.18'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: rubocop
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - "~>"
45
+ - - ~>
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.35.1
48
48
  type: :development
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - "~>"
52
+ - - ~>
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.35.1
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: yard
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - "~>"
59
+ - - ~>
60
60
  - !ruby/object:Gem::Version
61
61
  version: 0.8.7.6
62
62
  type: :development
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - "~>"
66
+ - - ~>
67
67
  - !ruby/object:Gem::Version
68
68
  version: 0.8.7.6
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: faraday
71
71
  requirement: !ruby/object:Gem::Requirement
72
72
  requirements:
73
- - - ">="
73
+ - - '>='
74
74
  - !ruby/object:Gem::Version
75
75
  version: 0.8.9
76
- - - "<"
76
+ - - <
77
77
  - !ruby/object:Gem::Version
78
78
  version: '0.10'
79
79
  type: :runtime
80
80
  prerelease: false
81
81
  version_requirements: !ruby/object:Gem::Requirement
82
82
  requirements:
83
- - - ">="
83
+ - - '>='
84
84
  - !ruby/object:Gem::Version
85
85
  version: 0.8.9
86
- - - "<"
86
+ - - <
87
87
  - !ruby/object:Gem::Version
88
88
  version: '0.10'
89
89
  description:
@@ -93,8 +93,8 @@ executables: []
93
93
  extensions: []
94
94
  extra_rdoc_files: []
95
95
  files:
96
- - ".rspec"
97
- - ".travis.yml"
96
+ - .rspec
97
+ - .travis.yml
98
98
  - Gemfile
99
99
  - LICENSE.txt
100
100
  - README.md
@@ -185,17 +185,17 @@ require_paths:
185
185
  - lib
186
186
  required_ruby_version: !ruby/object:Gem::Requirement
187
187
  requirements:
188
- - - ">="
188
+ - - '>='
189
189
  - !ruby/object:Gem::Version
190
190
  version: '0'
191
191
  required_rubygems_version: !ruby/object:Gem::Requirement
192
192
  requirements:
193
- - - ">="
193
+ - - '>='
194
194
  - !ruby/object:Gem::Version
195
195
  version: '0'
196
196
  requirements: []
197
197
  rubyforge_project:
198
- rubygems_version: 2.4.7
198
+ rubygems_version: 2.4.8
199
199
  signing_key:
200
200
  specification_version: 4
201
201
  summary: A gem for calling the GoCardless Pro API
@@ -232,4 +232,3 @@ test_files:
232
232
  - spec/services/refunds_service_spec.rb
233
233
  - spec/services/subscriptions_service_spec.rb
234
234
  - spec/spec_helper.rb
235
- has_rdoc: