killbill-client 3.2.0 → 3.3.0

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
- SHA256:
3
- metadata.gz: 8e8ef20872ffaa7ed2ae3389efa305af47a71a5458a81f23399fcdc403b55fe8
4
- data.tar.gz: b86df21f75c0e2791cc0a17253ff917ebea6543e338c6550ed94fb3086ab679b
2
+ SHA1:
3
+ metadata.gz: 3be1314e1b773cf9f381995047bd08907957bd18
4
+ data.tar.gz: 2b16aa7aa39dd1239b548b393aff5c4f8de30f32
5
5
  SHA512:
6
- metadata.gz: 9cc5394ccd1288a6ba86cf422f7a9ca715499c737c1b578b86e31ee38f8a3eba1090bfa58ae58bfab6fae23866f4737f615c605292b505088fcf4c4fc64f226f
7
- data.tar.gz: f9eca5b4bd522edebc5a0d3bccfb5e736e5f91b5323be764093ff553783d4e6012f3f5744090566d4050e85dac86786a25b94d0bc582aa39b15f54a70ed1954a
6
+ metadata.gz: b1bc847df0c8987f35e0fe54ee3fb2707f3084945f00866b681189940eefd2b0d0d58afa9405d2a42cccf1170e023fc9666094c4a58db52fc256be86134e19e5
7
+ data.tar.gz: 73c08847cb57745d1a762bd174a5e747f2aa082e7b65f445f504236b2934b1ac7fdd83323c831a773ffd19fc7ac4816bd4bff458d0f04e832c7d1aee6cda6ec0
data/.circleci/config.yml CHANGED
@@ -5,90 +5,10 @@ defaults: &defaults
5
5
 
6
6
  version: 2
7
7
  jobs:
8
- build-jruby-1.7.26:
9
- <<: *defaults
10
- docker:
11
- - image: killbill/kbbuild:0.5.0
12
- steps:
13
- - checkout
14
- - restore_cache:
15
- key: v2-dependencies-jruby-1.7.26-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
16
- - run:
17
- name: Install gem dependencies
18
- command: |
19
- bundle install --jobs=4 --retry=3 --path=vendor/bundle
20
- - save_cache:
21
- paths:
22
- - Gemfile.lock
23
- - .bundle
24
- - vendor/bundle
25
- key: v2-dependencies-jruby-1.7.26-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
26
-
27
- test-mysql-jruby-1.7.26:
28
- <<: *defaults
29
- docker:
30
- - image: killbill/kbbuild:0.5.0
31
- - image: killbill/killbill:0.19.18
32
- - image: killbill/mariadb:0.19
33
- environment:
34
- - MYSQL_ROOT_PASSWORD=root
35
- steps:
36
- - checkout
37
- - restore_cache:
38
- key: v2-dependencies-jruby-1.7.26-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
39
- - run:
40
- name: Setup DDL
41
- command: |
42
- set +e
43
- count=0
44
- until mysqladmin ping -h 127.0.0.1 -u root --password=root --silent; do
45
- if [[ "$count" == "25" ]]; then
46
- exit 1
47
- fi
48
- (( count++ ))
49
- printf '.'
50
- sleep 5
51
- done
52
- set -e
53
- - run:
54
- name: Setup Kill Bill
55
- command: |
56
- set +e
57
- count=0
58
- until $(curl --output /dev/null --silent --fail http://127.0.0.1:8080/1.0/healthcheck); do
59
- if [[ "$count" == "25" ]]; then
60
- exit 1
61
- fi
62
- (( count++ ))
63
-
64
- printf '.'
65
- sleep 5
66
- done
67
- set -e
68
- curl -v \
69
- -X POST \
70
- -u admin:password \
71
- -H 'Content-Type: application/json' \
72
- -H 'X-Killbill-CreatedBy: CircleCI' \
73
- -d '{"apiKey": "bob", "apiSecret": "lazar"}' \
74
- "http://127.0.0.1:8080/1.0/kb/tenants?useGlobalDefault=true"
75
- - run:
76
- name: Run tests
77
- command: |
78
- mkdir /tmp/test-results
79
- bundle exec rspec --format documentation \
80
- --out /tmp/test-results/rspec.txt \
81
- $(circleci tests glob "spec/**/*_spec.rb")
82
- - store_test_results:
83
- path: /tmp/test-results
84
- - store_artifacts:
85
- path: /tmp/test-results
86
- destination: test-results
87
-
88
8
  build-ruby-2.2.2:
89
9
  <<: *defaults
90
10
  docker:
91
- - image: killbill/kbbuild:0.5.0
11
+ - image: killbill/kbbuild:0.6.0
92
12
  steps:
93
13
  - checkout
94
14
  - restore_cache:
@@ -109,9 +29,9 @@ jobs:
109
29
  test-mysql-ruby-2.2.2:
110
30
  <<: *defaults
111
31
  docker:
112
- - image: killbill/kbbuild:0.5.0
113
- - image: killbill/killbill:0.19.18
114
- - image: killbill/mariadb:0.19
32
+ - image: killbill/kbbuild:0.6.0
33
+ - image: killbill/killbill:0.21.9
34
+ - image: killbill/mariadb:0.21
115
35
  environment:
116
36
  - MYSQL_ROOT_PASSWORD=root
117
37
  steps:
@@ -172,7 +92,7 @@ jobs:
172
92
  build-ruby-2.4.2:
173
93
  <<: *defaults
174
94
  docker:
175
- - image: killbill/kbbuild:0.5.0
95
+ - image: killbill/kbbuild:0.6.0
176
96
  steps:
177
97
  - checkout
178
98
  - restore_cache:
@@ -193,9 +113,9 @@ jobs:
193
113
  test-mysql-ruby-2.4.2:
194
114
  <<: *defaults
195
115
  docker:
196
- - image: killbill/kbbuild:0.5.0
197
- - image: killbill/killbill:0.19.18
198
- - image: killbill/mariadb:0.19
116
+ - image: killbill/kbbuild:0.6.0
117
+ - image: killbill/killbill:0.21.9
118
+ - image: killbill/mariadb:0.21
199
119
  environment:
200
120
  - MYSQL_ROOT_PASSWORD=root
201
121
  steps:
@@ -256,7 +176,7 @@ jobs:
256
176
  build-jruby-9.1.14.0:
257
177
  <<: *defaults
258
178
  docker:
259
- - image: killbill/kbbuild:0.5.0
179
+ - image: killbill/kbbuild:0.6.0
260
180
  steps:
261
181
  - checkout
262
182
  - restore_cache:
@@ -277,9 +197,9 @@ jobs:
277
197
  test-mysql-jruby-9.1.14.0:
278
198
  <<: *defaults
279
199
  docker:
280
- - image: killbill/kbbuild:0.5.0
281
- - image: killbill/killbill:0.19.18
282
- - image: killbill/mariadb:0.19
200
+ - image: killbill/kbbuild:0.6.0
201
+ - image: killbill/killbill:0.21.9
202
+ - image: killbill/mariadb:0.21
283
203
  environment:
284
204
  - MYSQL_ROOT_PASSWORD=root
285
205
  steps:
@@ -340,32 +260,18 @@ workflows:
340
260
  version: 2
341
261
  build-and-test:
342
262
  jobs:
343
- # Kill Bill plugins
344
- - build-jruby-1.7.26
345
263
  # Self-contained KPM
346
- - build-ruby-2.2.2:
347
- requires:
348
- - build-jruby-1.7.26
264
+ - build-ruby-2.2.2
349
265
  # Kaui and other gems
350
- - build-ruby-2.4.2:
351
- requires:
352
- - build-jruby-1.7.26
266
+ - build-ruby-2.4.2
353
267
  # Self-contained Kaui
354
- - build-jruby-9.1.14.0:
355
- requires:
356
- - build-jruby-1.7.26
357
- - test-mysql-jruby-1.7.26:
358
- requires:
359
- - build-jruby-1.7.26
268
+ - build-jruby-9.1.14.0
360
269
  - test-mysql-ruby-2.2.2:
361
270
  requires:
362
271
  - build-ruby-2.2.2
363
- - test-mysql-jruby-1.7.26
364
272
  - test-mysql-ruby-2.4.2:
365
273
  requires:
366
274
  - build-ruby-2.4.2
367
- - test-mysql-jruby-1.7.26
368
275
  - test-mysql-jruby-9.1.14.0:
369
276
  requires:
370
277
  - build-jruby-9.1.14.0
371
- - test-mysql-jruby-1.7.26
@@ -0,0 +1,20 @@
1
+ ## How to contribute to Kill Bill
2
+
3
+ **Do not open up a GitHub issue before reaching out to our [Mailing-List](https://groups.google.com/forum/#!forum/killbilling-users)**. GitHub issues are primarily intended for tracking bug reports and fixes by the core team.
4
+
5
+ #### **Did you find a bug?**
6
+
7
+ In your [Mailing-List](https://groups.google.com/forum/#!forum/killbilling-users) post, specify:
8
+
9
+ * Step by step description on how to reproduce the issue
10
+ * [Account data and system dump](http://docs.killbill.io/0.19/debugging.html#_seeking_help) via KPM of an affected account
11
+
12
+ #### **Do you intend to add a new feature or change an existing one?**
13
+
14
+ Do not open an issue or pull request on GitHub until you have collected positive feedback about the change on the [Mailing-List](https://groups.google.com/forum/#!forum/killbilling-users).
15
+
16
+ When submitting code, make sure to add [new tests](http://docs.killbill.io/0.19/development.html#_navigating_the_kill_bill_codebase).
17
+
18
+ #### **Do you want to contribute to the Kill Bill documentation?**
19
+
20
+ Open a pull request on GitHub in the [killbill-docs](https://github.com/killbill/killbill-docs) repository.
@@ -0,0 +1,3 @@
1
+ # These are supported funding model platforms
2
+
3
+ github: [killbill]
@@ -0,0 +1,145 @@
1
+ name: ci
2
+
3
+ on:
4
+ push:
5
+ workflow_dispatch:
6
+
7
+ env:
8
+ COMPOSE_DOCKER_CLI_BUILD: 1
9
+ DB_NAME: kaui
10
+ DOCKER_BUILDKIT: 1
11
+ JRUBY_OPTS: --2.0 -J-Xmx1024M
12
+ KB_ADDRESS: 127.0.0.1
13
+ KB_PORT: 8080
14
+ RAILS_ENV: test
15
+
16
+ jobs:
17
+ test:
18
+ runs-on: ubuntu-latest
19
+ strategy:
20
+ matrix:
21
+ include:
22
+ - ruby-version: '2.4.2'
23
+ database-adapter: 'mysql2'
24
+ database-user: 'root'
25
+ database-password: 'root'
26
+ database-port: '3306'
27
+ docker-compose-file: 'docker-compose.ci.mysql.yml'
28
+ - ruby-version: 'jruby-9.1.17.0'
29
+ database-adapter: 'mysql2'
30
+ database-user: 'root'
31
+ database-password: 'root'
32
+ database-port: '3306'
33
+ docker-compose-file: 'docker-compose.ci.mysql.yml'
34
+ - ruby-version: '2.4.2'
35
+ database-adapter: 'postgresql'
36
+ database-user: 'postgres'
37
+ database-password: 'postgres'
38
+ database-port: '5432'
39
+ docker-compose-file: 'docker-compose.ci.postgresql.yml'
40
+ - ruby-version: 'jruby-9.1.17.0'
41
+ database-adapter: 'postgresql'
42
+ database-user: 'postgres'
43
+ database-password: 'postgres'
44
+ database-port: '5432'
45
+ docker-compose-file: 'docker-compose.ci.postgresql.yml'
46
+ steps:
47
+ - name: Checkout code
48
+ uses: actions/checkout@v2
49
+ - name: Set up Ruby
50
+ uses: ruby/setup-ruby@v1
51
+ with:
52
+ ruby-version: ${{ matrix.ruby-version }}
53
+ bundler-cache: true
54
+ - name: Start stack
55
+ run: |
56
+ cd docker
57
+ docker-compose -p it -f ${{ matrix.docker-compose-file }} up --no-start
58
+ docker start it_db_1
59
+ - name: Wait for MySQL
60
+ if: ${{ matrix.docker-compose-file == 'docker-compose.ci.mysql.yml' }}
61
+ run: |
62
+ set +e
63
+ count=0
64
+ until mysqladmin ping -h 127.0.0.1 -u root --password=root --silent; do
65
+ if [[ "$count" == "25" ]]; then
66
+ exit 1
67
+ fi
68
+ (( count++ ))
69
+ printf '.'
70
+ sleep 5
71
+ done
72
+ set -e
73
+ - name: Wait for PostgreSQL
74
+ if: ${{ matrix.docker-compose-file == 'docker-compose.ci.postgresql.yml' }}
75
+ run: |
76
+ set +e
77
+ count=0
78
+ until $(psql -h 127.0.0.1 -U postgres -p 5432 -l > /dev/null); do
79
+ if [[ "$count" == "25" ]]; then
80
+ exit 1
81
+ fi
82
+ (( count++ ))
83
+ printf '.'
84
+ sleep 5
85
+ done
86
+ set -e
87
+ - name: Start Kill Bill
88
+ # Sometimes it gets stuck (if Kill Bill starts when the DB isn't ready?)
89
+ timeout-minutes: 4
90
+ run: |
91
+ docker start it_killbill_1
92
+ count=0
93
+ until $(curl --connect-timeout 10 --max-time 30 --output /dev/null --silent --fail http://${KB_ADDRESS}:${KB_PORT}/1.0/healthcheck); do
94
+ if [[ "$count" == "180" ]]; then
95
+ exit 64
96
+ fi
97
+ count=$(( count + 1 ))
98
+ sleep 1
99
+ done
100
+ curl --connect-timeout 10 --max-time 30 -v \
101
+ -X POST \
102
+ -u admin:password \
103
+ -H 'Content-Type: application/json' \
104
+ -H 'X-Killbill-CreatedBy: GitHub' \
105
+ -d '{"apiKey": "bob", "apiSecret": "lazar"}' \
106
+ "http://${KB_ADDRESS}:${KB_PORT}/1.0/kb/tenants"
107
+ - name: Run fast tests
108
+ env:
109
+ DB_ADAPTER: ${{ matrix.database-adapter }}
110
+ DB_USER: ${{ matrix.database-user }}
111
+ DB_PASSWORD: ${{ matrix.database-password }}
112
+ DB_PORT: ${{ matrix.database-port }}
113
+ run: |
114
+ # Some flakiness unfortunately
115
+ ./bin/retry bundle exec rake test:spec
116
+ - name: Run remote tests
117
+ env:
118
+ DB_ADAPTER: ${{ matrix.database-adapter }}
119
+ DB_USER: ${{ matrix.database-user }}
120
+ DB_PASSWORD: ${{ matrix.database-password }}
121
+ DB_PORT: ${{ matrix.database-port }}
122
+ run: |
123
+ # Some flakiness unfortunately
124
+ ./bin/retry bundle exec rake test:remote:spec
125
+ - name: Debugging after failure
126
+ if: failure()
127
+ run: |
128
+ echo "[DEBUG] killbill healthcheck"
129
+ curl --connect-timeout 10 --max-time 30 -v http://${KB_ADDRESS}:${KB_PORT}/1.0/healthcheck || true
130
+ echo "[DEBUG] hostname"
131
+ hostname
132
+ echo "[DEBUG] netstat -tulpn"
133
+ sudo netstat -tulpn
134
+ echo "[DEBUG] docker network ls"
135
+ docker network ls
136
+ echo "[DEBUG] docker ps -a"
137
+ docker ps -a
138
+ echo "[DEBUG] killbill env"
139
+ docker exec it_killbill_1 env || true
140
+ echo "[DEBUG] db env"
141
+ docker exec it_db_1 env || true
142
+ echo "[DEBUG] killbill logs"
143
+ docker logs -t --details it_killbill_1 || true
144
+ echo "[DEBUG] db logs"
145
+ docker logs -t --details it_db_1 || true
@@ -0,0 +1,46 @@
1
+ name: release
2
+
3
+ on:
4
+ workflow_dispatch:
5
+ inputs:
6
+ target_version:
7
+ description: 'Target version: next [major|minor|patch|pre|release] or a given version number [x.x.x]'
8
+ required: true
9
+ default: 'patch'
10
+
11
+ jobs:
12
+ release:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - name: Checkout code
16
+ uses: actions/checkout@v2
17
+ - name: Setup git user
18
+ env:
19
+ BUILD_USER: ${{ secrets.BUILD_USER }}
20
+ BUILD_TOKEN: ${{ secrets.BUILD_TOKEN }}
21
+ run: |
22
+ git config --global user.email "contact@killbill.io"
23
+ git config --global user.name "Kill Bill core team"
24
+ git config --global url."https://${BUILD_USER}:${BUILD_TOKEN}@github.com/".insteadOf "git@github.com:"
25
+ - uses: ruby/setup-ruby@v1
26
+ with:
27
+ ruby-version: '2.4.2'
28
+ - name: Download Ruby dependencies
29
+ run: |
30
+ bundle install
31
+ - name: Tag repository
32
+ run: |
33
+ bundle exec gem bump -c -p -t -v ${{ github.event.inputs.target_version }}
34
+ - name: Release Gem
35
+ env:
36
+ RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }}
37
+ run: |
38
+ mkdir -p ~/.gem
39
+ cat << EOF > ~/.gem/credentials
40
+ ---
41
+ :rubygems_api_key: ${RUBYGEMS_API_KEY}
42
+ EOF
43
+ chmod 0600 ~/.gem/credentials
44
+ bundle install
45
+ bundle exec gem release
46
+ rm -f ~/.gem/credentials
data/bin/retry ADDED
@@ -0,0 +1,21 @@
1
+ #!/usr/bin/env bash
2
+
3
+ set -euo pipefail
4
+
5
+ x() {
6
+ echo "+ $*" >&2
7
+ "$@"
8
+ }
9
+
10
+ retry_delay_seconds=10
11
+
12
+ i="0"
13
+ while [ $i -lt 4 ]
14
+ do
15
+ x "$@" && exit 0
16
+ sleep "${retry_delay_seconds}"
17
+ i=$[$i+1]
18
+ done
19
+
20
+ echo "$0: retrying [$*] timed out" >&2
21
+ exit 1
@@ -0,0 +1,21 @@
1
+ version: '3.8'
2
+
3
+ services:
4
+ killbill:
5
+ network_mode: host
6
+ image: killbill/killbill:0.22.20
7
+ environment:
8
+ - KILLBILL_CATALOG_URI=SpyCarAdvanced.xml
9
+ - KILLBILL_DAO_URL=jdbc:mysql://127.0.0.1:3306/killbill
10
+ - KILLBILL_DAO_USER=root
11
+ - KILLBILL_DAO_PASSWORD=root
12
+ - KILLBILL_SERVER_TEST_MODE=true
13
+ - KILLBILL_INVOICE_SANITY_SAFETY_BOUND_ENABLED=false
14
+ - KILLBILL_INVOICE_MAX_DAILY_NUMBER_OF_ITEMS_SAFETY_BOUND=-1
15
+ depends_on:
16
+ - db
17
+ db:
18
+ network_mode: host
19
+ image: killbill/mariadb:0.22
20
+ environment:
21
+ - MYSQL_ROOT_PASSWORD=root
@@ -0,0 +1,21 @@
1
+ version: '3.8'
2
+
3
+ services:
4
+ killbill:
5
+ network_mode: host
6
+ image: killbill/killbill:0.22.20
7
+ environment:
8
+ - KILLBILL_CATALOG_URI=SpyCarAdvanced.xml
9
+ - KILLBILL_DAO_URL=jdbc:postgresql://127.0.0.1:5432/killbill
10
+ - KILLBILL_DAO_USER=postgres
11
+ - KILLBILL_DAO_PASSWORD=postgres
12
+ - KILLBILL_SERVER_TEST_MODE=true
13
+ - KILLBILL_INVOICE_SANITY_SAFETY_BOUND_ENABLED=false
14
+ - KILLBILL_INVOICE_MAX_DAILY_NUMBER_OF_ITEMS_SAFETY_BOUND=-1
15
+ depends_on:
16
+ - db
17
+ db:
18
+ network_mode: host
19
+ image: killbill/postgresql:0.22
20
+ environment:
21
+ - POSTGRES_PASSWORD=postgres
@@ -19,7 +19,7 @@ require 'killbill_client/version'
19
19
 
20
20
  Gem::Specification.new do |s|
21
21
  s.name = 'killbill-client'
22
- s.version = KillBillClient::Version.to_s
22
+ s.version = KillBillClient::VERSION
23
23
  s.summary = 'Kill Bill client library.'
24
24
  s.description = 'An API client library for Kill Bill.'
25
25
 
@@ -43,6 +43,7 @@ Gem::Specification.new do |s|
43
43
  s.add_dependency 'json', '>= 1.2.0', '< 2.0.0'
44
44
  end
45
45
 
46
+ s.add_development_dependency 'gem-release', '~> 2.2'
46
47
  s.add_development_dependency 'rake', '>= 10.0.0', '< 11.0.0'
47
48
  s.add_development_dependency 'rspec', '~> 3.4'
48
49
  end
@@ -41,6 +41,8 @@ module KillBillClient
41
41
 
42
42
  attr_writer :url
43
43
 
44
+ attr_accessor :read_timeout
45
+ attr_accessor :connection_timeout
44
46
  attr_accessor :disable_ssl_verification
45
47
  attr_accessor :return_full_stacktraces
46
48
 
@@ -70,7 +70,7 @@ module KillBillClient
70
70
 
71
71
  # @return [String]
72
72
  def user_agent
73
- "killbill/#{Version}; #{RUBY_DESCRIPTION}"
73
+ "killbill/#{VERSION}; #{RUBY_DESCRIPTION}"
74
74
  end
75
75
 
76
76
  private
@@ -86,8 +86,16 @@ module KillBillClient
86
86
 
87
87
  def create_http_client(uri, options = {})
88
88
  http = ::Net::HTTP.new uri.host, uri.port
89
- http.read_timeout = options[:read_timeout].to_f / 1000 if options[:read_timeout].is_a? Numeric
90
- http.open_timeout = options[:connection_timeout].to_f / 1000 if options[:connection_timeout].is_a? Numeric
89
+ if options[:read_timeout].is_a? Numeric
90
+ http.read_timeout = options[:read_timeout].to_f / 1000
91
+ elsif KillBillClient.read_timeout.is_a? Numeric
92
+ http.read_timeout = KillBillClient.read_timeout.to_f / 1000
93
+ end
94
+ if options[:connection_timeout].is_a? Numeric
95
+ http.open_timeout = options[:connection_timeout].to_f / 1000
96
+ elsif KillBillClient.connection_timeout.is_a? Numeric
97
+ http.open_timeout = KillBillClient.connection_timeout.to_f / 1000
98
+ end
91
99
  http.use_ssl = uri.scheme == 'https'
92
100
  http.verify_mode = OpenSSL::SSL::VERIFY_NONE if (options[:disable_ssl_verification] || KillBillClient.disable_ssl_verification)
93
101
  http
@@ -71,7 +71,7 @@ module KillBillClient
71
71
  self.class.delete "#{url_prefix}/#{send(id_alias)}/customFields",
72
72
  {},
73
73
  {
74
- :customFieldList => custom_fields_param
74
+ :customField => custom_fields_param
75
75
  },
76
76
  {
77
77
  :user => user,
@@ -1,18 +1,3 @@
1
1
  module KillBillClient
2
- module Version
3
- MAJOR = 3
4
- MINOR = 2
5
- PATCH = 0
6
- PRE = nil
7
-
8
- VERSION = [MAJOR, MINOR, PATCH, PRE].compact.join('.').freeze
9
-
10
- class << self
11
- def inspect
12
- VERSION.dup
13
- end
14
-
15
- alias to_s inspect
16
- end
17
- end
2
+ VERSION = '3.3.0'
18
3
  end
@@ -1,6 +1,14 @@
1
1
  require 'spec_helper'
2
2
 
3
3
  describe KillBillClient::API do
4
+
5
+ before do
6
+ KillBillClient.url = nil
7
+ KillBillClient.disable_ssl_verification = nil
8
+ KillBillClient.read_timeout = nil
9
+ KillBillClient.connection_timeout = nil
10
+ end
11
+
4
12
  let(:expected_query_params) {
5
13
  [
6
14
  'controlPluginName=killbill-example-plugin',
@@ -55,11 +63,33 @@ describe KillBillClient::API do
55
63
  http_adapter = DummyForHTTPAdapter.new
56
64
  http_client = http_adapter.send(:create_http_client, uri)
57
65
  expect(http_client.read_timeout).to eq(60)
66
+ # The default value has changed from nil to 60 in 2.4
67
+ #expect(http_client.open_timeout).to eq(60)
58
68
  expect(http_client.use_ssl?).to be false
59
69
  expect(http_client.verify_mode).to be_nil
60
70
  end
61
71
 
72
+ it 'should set the global parameters for http client' do
73
+ KillBillClient.url = 'https://example.com'
74
+ KillBillClient.read_timeout = 123000
75
+ KillBillClient.connection_timeout = 456000
76
+ KillBillClient.disable_ssl_verification = true
77
+
78
+ http_adapter = DummyForHTTPAdapter.new
79
+ http_client = http_adapter.send(:create_http_client, ssl_uri, {})
80
+ expect(http_client.read_timeout).to eq(123)
81
+ expect(http_client.open_timeout).to eq(456)
82
+ expect(http_client.use_ssl?).to be true
83
+ expect(http_client.verify_mode).to eq(OpenSSL::SSL::VERIFY_NONE)
84
+ end
85
+
62
86
  it 'should set the correct parameters for http client' do
87
+ # These don't matter (overridden by options)
88
+ KillBillClient.url = 'https://example.com'
89
+ KillBillClient.read_timeout = 123000
90
+ KillBillClient.connection_timeout = 456000
91
+ KillBillClient.disable_ssl_verification = false
92
+
63
93
  http_adapter = DummyForHTTPAdapter.new
64
94
  http_client = http_adapter.send(:create_http_client, ssl_uri, options)
65
95
  expect(http_client.read_timeout).to eq(options[:read_timeout] / 1000)
@@ -70,6 +100,8 @@ describe KillBillClient::API do
70
100
 
71
101
  # See https://github.com/killbill/killbill-client-ruby/issues/69
72
102
  it 'should construct URIs' do
103
+ KillBillClient.url = 'http://example.com:8080'
104
+
73
105
  http_adapter = DummyForHTTPAdapter.new
74
106
  uri = http_adapter.send(:build_uri, KillBillClient::Model::Account::KILLBILL_API_ACCOUNTS_PREFIX, options)
75
107
  expect(uri).to eq(URI.parse("#{KillBillClient::API.base_uri.to_s}/1.0/kb/accounts"))
@@ -101,13 +101,17 @@ describe KillBillClient::Model do
101
101
  custom_field = KillBillClient::Model::CustomField.new
102
102
  custom_field.name = SecureRandom.uuid.to_s
103
103
  custom_field.value = SecureRandom.uuid.to_s
104
+ custom_field_other = KillBillClient::Model::CustomField.new
105
+ custom_field_other.name = SecureRandom.uuid.to_s
106
+ custom_field_other.value = SecureRandom.uuid.to_s
104
107
  account.add_custom_field(custom_field, 'KillBill Spec test')
108
+ account.add_custom_field(custom_field_other, 'KillBill Spec test other')
105
109
  custom_fields = account.custom_fields
106
- expect(custom_fields.size).to eq(1)
110
+ expect(custom_fields.size).to eq(2)
107
111
  expect(custom_fields.first.name).to eq(custom_field.name)
108
112
  expect(custom_fields.first.value).to eq(custom_field.value)
109
113
  account.remove_custom_field(custom_fields.first.custom_field_id, 'KillBill Spec test')
110
- expect(account.custom_fields.size).to eq(0)
114
+ expect(account.custom_fields.size).to eq(1)
111
115
 
112
116
  # Add a payment method
113
117
  pm = KillBillClient::Model::PaymentMethod.new
@@ -163,13 +167,13 @@ describe KillBillClient::Model do
163
167
  invoice.commit 'KillBill Spec test'
164
168
 
165
169
  # Add/Remove a invoice item tag
166
- expect(invoice_item.tags.size).to eq(0)
167
- invoice_item.add_tag('TEST', 'KillBill Spec test')
168
- tags = invoice_item.tags
170
+ expect(invoice.tags.size).to eq(0)
171
+ invoice.add_tag('WRITTEN_OFF', 'KillBill Spec test')
172
+ tags = invoice.tags
169
173
  expect(tags.size).to eq(1)
170
- expect(tags.first.tag_definition_name).to eq('TEST')
171
- invoice_item.remove_tag('TEST', 'KillBill Spec test')
172
- expect(invoice_item.tags.size).to eq(0)
174
+ expect(tags.first.tag_definition_name).to eq('WRITTEN_OFF')
175
+ invoice.remove_tag('WRITTEN_OFF', 'KillBill Spec test')
176
+ expect(invoice.tags.size).to eq(0)
173
177
 
174
178
  # Add/Remove a invoice item custom field
175
179
  expect(invoice_item.custom_fields.size).to eq(0)
@@ -285,7 +289,7 @@ describe KillBillClient::Model do
285
289
  expect(invoice_payment.credited_amount).to eq(0)
286
290
 
287
291
  # Refund the payment (with item adjustment)
288
- invoice_item = KillBillClient::Model::Invoice.find_by_number(invoice_number, true).items.first
292
+ invoice_item = KillBillClient::Model::Invoice.find_by_number(invoice_number).items.first
289
293
  item = KillBillClient::Model::InvoiceItem.new
290
294
  item.invoice_item_id = invoice_item.invoice_item_id
291
295
  item.amount = invoice_item.amount
metadata CHANGED
@@ -1,15 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.0
4
+ version: 3.3.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: 2019-12-24 00:00:00.000000000 Z
11
+ date: 2021-06-02 00:00:00.000000000 Z
12
12
  dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: gem-release
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '2.2'
20
+ type: :development
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '2.2'
13
27
  - !ruby/object:Gem::Dependency
14
28
  name: rake
15
29
  requirement: !ruby/object:Gem::Requirement
@@ -46,15 +60,23 @@ dependencies:
46
60
  version: '3.4'
47
61
  description: An API client library for Kill Bill.
48
62
  email: killbilling-users@googlegroups.com
49
- executables: []
63
+ executables:
64
+ - retry
50
65
  extensions: []
51
66
  extra_rdoc_files: []
52
67
  files:
53
68
  - ".circleci/config.yml"
69
+ - ".github/CONTRIBUTING.md"
70
+ - ".github/FUNDING.yml"
71
+ - ".github/workflows/ci.yml"
72
+ - ".github/workflows/release.yml"
54
73
  - ".gitignore"
55
74
  - Gemfile
56
75
  - README.md
57
76
  - Rakefile
77
+ - bin/retry
78
+ - docker/docker-compose.ci.mysql.yml
79
+ - docker/docker-compose.ci.postgresql.yml
58
80
  - gen_config/model.conf
59
81
  - killbill_client.gemspec
60
82
  - lib/killbill_client.rb
@@ -214,7 +236,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
214
236
  - !ruby/object:Gem::Version
215
237
  version: '0'
216
238
  requirements: []
217
- rubygems_version: 3.0.6
239
+ rubyforge_project:
240
+ rubygems_version: 2.6.13
218
241
  signing_key:
219
242
  specification_version: 4
220
243
  summary: Kill Bill client library.