killbill-client 2.4.0 → 3.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (42) hide show
  1. checksums.yaml +4 -4
  2. data/.circleci/config.yml +24 -118
  3. data/.github/CONTRIBUTING.md +20 -0
  4. data/.github/FUNDING.yml +3 -0
  5. data/.github/workflows/ci.yml +145 -0
  6. data/.github/workflows/release.yml +46 -0
  7. data/README.md +2 -1
  8. data/bin/retry +21 -0
  9. data/docker/docker-compose.ci.mysql.yml +21 -0
  10. data/docker/docker-compose.ci.postgresql.yml +21 -0
  11. data/killbill_client.gemspec +2 -1
  12. data/lib/killbill_client.rb +2 -0
  13. data/lib/killbill_client/api/api.rb +1 -1
  14. data/lib/killbill_client/api/net_http_adapter.rb +30 -16
  15. data/lib/killbill_client/models/account.rb +12 -24
  16. data/lib/killbill_client/models/admin.rb +131 -0
  17. data/lib/killbill_client/models/bundle.rb +2 -0
  18. data/lib/killbill_client/models/credit.rb +5 -5
  19. data/lib/killbill_client/models/custom_field.rb +17 -0
  20. data/lib/killbill_client/models/gen/account_attributes.rb +0 -1
  21. data/lib/killbill_client/models/gen/{block_price_override_attributes.rb → block_price_attributes.rb} +1 -1
  22. data/lib/killbill_client/models/gen/invoice_attributes.rb +1 -0
  23. data/lib/killbill_client/models/gen/invoice_item_attributes.rb +1 -0
  24. data/lib/killbill_client/models/gen/overdue_state_attributes.rb +0 -1
  25. data/lib/killbill_client/models/gen/{phase_price_override_attributes.rb → phase_price_attributes.rb} +2 -2
  26. data/lib/killbill_client/models/gen/require_gen.rb +52 -53
  27. data/lib/killbill_client/models/gen/subscription_attributes.rb +2 -0
  28. data/lib/killbill_client/models/gen/{tier_price_override_attributes.rb → tier_price_attributes.rb} +2 -2
  29. data/lib/killbill_client/models/gen/{usage_price_override_attributes.rb → usage_price_attributes.rb} +2 -2
  30. data/lib/killbill_client/models/helpers/custom_field_helper.rb +1 -1
  31. data/lib/killbill_client/models/invoice.rb +7 -7
  32. data/lib/killbill_client/models/invoice_item.rb +4 -1
  33. data/lib/killbill_client/models/invoice_payment.rb +3 -0
  34. data/lib/killbill_client/models/models.rb +1 -0
  35. data/lib/killbill_client/models/resource.rb +1 -1
  36. data/lib/killbill_client/models/subscription.rb +23 -1
  37. data/lib/killbill_client/version.rb +1 -16
  38. data/spec/killbill_client/http_adapter_spec.rb +38 -0
  39. data/spec/killbill_client/remote/model_spec.rb +15 -12
  40. metadata +30 -9
  41. data/lib/killbill_client/models/gen/credit_attributes.rb +0 -43
  42. data/lib/killbill_client/models/gen/invoice_email_attributes.rb +0 -35
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 403d07c57a0a99bf52f0f217a1c4c7378e5294f7
4
- data.tar.gz: 4370530c0ea0d936fd0eebaed4b18fa8e91a857a
3
+ metadata.gz: 3be1314e1b773cf9f381995047bd08907957bd18
4
+ data.tar.gz: 2b16aa7aa39dd1239b548b393aff5c4f8de30f32
5
5
  SHA512:
6
- metadata.gz: be815f450d26601ab84be6df5772f5c04d6f4d2098fd6d0073cf755ddc63993e4cf4f2d538bfd179a95f1f21d66b65af572f975deacb6b001e6379d3dc3d5d8d
7
- data.tar.gz: beb28a9976f35f6b33c43739a137a4904db99f40171d2bfff0f63a1f3048191883595b12d974cc6dce680943e507e48074977168f94a4396b66051db7ad7945e
6
+ metadata.gz: b1bc847df0c8987f35e0fe54ee3fb2707f3084945f00866b681189940eefd2b0d0d58afa9405d2a42cccf1170e023fc9666094c4a58db52fc256be86134e19e5
7
+ data.tar.gz: 73c08847cb57745d1a762bd174a5e747f2aa082e7b65f445f504236b2934b1ac7fdd83323c831a773ffd19fc7ac4816bd4bff458d0f04e832c7d1aee6cda6ec0
data/.circleci/config.yml CHANGED
@@ -5,94 +5,14 @@ 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: v1-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: v1-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.16
32
- - image: killbill/mariadb:0.19
33
- environment:
34
- - MYSQL_ROOT_PASSWORD=root
35
- steps:
36
- - checkout
37
- - restore_cache:
38
- key: v1-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:
95
- key: v1-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
15
+ key: v2-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
96
16
  - run:
97
17
  name: Install gem dependencies
98
18
  command: |
@@ -104,20 +24,20 @@ jobs:
104
24
  - Gemfile.lock
105
25
  - .bundle
106
26
  - vendor/bundle
107
- key: v1-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
27
+ key: v2-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
108
28
 
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.16
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:
118
38
  - checkout
119
39
  - restore_cache:
120
- key: v1-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
40
+ key: v2-dependencies-ruby-2.2.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
121
41
  - run:
122
42
  name: Setup DDL
123
43
  command: |
@@ -172,11 +92,11 @@ 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:
179
- key: v1-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
99
+ key: v2-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
180
100
  - run:
181
101
  name: Install gem dependencies
182
102
  command: |
@@ -188,20 +108,20 @@ jobs:
188
108
  - Gemfile.lock
189
109
  - .bundle
190
110
  - vendor/bundle
191
- key: v1-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
111
+ key: v2-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
192
112
 
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.16
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:
202
122
  - checkout
203
123
  - restore_cache:
204
- key: v1-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
124
+ key: v2-dependencies-ruby-2.4.2-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
205
125
  - run:
206
126
  name: Setup DDL
207
127
  command: |
@@ -256,11 +176,11 @@ 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:
263
- key: v1-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
183
+ key: v2-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
264
184
  - run:
265
185
  name: Install gem dependencies
266
186
  command: |
@@ -272,20 +192,20 @@ jobs:
272
192
  - Gemfile.lock
273
193
  - .bundle
274
194
  - vendor/bundle
275
- key: v1-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
195
+ key: v2-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
276
196
 
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.16
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:
286
206
  - checkout
287
207
  - restore_cache:
288
- key: v1-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
208
+ key: v2-dependencies-jruby-9.1.14.0-{{ .Branch }}-{{ checksum "killbill_client.gemspec" }}
289
209
  - run:
290
210
  name: Setup DDL
291
211
  command: |
@@ -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