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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: b48adb2cc1e4e7f535271ad99672a10e32f4b3fa14f8df9d8230ac0ed9e3fbef
4
- data.tar.gz: 7d0f22af43b3a442720e42b2445d79506a215a1ec908b14773073f0e7b216830
3
+ metadata.gz: 8fbec6bf07129453df21062e7069eb5dd51e2128f0c36aa3c87bb08939cde67f
4
+ data.tar.gz: 355b8ea893c169703d0617932ce371aa27f6a199b4594d3092606947cd9865cf
5
5
  SHA512:
6
- metadata.gz: 2213b71e35f2be99446f8d8c21044853d9fc91c041b940e25dff6032c789054367d308f0b9da1c72eee456355a8850d5944a602820f9dc0861240dfa61a6eba5
7
- data.tar.gz: e5c3bbef6e03df26bbf95e0a1fb1317440093cfcdb662af3d4700540fb480d914b19835b96f69efe04abb8f5f086b584387b76e2ffd1a19e08846f64e7055282
6
+ metadata.gz: 2466ef78bbf64a2792c357219c061b7631cedb7344bf8e28fd416a5fedb838dde5631028f65cd8435d65d3083f9ce12484931e8634e91d206ed083f59f6f9c1a
7
+ data.tar.gz: fb13a7e21941d399431ad308cf5070dcc8ad95476a9eadadde3d28fe4d476886956dc67c6e6af10ed6fe3c0a1f5e137533ff70562d45bcae3d93bb085b443df2
@@ -84,13 +84,17 @@ module KillBillClient
84
84
  Bundle
85
85
  end
86
86
 
87
- def paginated_invoices(account_id, offset = 0, limit = 100, audit = "NONE", options = {})
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
@@ -1,3 +1,3 @@
1
1
  module KillBillClient
2
- VERSION = '4.0.12'
2
+ VERSION = '4.0.13'
3
3
  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.12
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-18 00:00:00.000000000 Z
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