killbill-client 1.3.0 → 1.4.0

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
  SHA1:
3
- metadata.gz: 2512da879d4f319ad4af8d1aac0b582555f60e35
4
- data.tar.gz: 197bd8838c6f587c9f26e69dbcb592fd6af58abc
3
+ metadata.gz: f2ef126812dd995a0279bb40b3e5ebcbd8f6e846
4
+ data.tar.gz: 86db64653e7e29ae21541b4241dfcf01ee5de169
5
5
  SHA512:
6
- metadata.gz: 9b24bd772578a41897e64745782c4ee2a338bb150b8dd8df92a54cb268ff65898a961f6adff564a9726165c4b01562763651d12c61a3eb7473b1bddce7f3d497
7
- data.tar.gz: 73a8bcf6a96865889e2efcb8de9fe67e37d7428d31159f62c6d740c8fcdc7bbb1791c9b1522fe82e14d0e5a6252aa14264c1c416da9860b9c95f4ebacb25f15a
6
+ metadata.gz: 9b738f3f54f9d508126f79c0da7b962c87b2034524d38597dd9c68100b54b870dae165ca3a1584feb6e6dfd143bbb807b8a8e025a6df540b9dca53a55097f48e
7
+ data.tar.gz: 22dc8d5c9d4bd13fff971e20913be2e3a5a67fe150623c3cdeb6f44ff3aa8c9b10a870a0ba990c3ed87ae05eddd31e93189f00315e106ec3f352758a8f2a8684
@@ -76,7 +76,9 @@ module KillBillClient
76
76
  head.update options[:head] if options[:head]
77
77
  head.delete_if { |_, value| value.nil? }
78
78
 
79
- if URI(relative_uri).scheme.nil?
79
+ # Need to encode in case of spaces (e.g. /1.0/kb/security/users/Mad Max/roles)
80
+ encoded_relative_uri = URI.encode(relative_uri)
81
+ if URI(encoded_relative_uri).scheme.nil?
80
82
  uri = (options[:base_uri] || base_uri)
81
83
  uri = URI.parse(uri) unless uri.is_a?(URI)
82
84
  # Note: make sure to keep the full path (if any) from URI::HTTP, for non-ROOT deployments
@@ -84,7 +86,7 @@ module KillBillClient
84
86
  base_path = uri.request_uri == '/' ? '' : uri.request_uri
85
87
  uri += (base_path + URI::DEFAULT_PARSER.escape(relative_uri))
86
88
  else
87
- uri = relative_uri
89
+ uri = encoded_relative_uri
88
90
  uri = URI.parse(uri) unless uri.is_a?(URI)
89
91
  end
90
92
  uri += encode_params(options).to_s
@@ -67,10 +67,14 @@ module KillBillClient
67
67
  created_account.refresh(options)
68
68
  end
69
69
 
70
- def update(user = nil, reason = nil, comment = nil, options = {})
70
+ def update(treat_null_as_reset = false, user = nil, reason = nil, comment = nil, options = {})
71
+
72
+ params = {}
73
+ params[:treatNullAsReset] = treat_null_as_reset
74
+
71
75
  updated_account = self.class.put "#{KILLBILL_API_ACCOUNTS_PREFIX}/#{account_id}",
72
76
  to_json,
73
- {},
77
+ params,
74
78
  {
75
79
  :user => user,
76
80
  :reason => reason,
@@ -37,6 +37,12 @@ module KillBillClient
37
37
  :comment => comment,
38
38
  }.merge(options)
39
39
  end
40
+
41
+ def list(options = {})
42
+ self.class.get "#{Security::KILLBILL_API_SECURITY_PREFIX}/users/#{username}/roles",
43
+ {},
44
+ {}.merge(options)
45
+ end
40
46
  end
41
47
  end
42
48
  end
@@ -1,7 +1,7 @@
1
1
  module KillBillClient
2
2
  module Version
3
3
  MAJOR = 1
4
- MINOR = 3
4
+ MINOR = 4
5
5
  PATCH = 0
6
6
  PRE = nil
7
7
 
@@ -20,7 +20,7 @@ describe KillBillClient::Model do
20
20
  account.city = 'SnakeCase'
21
21
  account.state = 'Awesome'
22
22
  account.country = 'LalaLand'
23
- account.locale = 'FR_fr'
23
+ account.locale = 'fr_FR'
24
24
  account.is_notified_for_invoices = false
25
25
  expect(account.account_id).to be_nil
26
26
 
@@ -35,6 +35,10 @@ describe KillBillClient::Model do
35
35
  expect(account.external_key).to eq(external_key)
36
36
  expect(account.payment_method_id).to be_nil
37
37
 
38
+ # Update account
39
+ account.name = 'Kill Bill Client'
40
+ account.update(false, 'KillBill Spec test')
41
+
38
42
  # Try to retrieve it
39
43
  account = KillBillClient::Model::Account.find_by_external_key external_key
40
44
  expect(account.account_id).to eq(account_id)
@@ -143,10 +147,19 @@ describe KillBillClient::Model do
143
147
 
144
148
  invoice.commit 'KillBill Spec test'
145
149
 
146
- # Check the account balance
147
- account = KillBillClient::Model::Account.find_by_id account.account_id, true
148
- expect(account.account_balance).to eq(0)
149
-
150
+ # Check the account balance (need to wait a bit for the payment to happen)
151
+ begin
152
+ retries ||= 0
153
+ sleep(0.1) if retries > 0
154
+ account = KillBillClient::Model::Account.find_by_id account.account_id, true
155
+ expect(account.account_balance).to eq(0)
156
+ rescue => e
157
+ if (retries += 1) < 3
158
+ retry
159
+ else
160
+ raise e
161
+ end
162
+ end
150
163
 
151
164
  KillBillClient::Model::PaymentMethod.destroy(pm.payment_method_id, true, true, 'KillBill Spec test')
152
165
 
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: 1.3.0
4
+ version: 1.4.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: 2017-01-10 00:00:00.000000000 Z
11
+ date: 2017-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement