killbill-client 0.7.2 → 0.7.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -13
- data/lib/killbill_client/api/api.rb +2 -2
- data/lib/killbill_client/api/errors.rb +1 -1
- data/lib/killbill_client/api/net_http_adapter.rb +21 -1
- data/lib/killbill_client/models/account.rb +60 -112
- data/lib/killbill_client/models/account_timeline.rb +1 -1
- data/lib/killbill_client/models/bundle.rb +35 -34
- data/lib/killbill_client/models/catalog.rb +34 -0
- data/lib/killbill_client/models/custom_field.rb +3 -11
- data/lib/killbill_client/models/gen/account_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/account_email_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/account_timeline_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/audit_log_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/billing_exception_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/bundle_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/bundle_timeline_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/catalog_attributes_simple.rb +3 -3
- data/lib/killbill_client/models/gen/credit_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/custom_field_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/deleted_event_subscription_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/direct_payment_attributes.rb +45 -0
- data/lib/killbill_client/models/gen/direct_transaction_attributes.rb +47 -0
- data/lib/killbill_client/models/gen/event_subscription_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/{chargeback_attributes.rb → gateway_notification_attributes.rb} +9 -12
- data/lib/killbill_client/models/gen/{refund_attributes.rb → hosted_payment_page_billing_address_attributes.rb} +10 -14
- data/lib/killbill_client/models/gen/hosted_payment_page_customer_attributes.rb +36 -0
- data/lib/killbill_client/models/gen/hosted_payment_page_fields_attributes.rb +33 -0
- data/lib/killbill_client/models/gen/hosted_payment_page_form_descriptor_attributes.rb +37 -0
- data/lib/killbill_client/models/gen/invoice_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/invoice_email_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/invoice_item_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/invoice_payment_attributes.rb +46 -0
- data/lib/killbill_client/models/gen/invoice_payment_transaction_attributes.rb +49 -0
- data/lib/killbill_client/models/gen/new_event_subscription_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/notification_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/overdue_state_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/payment_attributes.rb +11 -16
- data/lib/killbill_client/models/gen/payment_method_attributes.rb +4 -3
- data/lib/killbill_client/models/gen/payment_method_plugin_detail_attributes.rb +3 -15
- data/lib/killbill_client/models/gen/payment_transaction_attributes.rb +47 -0
- data/lib/killbill_client/models/gen/phase_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/plan_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/plan_detail_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/{payment_method_properties.rb → plugin_property_attributes.rb} +4 -4
- data/lib/killbill_client/models/gen/price_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/product_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/require_gen.rb +12 -6
- data/lib/killbill_client/models/gen/session_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/stack_trace_element_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/subject_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/subscription_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/tag_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/tag_definition_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/tenant_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/tenant_key_attributes.rb +3 -3
- data/lib/killbill_client/models/gen/usage_attributes.rb +3 -3
- data/lib/killbill_client/models/helpers/custom_field_helper.rb +51 -0
- data/lib/killbill_client/models/helpers/tag_helper.rb +112 -0
- data/lib/killbill_client/models/invoice.rb +30 -13
- data/lib/killbill_client/models/invoice_item.rb +37 -5
- data/lib/killbill_client/models/invoice_payment.rb +67 -0
- data/lib/killbill_client/models/models.rb +10 -2
- data/lib/killbill_client/models/payment.rb +5 -32
- data/lib/killbill_client/models/payment_method.rb +5 -6
- data/lib/killbill_client/models/phase.rb +9 -0
- data/lib/killbill_client/models/plan.rb +9 -0
- data/lib/killbill_client/models/plan_detail.rb +9 -0
- data/lib/killbill_client/models/product.rb +9 -0
- data/lib/killbill_client/models/resource.rb +22 -5
- data/lib/killbill_client/models/subscription.rb +28 -30
- data/lib/killbill_client/models/tag.rb +7 -11
- data/lib/killbill_client/models/tag_definition.rb +27 -6
- data/lib/killbill_client/models/transaction.rb +104 -0
- data/lib/killbill_client/version.rb +1 -1
- data/spec/killbill_client/remote/api_spec.rb +1 -1
- data/spec/killbill_client/remote/model_spec.rb +38 -23
- data/spec/killbill_client/resource_spec.rb +18 -0
- data/spec/spec_helper.rb +12 -0
- metadata +36 -19
- data/lib/killbill_client/models/chargeback.rb +0 -36
- data/lib/killbill_client/models/refund.rb +0 -55
checksums.yaml
CHANGED
@@ -1,15 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
|
5
|
-
data.tar.gz: !binary |-
|
6
|
-
OWFjNWM2ODg0Nzc2NzdkY2ZlODlmMjk4Y2NlNjMyOTZhYTgxZmUzZA==
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 80b3d840e9157936d14e02c6bcea5a1a38891745
|
4
|
+
data.tar.gz: ce8340ff3758e92bd053e3cefcee38f7daef12dc
|
7
5
|
SHA512:
|
8
|
-
metadata.gz:
|
9
|
-
|
10
|
-
MjFkMDRmMzdlYjhjOTJlODE3NGVmNWFkMzc5NGE1NDA1ZDU1NDAyNzQ2MTEx
|
11
|
-
MWU4ZWY3NDg5YjMwNDAxNDg0NWI3NWEzNjZhMjI2Njk3ZDYxN2Y=
|
12
|
-
data.tar.gz: !binary |-
|
13
|
-
ODBjZTdmYzYyY2JlNmJkMGRmNjBlODhhMWNiNDQwZjAyYmNkM2Y3MDMwNWZm
|
14
|
-
YjcwMTRlNjFiNzE2ZTE1ZDQzZTk3YTRhY2U0YjNiODg1MjAwNTgzMmY1Yjc5
|
15
|
-
ZmU5OGZhMGIzZjJhNWMxNDMzYWRhYjNiZmQzMWUwYzkwZDM0MDY=
|
6
|
+
metadata.gz: 9b105e5d734073b9d884cebbe1359bc7b865b12b9c8c806788cea6f362206cfc8d9f446d05114fa1eb500de8cad68241973e8953904303d9aad726c8919425ff
|
7
|
+
data.tar.gz: 33fb13326144ba37cd343ff56262099053c798c558cc262d5c97fcf7ecb7e3528ecb2c8868534432d551698f557086f118679492ecf4e3fa98af4183314638c9
|
@@ -57,8 +57,8 @@ module KillBillClient
|
|
57
57
|
|
58
58
|
# @return [Net::HTTPNoContent, Net::HTTPResponse]
|
59
59
|
# @raise [ResponseError] With a non-2xx status code.
|
60
|
-
def delete(uri, params = {}, options = {})
|
61
|
-
request :delete, uri, {:params => params}.merge(options)
|
60
|
+
def delete(uri, body = nil, params = {}, options = {})
|
61
|
+
request :delete, uri, {:body => body.to_s}.merge({:params => params}).merge(options)
|
62
62
|
end
|
63
63
|
|
64
64
|
# @return [URI::Generic]
|
@@ -89,7 +89,7 @@ module KillBillClient
|
|
89
89
|
# A method was attempted where it is not allowed.
|
90
90
|
#
|
91
91
|
# If this is raised, there may be a bug with the client library or with
|
92
|
-
# the server. Please contact
|
92
|
+
# the server. Please contact killbilling-users@googlegroups.com or
|
93
93
|
# {file a bug}[https://github.com/killbill/killbill-client-ruby/issues].
|
94
94
|
class MethodNotAllowed < ClientError
|
95
95
|
end
|
@@ -39,10 +39,27 @@ module KillBillClient
|
|
39
39
|
|
40
40
|
uri = base_uri + URI.escape(relative_uri)
|
41
41
|
|
42
|
+
# Plugin properties are passed in the options but we want to send them as query parameters,
|
43
|
+
# so remove with from global hash and insert them under :params
|
44
|
+
plugin_properties = options.delete :pluginProperty
|
45
|
+
if plugin_properties && plugin_properties.size > 0
|
46
|
+
options[:params][:pluginProperty] = plugin_properties.map { |p| "#{p.key}=#{p.value}"}
|
47
|
+
end
|
48
|
+
|
49
|
+
|
42
50
|
if options[:params] && !options[:params].empty?
|
43
51
|
pairs = options[:params].map { |key, value|
|
44
|
-
|
52
|
+
# If the value is an array, we 'demultiplex' into several
|
53
|
+
if value.is_a? Array
|
54
|
+
internal_pairs = value.map do |simple_value|
|
55
|
+
"#{CGI.escape key.to_s}=#{CGI.escape simple_value.to_s}"
|
56
|
+
end
|
57
|
+
internal_pairs
|
58
|
+
else
|
59
|
+
"#{CGI.escape key.to_s}=#{CGI.escape value.to_s}"
|
60
|
+
end
|
45
61
|
}
|
62
|
+
pairs.flatten!
|
46
63
|
uri += "?#{pairs.join '&'}"
|
47
64
|
end
|
48
65
|
request = METHODS[method].new uri.request_uri, head
|
@@ -64,6 +81,9 @@ module KillBillClient
|
|
64
81
|
request['Cookie'] = "JSESSIONID=#{session_id}"
|
65
82
|
end
|
66
83
|
|
84
|
+
if options[:accept]
|
85
|
+
request['Accept'] = options[:accept]
|
86
|
+
end
|
67
87
|
if options[:body]
|
68
88
|
request['Content-Type'] = content_type
|
69
89
|
request.body = options[:body]
|
@@ -2,24 +2,23 @@ module KillBillClient
|
|
2
2
|
module Model
|
3
3
|
class Account < AccountAttributes
|
4
4
|
|
5
|
-
|
5
|
+
KILLBILL_API_ACCOUNTS_PREFIX = "#{KILLBILL_API_PREFIX}/accounts"
|
6
6
|
|
7
|
-
|
8
|
-
|
9
|
-
OVERDUE_ENFORCEMENT_OFF_ID = '00000000-0000-0000-0000-000000000003'
|
10
|
-
WRITTEN_OFF_ID = '00000000-0000-0000-0000-000000000004'
|
11
|
-
MANUAL_PAY_ID = '00000000-0000-0000-0000-000000000005'
|
12
|
-
TEST_ID = '00000000-0000-0000-0000-000000000006'
|
7
|
+
include KillBillClient::Model::TagHelper
|
8
|
+
include KillBillClient::Model::CustomFieldHelper
|
13
9
|
|
14
|
-
KILLBILL_API_ACCOUNTS_PREFIX
|
10
|
+
has_custom_fields KILLBILL_API_ACCOUNTS_PREFIX, :account_id
|
11
|
+
has_tags KILLBILL_API_ACCOUNTS_PREFIX, :account_id
|
12
|
+
|
13
|
+
has_many :audit_logs, KillBillClient::Model::AuditLog
|
15
14
|
|
16
15
|
class << self
|
17
16
|
def find_in_batches(offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, options = {})
|
18
17
|
get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{Resource::KILLBILL_API_PAGINATION_PREFIX}",
|
19
18
|
{
|
20
|
-
:offset
|
21
|
-
:limit
|
22
|
-
:accountWithBalance
|
19
|
+
:offset => offset,
|
20
|
+
:limit => limit,
|
21
|
+
:accountWithBalance => with_balance,
|
23
22
|
:accountWithBalanceAndCBA => with_balance_and_cba
|
24
23
|
},
|
25
24
|
options
|
@@ -28,7 +27,7 @@ module KillBillClient
|
|
28
27
|
def find_by_id(account_id, with_balance = false, with_balance_and_cba = false, options = {})
|
29
28
|
get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}",
|
30
29
|
{
|
31
|
-
:accountWithBalance
|
30
|
+
:accountWithBalance => with_balance,
|
32
31
|
:accountWithBalanceAndCBA => with_balance_and_cba
|
33
32
|
},
|
34
33
|
options
|
@@ -37,8 +36,8 @@ module KillBillClient
|
|
37
36
|
def find_by_external_key(external_key, with_balance = false, with_balance_and_cba = false, options = {})
|
38
37
|
get "#{KILLBILL_API_ACCOUNTS_PREFIX}",
|
39
38
|
{
|
40
|
-
:externalKey
|
41
|
-
:accountWithBalance
|
39
|
+
:externalKey => external_key,
|
40
|
+
:accountWithBalance => with_balance,
|
42
41
|
:accountWithBalanceAndCBA => with_balance_and_cba
|
43
42
|
},
|
44
43
|
options
|
@@ -47,9 +46,9 @@ module KillBillClient
|
|
47
46
|
def find_in_batches_by_search_key(search_key, offset = 0, limit = 100, with_balance = false, with_balance_and_cba = false, options = {})
|
48
47
|
get "#{KILLBILL_API_ACCOUNTS_PREFIX}/search/#{search_key}",
|
49
48
|
{
|
50
|
-
:offset
|
51
|
-
:limit
|
52
|
-
:accountWithBalance
|
49
|
+
:offset => offset,
|
50
|
+
:limit => limit,
|
51
|
+
:accountWithBalance => with_balance,
|
53
52
|
:accountWithBalanceAndCBA => with_balance_and_cba
|
54
53
|
},
|
55
54
|
options
|
@@ -61,8 +60,8 @@ module KillBillClient
|
|
61
60
|
to_json,
|
62
61
|
{},
|
63
62
|
{
|
64
|
-
:user
|
65
|
-
:reason
|
63
|
+
:user => user,
|
64
|
+
:reason => reason,
|
66
65
|
:comment => comment,
|
67
66
|
}.merge(options)
|
68
67
|
created_account.refresh(options)
|
@@ -98,78 +97,6 @@ module KillBillClient
|
|
98
97
|
OverdueStateAttributes
|
99
98
|
end
|
100
99
|
|
101
|
-
def tags(audit = 'NONE', options = {})
|
102
|
-
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/tags",
|
103
|
-
{
|
104
|
-
:audit => audit
|
105
|
-
},
|
106
|
-
options,
|
107
|
-
Tag
|
108
|
-
end
|
109
|
-
|
110
|
-
def add_tag(tag_name, user = nil, reason = nil, comment = nil, options = {})
|
111
|
-
tag_definition = TagDefinition.find_by_name(tag_name, options)
|
112
|
-
if tag_definition.nil?
|
113
|
-
tag_definition = TagDefinition.new
|
114
|
-
tag_definition.name = tag_name
|
115
|
-
tag_definition.description = "Tag created for account #{@account_id}"
|
116
|
-
tag_definition = TagDefinition.create(user, options)
|
117
|
-
end
|
118
|
-
|
119
|
-
add_tag_from_definition_id(tag_definition.id, user, reason, comment, options)
|
120
|
-
end
|
121
|
-
|
122
|
-
def remove_tag(tag_name, user = nil, reason = nil, comment = nil, options = {})
|
123
|
-
tag_definition = TagDefinition.find_by_name(tag_name)
|
124
|
-
return nil if tag_definition.nil?
|
125
|
-
|
126
|
-
self.class.delete "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/tags",
|
127
|
-
{
|
128
|
-
:tagList => tag_definition.id
|
129
|
-
},
|
130
|
-
{
|
131
|
-
:user => user,
|
132
|
-
:reason => reason,
|
133
|
-
:comment => comment,
|
134
|
-
}.merge(options)
|
135
|
-
end
|
136
|
-
|
137
|
-
def custom_fields(audit = 'NONE', options = {})
|
138
|
-
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/customFields",
|
139
|
-
{
|
140
|
-
:audit => audit
|
141
|
-
},
|
142
|
-
options,
|
143
|
-
CustomField
|
144
|
-
end
|
145
|
-
|
146
|
-
def add_custom_field(custom_fields, user = nil, reason = nil, comment = nil, options = {})
|
147
|
-
body = custom_fields.is_a?(Enumerable) ? custom_fields : [custom_fields]
|
148
|
-
custom_field = self.class.post "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/customFields",
|
149
|
-
body.to_json,
|
150
|
-
{},
|
151
|
-
{
|
152
|
-
:user => user,
|
153
|
-
:reason => reason,
|
154
|
-
:comment => comment,
|
155
|
-
}.merge(options),
|
156
|
-
CustomField
|
157
|
-
custom_field.refresh(options)
|
158
|
-
end
|
159
|
-
|
160
|
-
def remove_custom_field(custom_fields, user = nil, reason = nil, comment = nil, options = {})
|
161
|
-
custom_fields_param = custom_fields.is_a?(Enumerable) ? custom_fields.join(",") : custom_fields
|
162
|
-
self.class.delete "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/customFields",
|
163
|
-
{
|
164
|
-
:customFieldList => custom_fields_param
|
165
|
-
},
|
166
|
-
{
|
167
|
-
:user => user,
|
168
|
-
:reason => reason,
|
169
|
-
:comment => comment,
|
170
|
-
}.merge(options)
|
171
|
-
end
|
172
|
-
|
173
100
|
def auto_pay_off?(options = {})
|
174
101
|
control_tag_off?(AUTO_PAY_OFF_ID, options)
|
175
102
|
end
|
@@ -198,7 +125,7 @@ module KillBillClient
|
|
198
125
|
control_tag_off?(WRITTEN_OFF_ID, options)
|
199
126
|
end
|
200
127
|
|
201
|
-
def set_written_off(
|
128
|
+
def set_written_off(user = nil, reason = nil, comment = nil, options = {})
|
202
129
|
add_tag_from_definition_id(WRITTEN_OFF_ID, user, reason, comment, options)
|
203
130
|
end
|
204
131
|
|
@@ -218,30 +145,51 @@ module KillBillClient
|
|
218
145
|
add_tag_from_definition_id(TEST_ID, user, reason, comment, options)
|
219
146
|
end
|
220
147
|
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
148
|
+
def add_email(email, user = nil, reason = nil, comment = nil, options = {})
|
149
|
+
self.class.post "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emails",
|
150
|
+
{
|
151
|
+
# TODO Required ATM
|
152
|
+
:accountId => account_id,
|
153
|
+
:email => email
|
154
|
+
}.to_json,
|
155
|
+
{},
|
156
|
+
{
|
157
|
+
:user => user,
|
158
|
+
:reason => reason,
|
159
|
+
:comment => comment,
|
160
|
+
}.merge(options)
|
161
|
+
end
|
162
|
+
|
163
|
+
def remove_email(email, user = nil, reason = nil, comment = nil, options = {})
|
164
|
+
self.class.delete "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emails/#{email}",
|
165
|
+
{},
|
166
|
+
{},
|
167
|
+
{
|
168
|
+
:user => user,
|
169
|
+
:reason => reason,
|
170
|
+
:comment => comment,
|
171
|
+
}.merge(options)
|
228
172
|
end
|
229
173
|
|
230
|
-
def
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
:user => user,
|
238
|
-
:reason => reason,
|
239
|
-
:comment => comment,
|
240
|
-
}.merge(options),
|
241
|
-
Tag
|
242
|
-
created_tag.refresh(options)
|
174
|
+
def emails(audit = 'NONE', options = {})
|
175
|
+
self.class.get "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emails",
|
176
|
+
{
|
177
|
+
:audit => audit
|
178
|
+
},
|
179
|
+
options,
|
180
|
+
AccountEmailAttributes
|
243
181
|
end
|
244
182
|
|
183
|
+
def update_email_notifications(user = nil, reason = nil, comment = nil, options = {})
|
184
|
+
self.class.put "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/emailNotifications",
|
185
|
+
to_json,
|
186
|
+
{},
|
187
|
+
{
|
188
|
+
:user => user,
|
189
|
+
:reason => reason,
|
190
|
+
:comment => comment,
|
191
|
+
}.merge(options)
|
192
|
+
end
|
245
193
|
end
|
246
194
|
end
|
247
195
|
end
|
@@ -3,7 +3,7 @@ module KillBillClient
|
|
3
3
|
class AccountTimeline < AccountTimelineAttributes
|
4
4
|
|
5
5
|
has_one :account, KillBillClient::Model::Account
|
6
|
-
has_many :payments, KillBillClient::Model::
|
6
|
+
has_many :payments, KillBillClient::Model::InvoicePayment
|
7
7
|
has_many :bundles, KillBillClient::Model::Bundle
|
8
8
|
has_many :invoices, KillBillClient::Model::Invoice
|
9
9
|
|
@@ -4,6 +4,12 @@ module KillBillClient
|
|
4
4
|
|
5
5
|
KILLBILL_API_BUNDLES_PREFIX = "#{KILLBILL_API_PREFIX}/bundles"
|
6
6
|
|
7
|
+
include KillBillClient::Model::TagHelper
|
8
|
+
include KillBillClient::Model::CustomFieldHelper
|
9
|
+
|
10
|
+
has_custom_fields KILLBILL_API_BUNDLES_PREFIX, :bundle_id
|
11
|
+
has_tags KILLBILL_API_BUNDLES_PREFIX, :bundle_id
|
12
|
+
|
7
13
|
has_many :subscriptions, KillBillClient::Model::Subscription
|
8
14
|
has_many :audit_logs, KillBillClient::Model::AuditLog
|
9
15
|
|
@@ -12,7 +18,7 @@ module KillBillClient
|
|
12
18
|
get "#{KILLBILL_API_BUNDLES_PREFIX}/#{Resource::KILLBILL_API_PAGINATION_PREFIX}",
|
13
19
|
{
|
14
20
|
:offset => offset,
|
15
|
-
:limit
|
21
|
+
:limit => limit
|
16
22
|
},
|
17
23
|
options
|
18
24
|
end
|
@@ -21,7 +27,7 @@ module KillBillClient
|
|
21
27
|
get "#{KILLBILL_API_BUNDLES_PREFIX}/search/#{search_key}",
|
22
28
|
{
|
23
29
|
:offset => offset,
|
24
|
-
:limit
|
30
|
+
:limit => limit
|
25
31
|
},
|
26
32
|
options
|
27
33
|
end
|
@@ -48,57 +54,52 @@ module KillBillClient
|
|
48
54
|
|
49
55
|
end
|
50
56
|
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
params = {}
|
57
|
+
# Transfer the bundle to the new account. The new account_id should be set in this object
|
58
|
+
def transfer(requested_date = nil, billing_policy = nil, user = nil, reason = nil, comment = nil, options = {})
|
59
|
+
params = {}
|
56
60
|
params[:requestedDate] = requested_date unless requested_date.nil?
|
57
61
|
params[:billingPolicy] = billing_policy unless billing_policy.nil?
|
58
|
-
result
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
62
|
+
result = self.class.put "#{KILLBILL_API_BUNDLES_PREFIX}/#{bundle_id}",
|
63
|
+
to_json,
|
64
|
+
params,
|
65
|
+
{
|
66
|
+
:user => user,
|
67
|
+
:reason => reason,
|
68
|
+
:comment => comment,
|
69
|
+
}.merge(options)
|
66
70
|
|
67
71
|
result.refresh(options)
|
68
72
|
end
|
69
73
|
|
70
|
-
|
71
74
|
# Pause the bundle (and all its subscription)
|
72
75
|
def pause(requested_date = nil, user = nil, reason = nil, comment = nil, options = {})
|
73
76
|
|
74
|
-
params
|
77
|
+
params = {}
|
75
78
|
params[:requestedDate] = requested_date unless requested_date.nil?
|
76
79
|
self.class.put "#{KILLBILL_API_BUNDLES_PREFIX}/#{@bundle_id}/pause",
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
80
|
+
{},
|
81
|
+
params,
|
82
|
+
{
|
83
|
+
:user => user,
|
84
|
+
:reason => reason,
|
85
|
+
:comment => comment,
|
86
|
+
}.merge(options)
|
84
87
|
end
|
85
88
|
|
86
|
-
|
87
89
|
# Resume the bundle (and all its subscription)
|
88
90
|
def resume(requested_date = nil, user = nil, reason = nil, comment = nil, options = {})
|
89
91
|
|
90
|
-
params
|
92
|
+
params = {}
|
91
93
|
params[:requestedDate] = requested_date unless requested_date.nil?
|
92
94
|
self.class.put "#{KILLBILL_API_BUNDLES_PREFIX}/#{@bundle_id}/resume",
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
95
|
+
{},
|
96
|
+
params,
|
97
|
+
{
|
98
|
+
:user => user,
|
99
|
+
:reason => reason,
|
100
|
+
:comment => comment,
|
101
|
+
}.merge(options)
|
100
102
|
end
|
101
|
-
|
102
103
|
end
|
103
104
|
end
|
104
105
|
end
|
@@ -0,0 +1,34 @@
|
|
1
|
+
module KillBillClient
|
2
|
+
module Model
|
3
|
+
class Catalog < CatalogAttributesSimple
|
4
|
+
|
5
|
+
has_many :products, KillBillClient::Model::Product
|
6
|
+
|
7
|
+
KILLBILL_API_CATALOG_PREFIX = "#{KILLBILL_API_PREFIX}/catalog"
|
8
|
+
|
9
|
+
class << self
|
10
|
+
def simple_catalog(options = {})
|
11
|
+
get "#{KILLBILL_API_CATALOG_PREFIX}/simpleCatalog",
|
12
|
+
{},
|
13
|
+
options
|
14
|
+
end
|
15
|
+
|
16
|
+
def available_addons(base_product_name, options = {})
|
17
|
+
get "#{KILLBILL_API_CATALOG_PREFIX}/availableAddons",
|
18
|
+
{
|
19
|
+
:baseProductName => base_product_name
|
20
|
+
},
|
21
|
+
options,
|
22
|
+
PlanDetail
|
23
|
+
end
|
24
|
+
|
25
|
+
def available_base_plans(options = {})
|
26
|
+
get "#{KILLBILL_API_CATALOG_PREFIX}/availableBasePlans",
|
27
|
+
{},
|
28
|
+
options,
|
29
|
+
PlanDetail
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
@@ -1,25 +1,17 @@
|
|
1
1
|
module KillBillClient
|
2
2
|
module Model
|
3
3
|
class CustomField < CustomFieldAttributes
|
4
|
+
|
4
5
|
KILLBILL_API_CUSTOM_FIELDS_PREFIX = "#{KILLBILL_API_PREFIX}/customFields"
|
5
6
|
|
6
7
|
has_many :audit_logs, KillBillClient::Model::AuditLog
|
7
8
|
|
8
9
|
class << self
|
9
|
-
def find_all_by_account_id(account_id, included_deleted = false, audit = "NONE", options = {})
|
10
|
-
get "#{Account::KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}/customFields",
|
11
|
-
{
|
12
|
-
:includedDeleted => included_deleted,
|
13
|
-
:audit => audit
|
14
|
-
},
|
15
|
-
options
|
16
|
-
end
|
17
|
-
|
18
10
|
def find_in_batches(offset = 0, limit = 100, options = {})
|
19
11
|
get "#{KILLBILL_API_CUSTOM_FIELDS_PREFIX}/#{Resource::KILLBILL_API_PAGINATION_PREFIX}",
|
20
12
|
{
|
21
13
|
:offset => offset,
|
22
|
-
:limit
|
14
|
+
:limit => limit
|
23
15
|
},
|
24
16
|
options
|
25
17
|
end
|
@@ -28,7 +20,7 @@ module KillBillClient
|
|
28
20
|
get "#{KILLBILL_API_CUSTOM_FIELDS_PREFIX}/search/#{search_key}",
|
29
21
|
{
|
30
22
|
:offset => offset,
|
31
|
-
:limit
|
23
|
+
:limit => limit
|
32
24
|
},
|
33
25
|
options
|
34
26
|
end
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Copyright 2010-2013 Ning, Inc. #
|
4
4
|
# Copyright 2014 The Billing Project, LLC #
|
5
5
|
# #
|
6
|
-
#
|
7
|
-
# (the "License"); you may not use this file except in
|
8
|
-
# License. You may obtain a copy of the License at:
|
6
|
+
# The Billing Project licenses this file to you under the Apache License, #
|
7
|
+
# version 2.0 (the "License"); you may not use this file except in #
|
8
|
+
# compliance with the License. You may obtain a copy of the License at: #
|
9
9
|
# #
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
11
|
# #
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Copyright 2010-2013 Ning, Inc. #
|
4
4
|
# Copyright 2014 The Billing Project, LLC #
|
5
5
|
# #
|
6
|
-
#
|
7
|
-
# (the "License"); you may not use this file except in
|
8
|
-
# License. You may obtain a copy of the License at:
|
6
|
+
# The Billing Project licenses this file to you under the Apache License, #
|
7
|
+
# version 2.0 (the "License"); you may not use this file except in #
|
8
|
+
# compliance with the License. You may obtain a copy of the License at: #
|
9
9
|
# #
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
11
|
# #
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Copyright 2010-2013 Ning, Inc. #
|
4
4
|
# Copyright 2014 The Billing Project, LLC #
|
5
5
|
# #
|
6
|
-
#
|
7
|
-
# (the "License"); you may not use this file except in
|
8
|
-
# License. You may obtain a copy of the License at:
|
6
|
+
# The Billing Project licenses this file to you under the Apache License, #
|
7
|
+
# version 2.0 (the "License"); you may not use this file except in #
|
8
|
+
# compliance with the License. You may obtain a copy of the License at: #
|
9
9
|
# #
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
11
|
# #
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Copyright 2010-2013 Ning, Inc. #
|
4
4
|
# Copyright 2014 The Billing Project, LLC #
|
5
5
|
# #
|
6
|
-
#
|
7
|
-
# (the "License"); you may not use this file except in
|
8
|
-
# License. You may obtain a copy of the License at:
|
6
|
+
# The Billing Project licenses this file to you under the Apache License, #
|
7
|
+
# version 2.0 (the "License"); you may not use this file except in #
|
8
|
+
# compliance with the License. You may obtain a copy of the License at: #
|
9
9
|
# #
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
11
|
# #
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Copyright 2010-2013 Ning, Inc. #
|
4
4
|
# Copyright 2014 The Billing Project, LLC #
|
5
5
|
# #
|
6
|
-
#
|
7
|
-
# (the "License"); you may not use this file except in
|
8
|
-
# License. You may obtain a copy of the License at:
|
6
|
+
# The Billing Project licenses this file to you under the Apache License, #
|
7
|
+
# version 2.0 (the "License"); you may not use this file except in #
|
8
|
+
# compliance with the License. You may obtain a copy of the License at: #
|
9
9
|
# #
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
11
|
# #
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Copyright 2010-2013 Ning, Inc. #
|
4
4
|
# Copyright 2014 The Billing Project, LLC #
|
5
5
|
# #
|
6
|
-
#
|
7
|
-
# (the "License"); you may not use this file except in
|
8
|
-
# License. You may obtain a copy of the License at:
|
6
|
+
# The Billing Project licenses this file to you under the Apache License, #
|
7
|
+
# version 2.0 (the "License"); you may not use this file except in #
|
8
|
+
# compliance with the License. You may obtain a copy of the License at: #
|
9
9
|
# #
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
11
|
# #
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Copyright 2010-2013 Ning, Inc. #
|
4
4
|
# Copyright 2014 The Billing Project, LLC #
|
5
5
|
# #
|
6
|
-
#
|
7
|
-
# (the "License"); you may not use this file except in
|
8
|
-
# License. You may obtain a copy of the License at:
|
6
|
+
# The Billing Project licenses this file to you under the Apache License, #
|
7
|
+
# version 2.0 (the "License"); you may not use this file except in #
|
8
|
+
# compliance with the License. You may obtain a copy of the License at: #
|
9
9
|
# #
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
11
|
# #
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Copyright 2010-2013 Ning, Inc. #
|
4
4
|
# Copyright 2014 The Billing Project, LLC #
|
5
5
|
# #
|
6
|
-
#
|
7
|
-
# (the "License"); you may not use this file except in
|
8
|
-
# License. You may obtain a copy of the License at:
|
6
|
+
# The Billing Project licenses this file to you under the Apache License, #
|
7
|
+
# version 2.0 (the "License"); you may not use this file except in #
|
8
|
+
# compliance with the License. You may obtain a copy of the License at: #
|
9
9
|
# #
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
11
|
# #
|
@@ -3,9 +3,9 @@
|
|
3
3
|
# Copyright 2010-2013 Ning, Inc. #
|
4
4
|
# Copyright 2014 The Billing Project, LLC #
|
5
5
|
# #
|
6
|
-
#
|
7
|
-
# (the "License"); you may not use this file except in
|
8
|
-
# License. You may obtain a copy of the License at:
|
6
|
+
# The Billing Project licenses this file to you under the Apache License, #
|
7
|
+
# version 2.0 (the "License"); you may not use this file except in #
|
8
|
+
# compliance with the License. You may obtain a copy of the License at: #
|
9
9
|
# #
|
10
10
|
# http://www.apache.org/licenses/LICENSE-2.0 #
|
11
11
|
# #
|