killbill-client 0.10.5 → 0.10.6
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/catalog.rb +4 -6
- data/lib/killbill_client/models/invoice.rb +16 -18
- data/lib/killbill_client/models/overdue.rb +6 -0
- data/lib/killbill_client/models/resource.rb +103 -94
- data/lib/killbill_client/models/tenant.rb +7 -9
- data/lib/killbill_client/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0bd357f949dbce5ad4dd1324014a786f49542582
|
4
|
+
data.tar.gz: 6e42622b6f4cf94f8e5fcb6db1ad27ec5d1146b8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 527d3f8621051a3ee35e0c464490bf2042ac0aecf8edcb882e45f9b8648eb0a59f11ea94dd09edcb3aa7f600b8dba90a322c409aad67f9260acb3b5261811879
|
7
|
+
data.tar.gz: a4346e0938adac5c102387423f3d3a6f8e78ffb15182ed0c63198a6efb9d871b34c395b5c4b6e2adc34ee822fbef28c7b8f987a971b013ca6bf76de2adba4244
|
@@ -30,9 +30,8 @@ module KillBillClient
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def get_tenant_catalog(options = {})
|
33
|
-
|
34
|
-
|
35
|
-
end
|
33
|
+
|
34
|
+
require_multi_tenant_options!(options, "Retrieving a catalog is only supported in multi-tenant mode")
|
36
35
|
|
37
36
|
get KILLBILL_API_CATALOG_PREFIX,
|
38
37
|
{},
|
@@ -42,9 +41,8 @@ module KillBillClient
|
|
42
41
|
end
|
43
42
|
|
44
43
|
def upload_tenant_catalog(catalog_xml, user = nil, reason = nil, comment = nil, options = {})
|
45
|
-
|
46
|
-
|
47
|
-
end
|
44
|
+
|
45
|
+
require_multi_tenant_options!(options, "Uploading a catalog is only supported in multi-tenant mode")
|
48
46
|
|
49
47
|
post KILLBILL_API_CATALOG_PREFIX,
|
50
48
|
catalog_xml,
|
@@ -193,9 +193,9 @@ module KillBillClient
|
|
193
193
|
|
194
194
|
|
195
195
|
def get_invoice_template(is_manual_pay, options = {})
|
196
|
-
|
197
|
-
|
198
|
-
|
196
|
+
|
197
|
+
require_multi_tenant_options!(options, "Retrieving an invoice template supported in multi-tenant mode")
|
198
|
+
|
199
199
|
|
200
200
|
get "#{KILLBILL_API_INVOICES_PREFIX}/#{is_manual_pay ? "manualPayTemplate" : "template"}",
|
201
201
|
{},
|
@@ -205,9 +205,9 @@ module KillBillClient
|
|
205
205
|
end
|
206
206
|
|
207
207
|
def upload_invoice_template(invoice_template, is_manual_pay, delete_if_exists, user = nil, reason = nil, comment = nil, options = {})
|
208
|
-
|
209
|
-
|
210
|
-
|
208
|
+
|
209
|
+
require_multi_tenant_options!(options, "Uploading a invoice template is only supported in multi-tenant mode")
|
210
|
+
|
211
211
|
|
212
212
|
params = {}
|
213
213
|
params[:deleteIfExists] = delete_if_exists if delete_if_exists
|
@@ -226,9 +226,9 @@ module KillBillClient
|
|
226
226
|
end
|
227
227
|
|
228
228
|
def get_invoice_translation(locale, options = {})
|
229
|
-
|
230
|
-
|
231
|
-
|
229
|
+
|
230
|
+
require_multi_tenant_options!(options, "Retrieving an invoice translation supported in multi-tenant mode")
|
231
|
+
|
232
232
|
|
233
233
|
get "#{KILLBILL_API_INVOICES_PREFIX}/translation/#{locale}",
|
234
234
|
{},
|
@@ -238,9 +238,9 @@ module KillBillClient
|
|
238
238
|
end
|
239
239
|
|
240
240
|
def upload_invoice_translation(invoice_translation, locale, delete_if_exists, user = nil, reason = nil, comment = nil, options = {})
|
241
|
-
|
242
|
-
|
243
|
-
|
241
|
+
|
242
|
+
require_multi_tenant_options!(options, "Uploading a invoice translation is only supported in multi-tenant mode")
|
243
|
+
|
244
244
|
|
245
245
|
params = {}
|
246
246
|
params[:deleteIfExists] = delete_if_exists if delete_if_exists
|
@@ -260,9 +260,8 @@ module KillBillClient
|
|
260
260
|
|
261
261
|
|
262
262
|
def get_catalog_translation(locale, options = {})
|
263
|
-
|
264
|
-
|
265
|
-
end
|
263
|
+
|
264
|
+
require_multi_tenant_options!(options, "Retrieving a catalog translation is only supported in multi-tenant mode")
|
266
265
|
|
267
266
|
get "#{KILLBILL_API_INVOICES_PREFIX}/catalogTranslation/#{locale}",
|
268
267
|
{},
|
@@ -272,9 +271,8 @@ module KillBillClient
|
|
272
271
|
end
|
273
272
|
|
274
273
|
def upload_catalog_translation(catalog_translation, locale, delete_if_exists, user = nil, reason = nil, comment = nil, options = {})
|
275
|
-
|
276
|
-
|
277
|
-
end
|
274
|
+
|
275
|
+
require_multi_tenant_options!(options, "Uploading a catalog translation is only supported in multi-tenant mode")
|
278
276
|
|
279
277
|
params = {}
|
280
278
|
params[:deleteIfExists] = delete_if_exists if delete_if_exists
|
@@ -6,6 +6,9 @@ module KillBillClient
|
|
6
6
|
|
7
7
|
class << self
|
8
8
|
def get_tenant_overdue_config(options = {})
|
9
|
+
|
10
|
+
require_multi_tenant_options!(options, "Retrieving an overdue config is only supported in multi-tenant mode")
|
11
|
+
|
9
12
|
get KILLBILL_API_OVERDUE_PREFIX,
|
10
13
|
{},
|
11
14
|
{
|
@@ -14,6 +17,9 @@ module KillBillClient
|
|
14
17
|
end
|
15
18
|
|
16
19
|
def upload_tenant_overdue_config(overdue_config_xml, user = nil, reason = nil, comment = nil, options = {})
|
20
|
+
|
21
|
+
require_multi_tenant_options!(options, "Uploading an overdue config is only supported in multi-tenant mode")
|
22
|
+
|
17
23
|
post KILLBILL_API_OVERDUE_PREFIX,
|
18
24
|
overdue_config_xml,
|
19
25
|
{
|
@@ -17,7 +17,7 @@ module KillBillClient
|
|
17
17
|
def initialize(hash = nil)
|
18
18
|
# Make sure we support ActiveSupport::HashWithIndifferentAccess for Kaui
|
19
19
|
if hash.respond_to?(:each)
|
20
|
-
hash.each do |key,value|
|
20
|
+
hash.each do |key, value|
|
21
21
|
send("#{Utils.underscore key.to_s}=", value)
|
22
22
|
end
|
23
23
|
end
|
@@ -62,7 +62,7 @@ module KillBillClient
|
|
62
62
|
when %r{application/pdf}
|
63
63
|
response.body
|
64
64
|
when %r{text/html}
|
65
|
-
|
65
|
+
response.body
|
66
66
|
when %r{text/plain}
|
67
67
|
response.body
|
68
68
|
when %r{application/xml}
|
@@ -168,96 +168,105 @@ module KillBillClient
|
|
168
168
|
attributes = self.instance_variable_get('@json_attributes')
|
169
169
|
|
170
170
|
(
|
171
|
-
|
172
|
-
|
173
|
-
|
174
|
-
|
175
|
-
|
176
|
-
|
177
|
-
|
178
|
-
|
179
|
-
|
180
|
-
|
181
|
-
|
182
|
-
|
183
|
-
|
184
|
-
|
185
|
-
|
186
|
-
|
187
|
-
|
188
|
-
|
189
|
-
|
190
|
-
|
191
|
-
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
|
198
|
-
|
199
|
-
|
200
|
-
|
201
|
-
|
202
|
-
|
203
|
-
|
204
|
-
|
205
|
-
|
206
|
-
|
207
|
-
|
208
|
-
|
209
|
-
|
210
|
-
|
211
|
-
|
212
|
-
|
213
|
-
|
214
|
-
|
215
|
-
|
216
|
-
|
217
|
-
|
218
|
-
|
219
|
-
|
220
|
-
|
221
|
-
|
222
|
-
|
223
|
-
|
224
|
-
|
225
|
-
|
226
|
-
|
227
|
-
|
228
|
-
|
229
|
-
|
230
|
-
|
231
|
-
|
232
|
-
|
233
|
-
|
234
|
-
|
235
|
-
|
236
|
-
|
237
|
-
|
238
|
-
|
239
|
-
|
240
|
-
|
241
|
-
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
-
|
246
|
-
|
247
|
-
|
248
|
-
|
249
|
-
|
250
|
-
|
251
|
-
|
252
|
-
|
253
|
-
|
254
|
-
|
255
|
-
|
256
|
-
|
257
|
-
|
258
|
-
|
259
|
-
|
260
|
-
|
171
|
+
class << self;
|
172
|
+
self
|
173
|
+
end).send(:define_method, :json_attributes) do
|
174
|
+
attributes
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
def has_many(attr_name, type = nil)
|
179
|
+
send("attr_accessor", attr_name.to_sym)
|
180
|
+
|
181
|
+
#add it to attribute_names
|
182
|
+
@@attribute_names[self.name] = {} unless @@attribute_names[self.name]
|
183
|
+
@@attribute_names[self.name][attr_name.to_sym] = {:type => type, :cardinality => :many}
|
184
|
+
end
|
185
|
+
|
186
|
+
def has_one(attr_name, type = nil)
|
187
|
+
send("attr_accessor", attr_name.to_sym)
|
188
|
+
|
189
|
+
#add it to attribute_names
|
190
|
+
@@attribute_names[self.name] = {} unless @@attribute_names[self.name]
|
191
|
+
@@attribute_names[self.name][attr_name.to_sym] = {:type => type, :cardinality => :one}
|
192
|
+
end
|
193
|
+
|
194
|
+
#hack to cater the api return attributes and javax attributes without editing gen scripts
|
195
|
+
#call only after its declared as a instance_method using attr_accessor
|
196
|
+
def create_alias(new_name, old_name)
|
197
|
+
alias_method new_name.to_sym, old_name.to_sym #getter
|
198
|
+
alias_method "#{new_name}=".to_sym, "#{old_name}=".to_sym #setter
|
199
|
+
end
|
200
|
+
|
201
|
+
# Extract the session id from a response
|
202
|
+
def extract_session_id(response)
|
203
|
+
# The Set-Cookie header looks like
|
204
|
+
# "set-cookie"=>["JSESSIONID=16; Path=/; HttpOnly", "rememberMe=deleteMe; Path=/; Max-Age=0; Expires=Sat, 17-Aug-2013 23:39:37 GMT"],
|
205
|
+
session_cookie = response['set-cookie']
|
206
|
+
unless session_cookie.nil?
|
207
|
+
session_cookie.split(';').each do |chunk|
|
208
|
+
chunk.strip!
|
209
|
+
key, value = chunk.split('=')
|
210
|
+
return value if key == 'JSESSIONID'
|
211
|
+
end
|
212
|
+
end
|
213
|
+
nil
|
214
|
+
end
|
215
|
+
end #end self methods
|
216
|
+
|
217
|
+
# Set on create call
|
218
|
+
attr_accessor :uri
|
219
|
+
|
220
|
+
def to_hash
|
221
|
+
json_hash = {}
|
222
|
+
self.class.json_attributes.each do |name|
|
223
|
+
value = self.send(name)
|
224
|
+
unless value.nil?
|
225
|
+
json_hash[Utils.camelize name, :lower] = _to_hash(value)
|
226
|
+
end
|
227
|
+
end
|
228
|
+
json_hash
|
229
|
+
end
|
230
|
+
|
231
|
+
def _to_hash(value)
|
232
|
+
if value.is_a?(Resource)
|
233
|
+
value.to_hash
|
234
|
+
elsif value.is_a?(Array)
|
235
|
+
value.map { |v| _to_hash(v) }
|
236
|
+
else
|
237
|
+
value
|
238
|
+
end
|
239
|
+
end
|
240
|
+
|
241
|
+
def to_json(*args)
|
242
|
+
to_hash.to_json(*args)
|
243
|
+
end
|
244
|
+
|
245
|
+
def refresh(options = {}, clazz=self.class)
|
246
|
+
if @uri
|
247
|
+
self.class.get @uri, {}, options, clazz
|
248
|
+
else
|
249
|
+
self
|
250
|
+
end
|
251
|
+
end
|
252
|
+
|
253
|
+
|
254
|
+
def require_multi_tenant_options!(options, msg)
|
255
|
+
if options[:api_key].nil? || options[:api_secret].nil?
|
256
|
+
raise ArgumentError, msg
|
257
|
+
end
|
258
|
+
end
|
259
|
+
|
260
|
+
|
261
|
+
def ==(o)
|
262
|
+
o.class == self.class && o.hash == hash
|
263
|
+
end
|
264
|
+
|
265
|
+
alias_method :eql?, :==
|
266
|
+
|
267
|
+
def hash
|
268
|
+
to_hash.hash
|
269
|
+
end
|
261
270
|
end
|
262
|
-
|
263
|
-
|
271
|
+
end
|
272
|
+
end
|
@@ -19,9 +19,8 @@ module KillBillClient
|
|
19
19
|
end
|
20
20
|
|
21
21
|
def get_tenant_plugin_config(plugin_name, options = {})
|
22
|
-
|
23
|
-
|
24
|
-
end
|
22
|
+
|
23
|
+
require_multi_tenant_options!(options, "Retrieving a plugin config is only supported in multi-tenant mode")
|
25
24
|
|
26
25
|
uri = KILLBILL_API_TENANTS_PREFIX + "/uploadPluginConfig/" + plugin_name
|
27
26
|
get uri,
|
@@ -32,9 +31,8 @@ module KillBillClient
|
|
32
31
|
end
|
33
32
|
|
34
33
|
def upload_tenant_plugin_config(plugin_name, plugin_config, user = nil, reason = nil, comment = nil, options = {})
|
35
|
-
|
36
|
-
|
37
|
-
end
|
34
|
+
|
35
|
+
require_multi_tenant_options!(options, "Uploading a plugin config is only supported in multi-tenant mode")
|
38
36
|
|
39
37
|
uri = KILLBILL_API_TENANTS_PREFIX + "/uploadPluginConfig/" + plugin_name
|
40
38
|
post uri,
|
@@ -51,9 +49,8 @@ module KillBillClient
|
|
51
49
|
end
|
52
50
|
|
53
51
|
def delete_tenant_plugin_config(plugin_name, user = nil, reason = nil, comment = nil, options = {})
|
54
|
-
|
55
|
-
|
56
|
-
end
|
52
|
+
|
53
|
+
require_multi_tenant_options!(options, "Uploading a plugin config is only supported in multi-tenant mode")
|
57
54
|
|
58
55
|
uri = KILLBILL_API_TENANTS_PREFIX + "/uploadPluginConfig/" + plugin_name
|
59
56
|
delete uri,
|
@@ -68,6 +65,7 @@ module KillBillClient
|
|
68
65
|
}.merge(options)
|
69
66
|
|
70
67
|
end
|
68
|
+
|
71
69
|
end
|
72
70
|
|
73
71
|
|