killbill-client 4.0.12 → 4.0.13
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/lib/killbill_client/models/account.rb +10 -6
- data/lib/killbill_client/version.rb +1 -1
- data/spec/killbill_client/account_spec.rb +37 -0
- metadata +3 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 8fbec6bf07129453df21062e7069eb5dd51e2128f0c36aa3c87bb08939cde67f
|
|
4
|
+
data.tar.gz: 355b8ea893c169703d0617932ce371aa27f6a199b4594d3092606947cd9865cf
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2466ef78bbf64a2792c357219c061b7631cedb7344bf8e28fd416a5fedb838dde5631028f65cd8435d65d3083f9ce12484931e8634e91d206ed083f59f6f9c1a
|
|
7
|
+
data.tar.gz: fb13a7e21941d399431ad308cf5070dcc8ad95476a9eadadde3d28fe4d476886956dc67c6e6af10ed6fe3c0a1f5e137533ff70562d45bcae3d93bb085b443df2
|
|
@@ -84,13 +84,17 @@ module KillBillClient
|
|
|
84
84
|
Bundle
|
|
85
85
|
end
|
|
86
86
|
|
|
87
|
-
|
|
87
|
+
# By default, invoices in a page are shallow (no items), i.e. amount, balance, etc. are 0.
|
|
88
|
+
# Set include_invoice_components to load the components of the invoices of the requested page only.
|
|
89
|
+
def paginated_invoices(account_id, offset = 0, limit = 100, audit = "NONE", options = {}, include_invoice_components = false)
|
|
90
|
+
params = {
|
|
91
|
+
:offset => offset,
|
|
92
|
+
:limit => limit,
|
|
93
|
+
:audit => audit
|
|
94
|
+
}
|
|
95
|
+
params[:includeInvoiceComponents] = true if include_invoice_components
|
|
88
96
|
get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/invoices/pagination",
|
|
89
|
-
|
|
90
|
-
:offset => offset,
|
|
91
|
-
:limit => limit,
|
|
92
|
-
:audit => audit
|
|
93
|
-
},
|
|
97
|
+
params,
|
|
94
98
|
options,
|
|
95
99
|
Invoice
|
|
96
100
|
end
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe KillBillClient::Model::Account do
|
|
4
|
+
|
|
5
|
+
def json_response(body)
|
|
6
|
+
response = Net::HTTPOK.new('1.1', '200', 'OK')
|
|
7
|
+
response['Content-Type'] = 'application/json'
|
|
8
|
+
response.instance_variable_set(:@read, true)
|
|
9
|
+
response.instance_variable_set(:@body, body)
|
|
10
|
+
response
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe '.paginated_invoices' do
|
|
14
|
+
let(:account_id) { 'e6f0d4ab-0d2b-4a8f-9a5c-0a8f5b1c2d3e' }
|
|
15
|
+
let(:uri) { "/1.0/kb/accounts/#{account_id}/invoices/pagination" }
|
|
16
|
+
|
|
17
|
+
it 'does not request invoice components by default' do
|
|
18
|
+
expect(KillBillClient::API).to receive(:get)
|
|
19
|
+
.with(uri, {:offset => 0, :limit => 100, :audit => 'NONE'}, {:api_key => 'key'})
|
|
20
|
+
.and_return(json_response('[]'))
|
|
21
|
+
|
|
22
|
+
described_class.paginated_invoices(account_id, 0, 100, 'NONE', {:api_key => 'key'})
|
|
23
|
+
end
|
|
24
|
+
|
|
25
|
+
it 'requests invoice components when asked to' do
|
|
26
|
+
expect(KillBillClient::API).to receive(:get)
|
|
27
|
+
.with(uri, {:offset => 10, :limit => 50, :audit => 'NONE', :includeInvoiceComponents => true}, {:api_key => 'key'})
|
|
28
|
+
.and_return(json_response('[{"invoiceId":"abc","amount":12.5,"balance":2.5}]'))
|
|
29
|
+
|
|
30
|
+
invoices = described_class.paginated_invoices(account_id, 10, 50, 'NONE', {:api_key => 'key'}, true)
|
|
31
|
+
|
|
32
|
+
expect(invoices.size).to eq(1)
|
|
33
|
+
expect(invoices.first.amount).to eq(12.5)
|
|
34
|
+
expect(invoices.first.balance).to eq(2.5)
|
|
35
|
+
end
|
|
36
|
+
end
|
|
37
|
+
end
|
metadata
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: killbill-client
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 4.0.
|
|
4
|
+
version: 4.0.13
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Killbill core team
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2026-11-
|
|
11
|
+
date: 2026-11-25 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gem-release
|
|
@@ -203,6 +203,7 @@ files:
|
|
|
203
203
|
- lib/killbill_client/version.rb
|
|
204
204
|
- lib/rails/generators/killbill_client/config_generator.rb
|
|
205
205
|
- lib/rails/killbill_client.rb
|
|
206
|
+
- spec/killbill_client/account_spec.rb
|
|
206
207
|
- spec/killbill_client/base_uri_spec.rb
|
|
207
208
|
- spec/killbill_client/errors_spec.rb
|
|
208
209
|
- spec/killbill_client/http_adapter_spec.rb
|