killbill-client 4.0.9 → 4.0.11
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/.github/workflows/ci.yml +2 -2
- data/.github/workflows/release.yml +1 -1
- data/lib/killbill_client/api/net_http_adapter.rb +4 -2
- data/lib/killbill_client/models/role_definition.rb +6 -0
- data/lib/killbill_client/version.rb +1 -1
- data/spec/killbill_client/role_definition_spec.rb +36 -0
- metadata +4 -3
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 510b468787e3d7b5c8b187f63d387f9ad4ba180215fc767d31de279044ace654
|
|
4
|
+
data.tar.gz: a42f828b26cfe0eccd2d86859e8aaad31d1d5f158664c83a871507bb6aa2d765
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: d1003f5b54c25730271f64f9d7658a64cdf293d66a7b59af26bb958ed84f8bc3ea343a399f43e3c0a019e8eb9f808a87c098eab371a3e950c5deb49bbc2e4e64
|
|
7
|
+
data.tar.gz: 92b10cb4cf6e04973c142fd1fd8390fc5c7ced5aecbab76ec0e339c2ee0cf9fe1c90a551a82ad40ae41dd30653c5f420e47cf4c7609991af0d19f2d18c50a2ff
|
data/.github/workflows/ci.yml
CHANGED
|
@@ -32,7 +32,7 @@ jobs:
|
|
|
32
32
|
database-password: 'postgres'
|
|
33
33
|
database-port: '5432'
|
|
34
34
|
docker-compose-file: 'docker-compose.ci.postgresql.yml'
|
|
35
|
-
- ruby-version: 'jruby-9.4.
|
|
35
|
+
- ruby-version: 'jruby-9.4.15.0'
|
|
36
36
|
database-adapter: 'mysql2'
|
|
37
37
|
database-user: 'root'
|
|
38
38
|
database-password: 'root'
|
|
@@ -50,7 +50,7 @@ jobs:
|
|
|
50
50
|
database-password: 'postgres'
|
|
51
51
|
database-port: '5432'
|
|
52
52
|
docker-compose-file: 'docker-compose.ci.postgresql.yml'
|
|
53
|
-
- ruby-version: 'jruby-9.4.
|
|
53
|
+
- ruby-version: 'jruby-9.4.15.0'
|
|
54
54
|
database-adapter: 'postgresql'
|
|
55
55
|
database-user: 'postgres'
|
|
56
56
|
database-password: 'postgres'
|
|
@@ -24,7 +24,7 @@ jobs:
|
|
|
24
24
|
git config --global url."https://${BUILD_USER}:${BUILD_TOKEN}@github.com/".insteadOf "git@github.com:"
|
|
25
25
|
- uses: ruby/setup-ruby@v1
|
|
26
26
|
with:
|
|
27
|
-
ruby-version: '3.2
|
|
27
|
+
ruby-version: '3.2'
|
|
28
28
|
- name: Download Ruby dependencies
|
|
29
29
|
run: |
|
|
30
30
|
bundle install
|
|
@@ -90,8 +90,10 @@ module KillBillClient
|
|
|
90
90
|
# This is a relative URI, encode path segments individually
|
|
91
91
|
path_segments = path_part.split('/')
|
|
92
92
|
encoded_segments = path_segments.map do |segment|
|
|
93
|
-
# Skip encoding if the segment is already encoded
|
|
94
|
-
|
|
93
|
+
# Skip encoding only if the segment is already fully encoded, i.e. it is made of safe characters
|
|
94
|
+
# and well-formed %XX escapes. A bare '%' followed by hex-looking letters (e.g. a LIKE search for
|
|
95
|
+
# '%account%', where '%ac' looks like an escape) must still be encoded.
|
|
96
|
+
if segment.match?(/\A(?:[a-zA-Z0-9\-_.!~*'()]|%[0-9A-Fa-f]{2})*\z/)
|
|
95
97
|
segment
|
|
96
98
|
else
|
|
97
99
|
# Only encode segments that contain unsafe characters
|
|
@@ -3,6 +3,12 @@ module KillBillClient
|
|
|
3
3
|
class RoleDefinition < RoleDefinitionAttributes
|
|
4
4
|
|
|
5
5
|
class << self
|
|
6
|
+
def find_all(options = {})
|
|
7
|
+
get "#{Security::KILLBILL_API_SECURITY_PREFIX}/roles",
|
|
8
|
+
{},
|
|
9
|
+
options
|
|
10
|
+
end
|
|
11
|
+
|
|
6
12
|
def find_by_name(role_name, options = {})
|
|
7
13
|
role = get "#{Security::KILLBILL_API_SECURITY_PREFIX}/roles/#{role_name}",
|
|
8
14
|
{},
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
require 'spec_helper'
|
|
2
|
+
|
|
3
|
+
describe KillBillClient::Model::RoleDefinition do
|
|
4
|
+
|
|
5
|
+
def json_response(body)
|
|
6
|
+
response = Net::HTTPOK.new('1.1', '200', 'OK')
|
|
7
|
+
response['Content-Type'] = 'application/json'
|
|
8
|
+
response.instance_variable_set(:@read, true)
|
|
9
|
+
response.instance_variable_set(:@body, body)
|
|
10
|
+
response
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe '.find_all' do
|
|
14
|
+
it 'lists the role definitions' do
|
|
15
|
+
body = [{'role' => 'admin', 'permissions' => ['account:create', 'invoice:view']},
|
|
16
|
+
{'role' => 'finance', 'permissions' => ['payment:view']}].to_json
|
|
17
|
+
|
|
18
|
+
expect(KillBillClient::API).to receive(:get)
|
|
19
|
+
.with('/1.0/kb/security/roles', {}, {:api_key => 'key'})
|
|
20
|
+
.and_return(json_response(body))
|
|
21
|
+
|
|
22
|
+
roles = KillBillClient::Model::RoleDefinition.find_all({:api_key => 'key'})
|
|
23
|
+
|
|
24
|
+
expect(roles.map(&:role)).to eq(%w(admin finance))
|
|
25
|
+
expect(roles.first).to be_a(KillBillClient::Model::RoleDefinition)
|
|
26
|
+
expect(roles.first.permissions).to eq(['account:create', 'invoice:view'])
|
|
27
|
+
expect(roles.last.permissions).to eq(['payment:view'])
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
it 'returns an empty list when there are no role definitions' do
|
|
31
|
+
allow(KillBillClient::API).to receive(:get).and_return(json_response('[]'))
|
|
32
|
+
|
|
33
|
+
expect(KillBillClient::Model::RoleDefinition.find_all).to be_empty
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
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: 4.0.
|
|
4
|
+
version: 4.0.11
|
|
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: 2026-
|
|
11
|
+
date: 2026-10-29 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: gem-release
|
|
@@ -210,6 +210,7 @@ files:
|
|
|
210
210
|
- spec/killbill_client/remote/model_spec.rb
|
|
211
211
|
- spec/killbill_client/resource_spec.rb
|
|
212
212
|
- spec/killbill_client/resources_spec.rb
|
|
213
|
+
- spec/killbill_client/role_definition_spec.rb
|
|
213
214
|
- spec/spec_helper.rb
|
|
214
215
|
homepage: http://www.killbilling.org
|
|
215
216
|
licenses:
|
|
@@ -232,7 +233,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
232
233
|
- !ruby/object:Gem::Version
|
|
233
234
|
version: '0'
|
|
234
235
|
requirements: []
|
|
235
|
-
rubygems_version: 3.4.
|
|
236
|
+
rubygems_version: 3.4.19
|
|
236
237
|
signing_key:
|
|
237
238
|
specification_version: 4
|
|
238
239
|
summary: Kill Bill client library.
|