killbill-client 1.12.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -0
- data/lib/killbill_client/models/catalog.rb +12 -0
- data/lib/killbill_client/models/gen/account_attributes.rb +1 -0
- data/lib/killbill_client/models/gen/block_price_override_attributes.rb +37 -0
- data/lib/killbill_client/models/gen/catalog_attributes.rb +1 -0
- data/lib/killbill_client/models/gen/invoice_attributes.rb +2 -0
- data/lib/killbill_client/models/gen/invoice_item_attributes.rb +3 -0
- data/lib/killbill_client/models/gen/notification_attributes.rb +1 -0
- data/lib/killbill_client/models/gen/phase_price_override_attributes.rb +1 -0
- data/lib/killbill_client/models/gen/plan_attributes.rb +1 -0
- data/lib/killbill_client/models/gen/product_attributes.rb +1 -0
- data/lib/killbill_client/models/gen/require_gen.rb +4 -0
- data/lib/killbill_client/models/gen/tier_price_override_attributes.rb +34 -0
- data/lib/killbill_client/models/gen/unit_attributes.rb +35 -0
- data/lib/killbill_client/models/gen/usage_price_override_attributes.rb +38 -0
- data/lib/killbill_client/models/helpers/tag_helper.rb +5 -1
- data/lib/killbill_client/models/invoice_item.rb +35 -0
- data/lib/killbill_client/version.rb +3 -3
- data/spec/killbill_client/remote/model_spec.rb +22 -0
- metadata +6 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: '08ccf5da38d550a6f93402e34d3519f31c85297a'
|
4
|
+
data.tar.gz: 8f3b236f0f4ce4b6f60f19b399efca3ec6d55eaa
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: '0618d5fa43a3842a594ae3b8c5bdb5959c2a939906ba223eeb46f6f8c976fca3928cf42c6bc314f92232c79df670c2e61eb1a4d3cab80b6a8cecf373aa343475'
|
7
|
+
data.tar.gz: cdd4d1676c59da0d90c1a0f9e7cb0c649cb868d7d0fd58bdcd2194ed9f8d97ba4decf532f6b998931ea9502be9bb19d9c97766d26c438746db4fe41f95330d36
|
data/README.md
CHANGED
@@ -79,6 +79,18 @@ module KillBillClient
|
|
79
79
|
:comment => comment,
|
80
80
|
}.merge(options)
|
81
81
|
end
|
82
|
+
|
83
|
+
def delete_catalog(user = nil, reason = nil, comment = nil, options = {})
|
84
|
+
|
85
|
+
delete "#{KILLBILL_API_CATALOG_PREFIX}",
|
86
|
+
{},
|
87
|
+
{},
|
88
|
+
{
|
89
|
+
:user => user,
|
90
|
+
:reason => reason,
|
91
|
+
:comment => comment,
|
92
|
+
}.merge(options)
|
93
|
+
end
|
82
94
|
end
|
83
95
|
end
|
84
96
|
end
|
@@ -0,0 +1,37 @@
|
|
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
|
@@ -38,6 +38,9 @@ module KillBillClient
|
|
38
38
|
attribute :plan_name
|
39
39
|
attribute :phase_name
|
40
40
|
attribute :usage_name
|
41
|
+
attribute :pretty_plan_name
|
42
|
+
attribute :pretty_phase_name
|
43
|
+
attribute :pretty_usage_name
|
41
44
|
attribute :item_type
|
42
45
|
attribute :description
|
43
46
|
attribute :start_date
|
@@ -33,9 +33,11 @@ require 'killbill_client/models/gen/audit_log_attributes'
|
|
33
33
|
require 'killbill_client/models/gen/stack_trace_element_attributes'
|
34
34
|
require 'killbill_client/models/gen/billing_exception_attributes'
|
35
35
|
require 'killbill_client/models/gen/blocking_state_attributes'
|
36
|
+
require 'killbill_client/models/gen/block_price_override_attributes'
|
36
37
|
require 'killbill_client/models/gen/bulk_base_subscription_and_add_ons_attributes'
|
37
38
|
require 'killbill_client/models/gen/bundle_attributes'
|
38
39
|
require 'killbill_client/models/gen/bundle_timeline_attributes'
|
40
|
+
require 'killbill_client/models/gen/unit_attributes'
|
39
41
|
require 'killbill_client/models/gen/product_attributes'
|
40
42
|
require 'killbill_client/models/gen/plan_attributes'
|
41
43
|
require 'killbill_client/models/gen/tiered_block_attributes'
|
@@ -97,4 +99,6 @@ require 'killbill_client/models/gen/tag_definition_attributes'
|
|
97
99
|
require 'killbill_client/models/gen/tag_attributes'
|
98
100
|
require 'killbill_client/models/gen/tenant_attributes'
|
99
101
|
require 'killbill_client/models/gen/tenant_key_attributes'
|
102
|
+
require 'killbill_client/models/gen/tier_price_override_attributes'
|
103
|
+
require 'killbill_client/models/gen/usage_price_override_attributes'
|
100
104
|
require 'killbill_client/models/gen/user_roles_attributes'
|
@@ -0,0 +1,34 @@
|
|
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
|
@@ -0,0 +1,35 @@
|
|
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 UnitAttributes < Resource
|
31
|
+
attribute :name
|
32
|
+
attribute :pretty_name
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,38 @@
|
|
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
|
@@ -29,7 +29,11 @@ module KillBillClient
|
|
29
29
|
end
|
30
30
|
|
31
31
|
def set_tags(tag_definition_ids, user = nil, reason = nil, comment = nil, options = {})
|
32
|
-
|
32
|
+
begin
|
33
|
+
current_tag_definition_ids = tags(false, 'NONE', options).map { |tag| tag.tag_definition_id }
|
34
|
+
rescue KillBillClient::API::NotFound
|
35
|
+
current_tag_definition_ids = []
|
36
|
+
end
|
33
37
|
|
34
38
|
tags_to_remove = current_tag_definition_ids - tag_definition_ids
|
35
39
|
tags_to_add = tag_definition_ids - current_tag_definition_ids
|
@@ -2,8 +2,43 @@ module KillBillClient
|
|
2
2
|
module Model
|
3
3
|
class InvoiceItem < InvoiceItemAttributes
|
4
4
|
|
5
|
+
KILLBILL_API_INVOICE_ITEMS_PREFIX = "#{KILLBILL_API_PREFIX}/invoiceItems"
|
6
|
+
|
7
|
+
include KillBillClient::Model::TagHelper
|
8
|
+
include KillBillClient::Model::CustomFieldHelper
|
9
|
+
|
10
|
+
has_custom_fields KILLBILL_API_INVOICE_ITEMS_PREFIX, :invoice_item_id
|
11
|
+
has_tags KILLBILL_API_INVOICE_ITEMS_PREFIX, :invoice_item_id
|
12
|
+
|
5
13
|
has_many :audit_logs, KillBillClient::Model::AuditLog
|
6
14
|
|
15
|
+
def tags(included_deleted = false, audit = 'NONE', options = {})
|
16
|
+
params = {}
|
17
|
+
params[:accountId] = account_id
|
18
|
+
params[:includedDeleted] = included_deleted if included_deleted
|
19
|
+
params[:audit] = audit
|
20
|
+
self.class.get "#{KILLBILL_API_INVOICE_ITEMS_PREFIX}/#{invoice_item_id}/tags",
|
21
|
+
params,
|
22
|
+
options,
|
23
|
+
Tag
|
24
|
+
end
|
25
|
+
|
26
|
+
def add_tags_from_definition_ids(tag_definition_ids, user, reason, comment, options)
|
27
|
+
|
28
|
+
created_tag = self.class.post "#{KILLBILL_API_INVOICE_ITEMS_PREFIX}/#{invoice_item_id}/tags",
|
29
|
+
{},
|
30
|
+
{
|
31
|
+
:tagList => tag_definition_ids.join(',')
|
32
|
+
},
|
33
|
+
{
|
34
|
+
:user => user,
|
35
|
+
:reason => reason,
|
36
|
+
:comment => comment,
|
37
|
+
}.merge(options),
|
38
|
+
Tag
|
39
|
+
tags(false, 'NONE', options) unless created_tag.nil?
|
40
|
+
end
|
41
|
+
|
7
42
|
def create(auto_commit = false, user = nil, reason = nil, comment = nil, options = {})
|
8
43
|
created_invoice_item = self.class.post "#{Invoice::KILLBILL_API_INVOICES_PREFIX}/charges/#{account_id}",
|
9
44
|
[to_hash].to_json,
|
@@ -147,6 +147,28 @@ describe KillBillClient::Model do
|
|
147
147
|
|
148
148
|
invoice.commit 'KillBill Spec test'
|
149
149
|
|
150
|
+
# Add/Remove a invoice item tag
|
151
|
+
expect(invoice_item.tags.size).to eq(0)
|
152
|
+
invoice_item.add_tag('TEST', 'KillBill Spec test')
|
153
|
+
tags = invoice_item.tags
|
154
|
+
expect(tags.size).to eq(1)
|
155
|
+
expect(tags.first.tag_definition_name).to eq('TEST')
|
156
|
+
invoice_item.remove_tag('TEST', 'KillBill Spec test')
|
157
|
+
expect(invoice_item.tags.size).to eq(0)
|
158
|
+
|
159
|
+
# Add/Remove a invoice item custom field
|
160
|
+
expect(invoice_item.custom_fields.size).to eq(0)
|
161
|
+
custom_field = KillBillClient::Model::CustomField.new
|
162
|
+
custom_field.name = Time.now.to_i.to_s
|
163
|
+
custom_field.value = Time.now.to_i.to_s
|
164
|
+
invoice_item.add_custom_field(custom_field, 'KillBill Spec test')
|
165
|
+
custom_fields = invoice_item.custom_fields
|
166
|
+
expect(custom_fields.size).to eq(1)
|
167
|
+
expect(custom_fields.first.name).to eq(custom_field.name)
|
168
|
+
expect(custom_fields.first.value).to eq(custom_field.value)
|
169
|
+
invoice_item.remove_custom_field(custom_fields.first.custom_field_id, 'KillBill Spec test')
|
170
|
+
expect(invoice_item.custom_fields.size).to eq(0)
|
171
|
+
|
150
172
|
# Check the account balance (need to wait a bit for the payment to happen)
|
151
173
|
begin
|
152
174
|
retries ||= 0
|
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
|
+
version: 2.0.0
|
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: 2018-01-
|
11
|
+
date: 2018-01-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -80,6 +80,7 @@ files:
|
|
80
80
|
- lib/killbill_client/models/gen/admin_payment_attributes.rb
|
81
81
|
- lib/killbill_client/models/gen/audit_log_attributes.rb
|
82
82
|
- lib/killbill_client/models/gen/billing_exception_attributes.rb
|
83
|
+
- lib/killbill_client/models/gen/block_price_override_attributes.rb
|
83
84
|
- lib/killbill_client/models/gen/blocking_state_attributes.rb
|
84
85
|
- lib/killbill_client/models/gen/bulk_base_subscription_and_add_ons_attributes.rb
|
85
86
|
- lib/killbill_client/models/gen/bundle_attributes.rb
|
@@ -143,9 +144,12 @@ files:
|
|
143
144
|
- lib/killbill_client/models/gen/tenant_attributes.rb
|
144
145
|
- lib/killbill_client/models/gen/tenant_key_attributes.rb
|
145
146
|
- lib/killbill_client/models/gen/tier_attributes.rb
|
147
|
+
- lib/killbill_client/models/gen/tier_price_override_attributes.rb
|
146
148
|
- lib/killbill_client/models/gen/tiered_block_attributes.rb
|
149
|
+
- lib/killbill_client/models/gen/unit_attributes.rb
|
147
150
|
- lib/killbill_client/models/gen/unit_usage_record_attributes.rb
|
148
151
|
- lib/killbill_client/models/gen/usage_attributes.rb
|
152
|
+
- lib/killbill_client/models/gen/usage_price_override_attributes.rb
|
149
153
|
- lib/killbill_client/models/gen/usage_record_attributes.rb
|
150
154
|
- lib/killbill_client/models/gen/user_roles_attributes.rb
|
151
155
|
- lib/killbill_client/models/helpers/custom_field_helper.rb
|