killbill-client 4.0.10 → 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
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
|
|
@@ -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-10-
|
|
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:
|