killbill-client 2.2.0 → 2.2.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5fa87a6246a9c682976375f3e29fb18c0eeef1c3
4
- data.tar.gz: f3aaea13d0f68ffbc516b7213d7de4053a56228f
3
+ metadata.gz: 44af1bd991b778b064fef43d2267e75b834ffe01
4
+ data.tar.gz: e51ee0a3a893b671cf8132e989d984779f32397a
5
5
  SHA512:
6
- metadata.gz: e38d75f004f707a4684213ecc3b52da47913754beecffca0f009a633cbbfcbdabcb0d14d6c5076cf6a7124f3f938684e820cc6c7122ed6d5313a8815bfa77c5c
7
- data.tar.gz: c186cfce4f402bbfbfdd78917aeda1b0761d28874f32dbbe96f48b15d27cd3ef9918edcf262eaa8ab55003edf9f6110f60b51f58450fdbc3f8c9c3099472b022
6
+ metadata.gz: e1b6517848128aeebefbb610fcdb5918e4fef7de7ef6138f45a5b4323464b82a456dc7d053e3990f143aa96ea3e85b0f47b649e774785fb3bd07d85e1359ed12
7
+ data.tar.gz: b2f7d36bf61d137218de09f8aae734ff13ada57cf9e73e171295e892d1b64d1ecdc7acba8f8476e7d664f7ce30eb3eb778fbad3638bc617db960b5d8507723f1
data/.circleci/config.yml CHANGED
@@ -8,7 +8,7 @@ jobs:
8
8
  build-jruby-1.7.26:
9
9
  <<: *defaults
10
10
  docker:
11
- - image: killbill/kbbuild:0.2.0
11
+ - image: killbill/kbbuild:0.4.0
12
12
  steps:
13
13
  - checkout
14
14
  - restore_cache:
@@ -27,8 +27,8 @@ jobs:
27
27
  test-mysql-jruby-1.7.26:
28
28
  <<: *defaults
29
29
  docker:
30
- - image: killbill/kbbuild:0.2.0
31
- - image: killbill/killbill:0.19.2
30
+ - image: killbill/kbbuild:0.4.0
31
+ - image: killbill/killbill:0.19.6
32
32
  - image: killbill/mariadb:0.19
33
33
  environment:
34
34
  - MYSQL_ROOT_PASSWORD=root
@@ -88,7 +88,7 @@ jobs:
88
88
  build-ruby-2.2.2:
89
89
  <<: *defaults
90
90
  docker:
91
- - image: killbill/kbbuild:0.2.0
91
+ - image: killbill/kbbuild:0.4.0
92
92
  steps:
93
93
  - checkout
94
94
  - restore_cache:
@@ -109,8 +109,8 @@ jobs:
109
109
  test-mysql-ruby-2.2.2:
110
110
  <<: *defaults
111
111
  docker:
112
- - image: killbill/kbbuild:0.2.0
113
- - image: killbill/killbill:0.19.2
112
+ - image: killbill/kbbuild:0.4.0
113
+ - image: killbill/killbill:0.19.6
114
114
  - image: killbill/mariadb:0.19
115
115
  environment:
116
116
  - MYSQL_ROOT_PASSWORD=root
@@ -172,7 +172,7 @@ jobs:
172
172
  build-ruby-2.4.2:
173
173
  <<: *defaults
174
174
  docker:
175
- - image: killbill/kbbuild:0.2.0
175
+ - image: killbill/kbbuild:0.4.0
176
176
  steps:
177
177
  - checkout
178
178
  - restore_cache:
@@ -193,8 +193,8 @@ jobs:
193
193
  test-mysql-ruby-2.4.2:
194
194
  <<: *defaults
195
195
  docker:
196
- - image: killbill/kbbuild:0.2.0
197
- - image: killbill/killbill:0.19.2
196
+ - image: killbill/kbbuild:0.4.0
197
+ - image: killbill/killbill:0.19.6
198
198
  - image: killbill/mariadb:0.19
199
199
  environment:
200
200
  - MYSQL_ROOT_PASSWORD=root
@@ -256,7 +256,7 @@ jobs:
256
256
  build-jruby-9.1.14.0:
257
257
  <<: *defaults
258
258
  docker:
259
- - image: killbill/kbbuild:0.2.0
259
+ - image: killbill/kbbuild:0.4.0
260
260
  steps:
261
261
  - checkout
262
262
  - restore_cache:
@@ -277,8 +277,8 @@ jobs:
277
277
  test-mysql-jruby-9.1.14.0:
278
278
  <<: *defaults
279
279
  docker:
280
- - image: killbill/kbbuild:0.2.0
281
- - image: killbill/killbill:0.19.2
280
+ - image: killbill/kbbuild:0.4.0
281
+ - image: killbill/killbill:0.19.6
282
282
  - image: killbill/mariadb:0.19
283
283
  environment:
284
284
  - MYSQL_ROOT_PASSWORD=root
@@ -114,6 +114,16 @@ module KillBillClient
114
114
  class NotAcceptable < ClientError
115
115
  end
116
116
 
117
+ # === 409 Conflict
118
+ #
119
+ # The request content type was not acceptable.
120
+ #
121
+ # The resource was found. This may be returned if the given
122
+ # key exists. The response body will explain
123
+ # which resource was found.
124
+ class Conflict < ClientError
125
+ end
126
+
117
127
  # === 415 Unsupported Media Type
118
128
  #
119
129
  # The request body was not recognized as XML.
@@ -181,6 +191,7 @@ module KillBillClient
181
191
  403 => Forbidden,
182
192
  404 => NotFound,
183
193
  406 => NotAcceptable,
194
+ 409 => Conflict,
184
195
  415 => UnsupportedMediaType,
185
196
  422 => UnprocessableEntity,
186
197
  500 => InternalServerError,
@@ -48,6 +48,8 @@ module KillBillClient
48
48
 
49
49
  return nil unless (options[:params] && !options[:params].empty?)
50
50
 
51
+ options[:params][:withStackTrace] = true if (options[:return_full_stacktraces] || KillBillClient.return_full_stacktraces)
52
+
51
53
  pairs = options[:params].map { |key, value|
52
54
  # If the value is an array, we 'demultiplex' into several
53
55
  if value.is_a? Array
@@ -12,6 +12,35 @@ module KillBillClient
12
12
 
13
13
  has_many :audit_logs, KillBillClient::Model::AuditLog
14
14
 
15
+ # DO NOT DELETE THIS METHOD
16
+ def tags(included_deleted = false, audit = 'NONE', options = {})
17
+ params = {}
18
+ # Non-standard, required, parameter
19
+ params[:accountId] = account_id
20
+ params[:includedDeleted] = included_deleted if included_deleted
21
+ params[:audit] = audit
22
+ self.class.get "#{KILLBILL_API_INVOICE_ITEMS_PREFIX}/#{invoice_item_id}/tags",
23
+ params,
24
+ options,
25
+ Tag
26
+ end
27
+
28
+ # DO NOT DELETE THIS METHOD
29
+ def add_tags_from_definition_ids(tag_definition_ids, user, reason, comment, options)
30
+ created_tag = self.class.post "#{KILLBILL_API_INVOICE_ITEMS_PREFIX}/#{invoice_item_id}/tags",
31
+ {},
32
+ {
33
+ :tagList => tag_definition_ids.join(',')
34
+ },
35
+ {
36
+ :user => user,
37
+ :reason => reason,
38
+ :comment => comment,
39
+ }.merge(options),
40
+ Tag
41
+ tags(false, 'NONE', options) unless created_tag.nil?
42
+ end
43
+
15
44
  def create(auto_commit = false, user = nil, reason = nil, comment = nil, options = {})
16
45
  created_invoice_item = self.class.post "#{Invoice::KILLBILL_API_INVOICES_PREFIX}/charges/#{account_id}",
17
46
  [to_hash].to_json,
@@ -2,7 +2,7 @@ module KillBillClient
2
2
  module Version
3
3
  MAJOR = 2
4
4
  MINOR = 2
5
- PATCH = 0
5
+ PATCH = 1
6
6
  PRE = nil
7
7
 
8
8
  VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
@@ -42,6 +42,7 @@ module KillBillClient
42
42
  attr_writer :url
43
43
 
44
44
  attr_accessor :disable_ssl_verification
45
+ attr_accessor :return_full_stacktraces
45
46
 
46
47
  # Tenant key/secret. Optional.
47
48
  attr_accessor :api_key
@@ -7,4 +7,44 @@ describe KillBillClient::API do
7
7
  tag_definitions = KillBillClient::Model::Resource.from_response KillBillClient::Model::TagDefinition, response
8
8
  expect(tag_definitions.size).to be > 1
9
9
  end
10
+
11
+ it 'requests stacktraces on demand', :integration => true do
12
+ KillBillClient.api_key = Time.now.to_i.to_s + rand(100).to_s
13
+ KillBillClient.api_secret = KillBillClient.api_key
14
+
15
+ tenant = KillBillClient::Model::Tenant.new
16
+ tenant.api_key = KillBillClient.api_key
17
+ tenant.api_secret = KillBillClient.api_secret
18
+ tenant.create(true, 'KillBill Spec test')
19
+
20
+ begin
21
+ KillBillClient.return_full_stacktraces = true
22
+ tenant.create(true, 'KillBill Spec test')
23
+ fail
24
+ rescue KillBillClient::API::InternalServerError => e
25
+ billing_exception = JSON.parse(e.response.body)
26
+ expect(billing_exception['className']).to eq('java.lang.RuntimeException')
27
+ expect(billing_exception['stackTrace'].size).to be >= 90
28
+ ensure
29
+ KillBillClient.return_full_stacktraces = false
30
+ end
31
+
32
+ begin
33
+ tenant.create(true, 'KillBill Spec test')
34
+ fail
35
+ rescue KillBillClient::API::InternalServerError => e
36
+ billing_exception = JSON.parse(e.response.body)
37
+ expect(billing_exception['className']).to eq('java.lang.RuntimeException')
38
+ expect(billing_exception['stackTrace'].size).to be == 0
39
+ end
40
+
41
+ begin
42
+ tenant.create(true, 'KillBill Spec test', nil, nil, {:return_full_stacktraces => true})
43
+ fail
44
+ rescue KillBillClient::API::InternalServerError => e
45
+ billing_exception = JSON.parse(e.response.body)
46
+ expect(billing_exception['className']).to eq('java.lang.RuntimeException')
47
+ expect(billing_exception['stackTrace'].size).to be >= 50
48
+ end
49
+ end
10
50
  end
@@ -2,6 +2,8 @@ require 'spec_helper'
2
2
 
3
3
  describe KillBillClient::Model do
4
4
  before do
5
+ KillBillClient.return_full_stacktraces = true
6
+
5
7
  KillBillClient.api_key = Time.now.to_i.to_s + rand(100).to_s
6
8
  KillBillClient.api_secret = KillBillClient.api_key
7
9
 
@@ -11,6 +13,10 @@ describe KillBillClient::Model do
11
13
  tenant.create(true, 'KillBill Spec test')
12
14
  end
13
15
 
16
+ after do
17
+ KillBillClient.return_full_stacktraces = false
18
+ end
19
+
14
20
  it 'should manipulate accounts', :integration => true do
15
21
  # In case the remote server has lots of data
16
22
  search_limit = 100000
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: 2.2.0
4
+ version: 2.2.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: 2018-03-23 00:00:00.000000000 Z
11
+ date: 2018-03-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rake