killbill-client 3.0.0 → 3.3.1

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.
Files changed (34) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +15 -109
  3. data/.github/CONTRIBUTING.md +20 -0
  4. data/.github/FUNDING.yml +3 -0
  5. data/.github/workflows/ci.yml +145 -0
  6. data/.github/workflows/release.yml +46 -0
  7. data/README.md +32 -1
  8. data/bin/retry +21 -0
  9. data/docker/docker-compose.ci.mysql.yml +21 -0
  10. data/docker/docker-compose.ci.postgresql.yml +21 -0
  11. data/killbill_client.gemspec +2 -1
  12. data/lib/killbill_client.rb +2 -0
  13. data/lib/killbill_client/api/api.rb +1 -1
  14. data/lib/killbill_client/api/net_http_adapter.rb +13 -2
  15. data/lib/killbill_client/models/account.rb +3 -5
  16. data/lib/killbill_client/models/credit.rb +5 -5
  17. data/lib/killbill_client/models/custom_field.rb +17 -0
  18. data/lib/killbill_client/models/gen/invoice_attributes.rb +1 -0
  19. data/lib/killbill_client/models/gen/invoice_item_attributes.rb +1 -0
  20. data/lib/killbill_client/models/gen/overdue_state_attributes.rb +0 -1
  21. data/lib/killbill_client/models/gen/require_gen.rb +52 -53
  22. data/lib/killbill_client/models/gen/subscription_attributes.rb +1 -0
  23. data/lib/killbill_client/models/helpers/custom_field_helper.rb +1 -1
  24. data/lib/killbill_client/models/invoice.rb +4 -7
  25. data/lib/killbill_client/models/subscription.rb +10 -0
  26. data/lib/killbill_client/version.rb +1 -16
  27. data/spec/killbill_client/http_adapter_spec.rb +32 -0
  28. data/spec/killbill_client/remote/model_spec.rb +15 -11
  29. metadata +25 -8
  30. data/lib/killbill_client/models/gen/block_price_override_attributes.rb +0 -37
  31. data/lib/killbill_client/models/gen/credit_attributes.rb +0 -43
  32. data/lib/killbill_client/models/gen/phase_price_override_attributes.rb +0 -39
  33. data/lib/killbill_client/models/gen/tier_price_override_attributes.rb +0 -34
  34. data/lib/killbill_client/models/gen/usage_price_override_attributes.rb +0 -38
@@ -1,18 +1,3 @@
1
1
  module KillBillClient
2
- module Version
3
- MAJOR = 3
4
- MINOR = 0
5
- PATCH = 0
6
- PRE = nil
7
-
8
- VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
9
-
10
- class << self
11
- def inspect
12
- VERSION.dup
13
- end
14
-
15
- alias to_s inspect
16
- end
17
- end
2
+ VERSION = '3.3.1'
18
3
  end
@@ -1,6 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe KillBillClient::API do
4
+
5
+ before do
6
+ KillBillClient.url = nil
7
+ KillBillClient.disable_ssl_verification = nil
8
+ KillBillClient.read_timeout = nil
9
+ KillBillClient.connection_timeout = nil
10
+ end
11
+
4
12
  let(:expected_query_params) {
5
13
  [
6
14
  'controlPluginName=killbill-example-plugin',
@@ -55,11 +63,33 @@ describe KillBillClient::API do
55
63
  http_adapter = DummyForHTTPAdapter.new
56
64
  http_client = http_adapter.send(:create_http_client, uri)
57
65
  expect(http_client.read_timeout).to eq(60)
66
+ # The default value has changed from nil to 60 in 2.4
67
+ #expect(http_client.open_timeout).to eq(60)
58
68
  expect(http_client.use_ssl?).to be false
59
69
  expect(http_client.verify_mode).to be_nil
60
70
  end
61
71
 
72
+ it 'should set the global parameters for http client' do
73
+ KillBillClient.url = 'https://example.com'
74
+ KillBillClient.read_timeout = 123000
75
+ KillBillClient.connection_timeout = 456000
76
+ KillBillClient.disable_ssl_verification = true
77
+
78
+ http_adapter = DummyForHTTPAdapter.new
79
+ http_client = http_adapter.send(:create_http_client, ssl_uri, {})
80
+ expect(http_client.read_timeout).to eq(123)
81
+ expect(http_client.open_timeout).to eq(456)
82
+ expect(http_client.use_ssl?).to be true
83
+ expect(http_client.verify_mode).to eq(OpenSSL::SSL::VERIFY_NONE)
84
+ end
85
+
62
86
  it 'should set the correct parameters for http client' do
87
+ # These don't matter (overridden by options)
88
+ KillBillClient.url = 'https://example.com'
89
+ KillBillClient.read_timeout = 123000
90
+ KillBillClient.connection_timeout = 456000
91
+ KillBillClient.disable_ssl_verification = false
92
+
63
93
  http_adapter = DummyForHTTPAdapter.new
64
94
  http_client = http_adapter.send(:create_http_client, ssl_uri, options)
65
95
  expect(http_client.read_timeout).to eq(options[:read_timeout] / 1000)
@@ -70,6 +100,8 @@ describe KillBillClient::API do
70
100
 
71
101
  # See https://github.com/killbill/killbill-client-ruby/issues/69
72
102
  it 'should construct URIs' do
103
+ KillBillClient.url = 'http://example.com:8080'
104
+
73
105
  http_adapter = DummyForHTTPAdapter.new
74
106
  uri = http_adapter.send(:build_uri, KillBillClient::Model::Account::KILLBILL_API_ACCOUNTS_PREFIX, options)
75
107
  expect(uri).to eq(URI.parse("#{KillBillClient::API.base_uri.to_s}/1.0/kb/accounts"))
@@ -101,13 +101,17 @@ describe KillBillClient::Model do
101
101
  custom_field = KillBillClient::Model::CustomField.new
102
102
  custom_field.name = SecureRandom.uuid.to_s
103
103
  custom_field.value = SecureRandom.uuid.to_s
104
+ custom_field_other = KillBillClient::Model::CustomField.new
105
+ custom_field_other.name = SecureRandom.uuid.to_s
106
+ custom_field_other.value = SecureRandom.uuid.to_s
104
107
  account.add_custom_field(custom_field, 'KillBill Spec test')
108
+ account.add_custom_field(custom_field_other, 'KillBill Spec test other')
105
109
  custom_fields = account.custom_fields
106
- expect(custom_fields.size).to eq(1)
110
+ expect(custom_fields.size).to eq(2)
107
111
  expect(custom_fields.first.name).to eq(custom_field.name)
108
112
  expect(custom_fields.first.value).to eq(custom_field.value)
109
113
  account.remove_custom_field(custom_fields.first.custom_field_id, 'KillBill Spec test')
110
- expect(account.custom_fields.size).to eq(0)
114
+ expect(account.custom_fields.size).to eq(1)
111
115
 
112
116
  # Add a payment method
113
117
  pm = KillBillClient::Model::PaymentMethod.new
@@ -163,13 +167,13 @@ describe KillBillClient::Model do
163
167
  invoice.commit 'KillBill Spec test'
164
168
 
165
169
  # Add/Remove a invoice item tag
166
- expect(invoice_item.tags.size).to eq(0)
167
- invoice_item.add_tag('TEST', 'KillBill Spec test')
168
- tags = invoice_item.tags
170
+ expect(invoice.tags.size).to eq(0)
171
+ invoice.add_tag('WRITTEN_OFF', 'KillBill Spec test')
172
+ tags = invoice.tags
169
173
  expect(tags.size).to eq(1)
170
- expect(tags.first.tag_definition_name).to eq('TEST')
171
- invoice_item.remove_tag('TEST', 'KillBill Spec test')
172
- expect(invoice_item.tags.size).to eq(0)
174
+ expect(tags.first.tag_definition_name).to eq('WRITTEN_OFF')
175
+ invoice.remove_tag('WRITTEN_OFF', 'KillBill Spec test')
176
+ expect(invoice.tags.size).to eq(0)
173
177
 
174
178
  # Add/Remove a invoice item custom field
175
179
  expect(invoice_item.custom_fields.size).to eq(0)
@@ -285,7 +289,7 @@ describe KillBillClient::Model do
285
289
  expect(invoice_payment.credited_amount).to eq(0)
286
290
 
287
291
  # Refund the payment (with item adjustment)
288
- invoice_item = KillBillClient::Model::Invoice.find_by_number(invoice_number, true).items.first
292
+ invoice_item = KillBillClient::Model::Invoice.find_by_number(invoice_number).items.first
289
293
  item = KillBillClient::Model::InvoiceItem.new
290
294
  item.invoice_item_id = invoice_item.invoice_item_id
291
295
  item.amount = invoice_item.amount
@@ -299,9 +303,9 @@ describe KillBillClient::Model do
299
303
 
300
304
  # Create a credit for invoice
301
305
  new_credit = KillBillClient::Model::Credit.new
302
- new_credit.credit_amount = 10.1
306
+ new_credit.amount = 10.1
303
307
  new_credit.invoice_id = invoice_id
304
- new_credit.effective_date = "2013-09-30"
308
+ new_credit.start_date = "2013-09-30"
305
309
  new_credit.account_id = account.account_id
306
310
 
307
311
  expect { new_credit.create(true, 'KillBill Spec test') }.to raise_error(KillBillClient::API::BadRequest)
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.0
4
+ version: 3.3.1
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: 2019-02-23 00:00:00.000000000 Z
11
+ date: 2021-08-06 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gem-release
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.2'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.2'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -46,15 +60,23 @@ dependencies:
46
60
  version: '3.4'
47
61
  description: An API client library for Kill Bill.
48
62
  email: killbilling-users@googlegroups.com
49
- executables: []
63
+ executables:
64
+ - retry
50
65
  extensions: []
51
66
  extra_rdoc_files: []
52
67
  files:
53
68
  - ".circleci/config.yml"
69
+ - ".github/CONTRIBUTING.md"
70
+ - ".github/FUNDING.yml"
71
+ - ".github/workflows/ci.yml"
72
+ - ".github/workflows/release.yml"
54
73
  - ".gitignore"
55
74
  - Gemfile
56
75
  - README.md
57
76
  - Rakefile
77
+ - bin/retry
78
+ - docker/docker-compose.ci.mysql.yml
79
+ - docker/docker-compose.ci.postgresql.yml
58
80
  - gen_config/model.conf
59
81
  - killbill_client.gemspec
60
82
  - lib/killbill_client.rb
@@ -81,7 +103,6 @@ files:
81
103
  - lib/killbill_client/models/gen/audit_log_attributes.rb
82
104
  - lib/killbill_client/models/gen/billing_exception_attributes.rb
83
105
  - lib/killbill_client/models/gen/block_price_attributes.rb
84
- - lib/killbill_client/models/gen/block_price_override_attributes.rb
85
106
  - lib/killbill_client/models/gen/blocking_state_attributes.rb
86
107
  - lib/killbill_client/models/gen/bulk_subscriptions_bundle_attributes.rb
87
108
  - lib/killbill_client/models/gen/bundle_attributes.rb
@@ -89,7 +110,6 @@ files:
89
110
  - lib/killbill_client/models/gen/catalog_attributes.rb
90
111
  - lib/killbill_client/models/gen/combo_hosted_payment_page_attributes.rb
91
112
  - lib/killbill_client/models/gen/combo_payment_transaction_attributes.rb
92
- - lib/killbill_client/models/gen/credit_attributes.rb
93
113
  - lib/killbill_client/models/gen/custom_field_attributes.rb
94
114
  - lib/killbill_client/models/gen/duration_attributes.rb
95
115
  - lib/killbill_client/models/gen/event_subscription_attributes.rb
@@ -119,7 +139,6 @@ files:
119
139
  - lib/killbill_client/models/gen/payment_transaction_attributes.rb
120
140
  - lib/killbill_client/models/gen/phase_attributes.rb
121
141
  - lib/killbill_client/models/gen/phase_price_attributes.rb
122
- - lib/killbill_client/models/gen/phase_price_override_attributes.rb
123
142
  - lib/killbill_client/models/gen/plan_attributes.rb
124
143
  - lib/killbill_client/models/gen/plan_detail_attributes.rb
125
144
  - lib/killbill_client/models/gen/plugin_info_attributes.rb
@@ -146,13 +165,11 @@ files:
146
165
  - lib/killbill_client/models/gen/tenant_key_value_attributes.rb
147
166
  - lib/killbill_client/models/gen/tier_attributes.rb
148
167
  - lib/killbill_client/models/gen/tier_price_attributes.rb
149
- - lib/killbill_client/models/gen/tier_price_override_attributes.rb
150
168
  - lib/killbill_client/models/gen/tiered_block_attributes.rb
151
169
  - lib/killbill_client/models/gen/unit_attributes.rb
152
170
  - lib/killbill_client/models/gen/unit_usage_record_attributes.rb
153
171
  - lib/killbill_client/models/gen/usage_attributes.rb
154
172
  - lib/killbill_client/models/gen/usage_price_attributes.rb
155
- - lib/killbill_client/models/gen/usage_price_override_attributes.rb
156
173
  - lib/killbill_client/models/gen/usage_record_attributes.rb
157
174
  - lib/killbill_client/models/gen/user_roles_attributes.rb
158
175
  - lib/killbill_client/models/helpers/audit_log_with_history_helper.rb
@@ -1,37 +0,0 @@
1
- #############################################################################################
2
- # #
3
- # Copyright 2010-2013 Ning, Inc. #
4
- # Copyright 2014 Groupon, Inc. #
5
- # Copyright 2014 The Billing Project, LLC #
6
- # #
7
- # The Billing Project licenses this file to you under the Apache License, version 2.0 #
8
- # (the "License"); you may not use this file except in compliance with the #
9
- # License. You may obtain a copy of the License at: #
10
- # #
11
- # http://www.apache.org/licenses/LICENSE-2.0 #
12
- # #
13
- # Unless required by applicable law or agreed to in writing, software #
14
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
16
- # License for the specific language governing permissions and limitations #
17
- # under the License. #
18
- # #
19
- #############################################################################################
20
-
21
-
22
- #
23
- # DO NOT EDIT!!!
24
- # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
25
- #
26
-
27
-
28
- module KillBillClient
29
- module Model
30
- class BlockPriceOverrideAttributes < Resource
31
- attribute :unit_name
32
- attribute :size
33
- attribute :price
34
- attribute :max
35
- end
36
- end
37
- end
@@ -1,43 +0,0 @@
1
- #############################################################################################
2
- # #
3
- # Copyright 2010-2013 Ning, Inc. #
4
- # Copyright 2014 Groupon, Inc. #
5
- # Copyright 2014 The Billing Project, LLC #
6
- # #
7
- # The Billing Project licenses this file to you under the Apache License, version 2.0 #
8
- # (the "License"); you may not use this file except in compliance with the #
9
- # License. You may obtain a copy of the License at: #
10
- # #
11
- # http://www.apache.org/licenses/LICENSE-2.0 #
12
- # #
13
- # Unless required by applicable law or agreed to in writing, software #
14
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
16
- # License for the specific language governing permissions and limitations #
17
- # under the License. #
18
- # #
19
- #############################################################################################
20
-
21
-
22
- #
23
- # DO NOT EDIT!!!
24
- # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
25
- #
26
-
27
-
28
- module KillBillClient
29
- module Model
30
- class CreditAttributes < Resource
31
- attribute :credit_id
32
- attribute :credit_amount
33
- attribute :currency
34
- attribute :invoice_id
35
- attribute :invoice_number
36
- attribute :effective_date
37
- attribute :account_id
38
- attribute :description
39
- attribute :item_details
40
- attribute :audit_logs
41
- end
42
- end
43
- end
@@ -1,39 +0,0 @@
1
- #############################################################################################
2
- # #
3
- # Copyright 2010-2013 Ning, Inc. #
4
- # Copyright 2014 Groupon, Inc. #
5
- # Copyright 2014 The Billing Project, LLC #
6
- # #
7
- # The Billing Project licenses this file to you under the Apache License, version 2.0 #
8
- # (the "License"); you may not use this file except in compliance with the #
9
- # License. You may obtain a copy of the License at: #
10
- # #
11
- # http://www.apache.org/licenses/LICENSE-2.0 #
12
- # #
13
- # Unless required by applicable law or agreed to in writing, software #
14
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
16
- # License for the specific language governing permissions and limitations #
17
- # under the License. #
18
- # #
19
- #############################################################################################
20
-
21
-
22
- #
23
- # DO NOT EDIT!!!
24
- # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
25
- #
26
-
27
-
28
- module KillBillClient
29
- module Model
30
- class PhasePriceOverrideAttributes < Resource
31
- attribute :plan_name
32
- attribute :phase_name
33
- attribute :phase_type
34
- attribute :fixed_price
35
- attribute :recurring_price
36
- attribute :usage_overrides
37
- end
38
- end
39
- end
@@ -1,34 +0,0 @@
1
- #############################################################################################
2
- # #
3
- # Copyright 2010-2013 Ning, Inc. #
4
- # Copyright 2014 Groupon, Inc. #
5
- # Copyright 2014 The Billing Project, LLC #
6
- # #
7
- # The Billing Project licenses this file to you under the Apache License, version 2.0 #
8
- # (the "License"); you may not use this file except in compliance with the #
9
- # License. You may obtain a copy of the License at: #
10
- # #
11
- # http://www.apache.org/licenses/LICENSE-2.0 #
12
- # #
13
- # Unless required by applicable law or agreed to in writing, software #
14
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
16
- # License for the specific language governing permissions and limitations #
17
- # under the License. #
18
- # #
19
- #############################################################################################
20
-
21
-
22
- #
23
- # DO NOT EDIT!!!
24
- # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
25
- #
26
-
27
-
28
- module KillBillClient
29
- module Model
30
- class TierPriceOverrideAttributes < Resource
31
- attribute :block_price_overrides
32
- end
33
- end
34
- end
@@ -1,38 +0,0 @@
1
- #############################################################################################
2
- # #
3
- # Copyright 2010-2013 Ning, Inc. #
4
- # Copyright 2014 Groupon, Inc. #
5
- # Copyright 2014 The Billing Project, LLC #
6
- # #
7
- # The Billing Project licenses this file to you under the Apache License, version 2.0 #
8
- # (the "License"); you may not use this file except in compliance with the #
9
- # License. You may obtain a copy of the License at: #
10
- # #
11
- # http://www.apache.org/licenses/LICENSE-2.0 #
12
- # #
13
- # Unless required by applicable law or agreed to in writing, software #
14
- # distributed under the License is distributed on an "AS IS" BASIS, WITHOUT #
15
- # WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the #
16
- # License for the specific language governing permissions and limitations #
17
- # under the License. #
18
- # #
19
- #############################################################################################
20
-
21
-
22
- #
23
- # DO NOT EDIT!!!
24
- # File automatically generated by killbill-java-parser (git@github.com:killbill/killbill-java-parser.git)
25
- #
26
-
27
-
28
- module KillBillClient
29
- module Model
30
- class UsagePriceOverrideAttributes < Resource
31
- attribute :usage_name
32
- attribute :usage_type
33
- attribute :billing_mode
34
- attribute :tier_block_policy
35
- attribute :tier_price_overrides
36
- end
37
- end
38
- end