warrant 2.0.0 → 2.1.0
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/lib/warrant/models/warrant.rb +7 -13
- data/lib/warrant/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 78f048c8c4f4611aafd280b84cce9cd09d8d664b6892030ec564bf34b80215ea
|
4
|
+
data.tar.gz: bba96bc3e9c504487af9b5ebad98b673b3592eb9b72fecba81ebf33e52ae54de
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0e4a8f1e22266df4957bbd40f45c0d42a336a13091d33cccb40482d632f98b494f05218de73c61a5bb85216116595751f5fc331f626afc3b6d7ea5ae017cf581
|
7
|
+
data.tar.gz: b4f41491a47957d3bfb888231e2b110d70d0fad7e24ff82a4f64a51460dd4a78fd8ab8a86d26b20433ff8ff403ca3f5b9051d976f1b0adb6869e98f92a08cecc
|
@@ -2,16 +2,16 @@
|
|
2
2
|
|
3
3
|
module Warrant
|
4
4
|
class Warrant
|
5
|
-
attr_reader :id, :object_type, :object_id, :relation, :subject, :context, :
|
5
|
+
attr_reader :id, :object_type, :object_id, :relation, :subject, :context, :is_implicit
|
6
6
|
|
7
7
|
# @!visibility private
|
8
|
-
def initialize(object_type, object_id, relation, subject, context = nil,
|
8
|
+
def initialize(object_type, object_id, relation, subject, context = nil, is_implicit = nil)
|
9
9
|
@object_type = object_type
|
10
10
|
@object_id = object_id
|
11
11
|
@relation = relation
|
12
12
|
@subject = subject
|
13
13
|
@context = context
|
14
|
-
@
|
14
|
+
@is_implicit = is_implicit
|
15
15
|
end
|
16
16
|
|
17
17
|
# Create a new warrant that associates an object (object_type and object_id) to a subject via a relation.
|
@@ -90,14 +90,9 @@ module Warrant
|
|
90
90
|
|
91
91
|
# Query to find all warrants for a given subject.
|
92
92
|
#
|
93
|
-
# @option params [String] :
|
94
|
-
# @option params [String] :
|
95
|
-
# @option params [String] :
|
96
|
-
# * subject (Hash) - The specific subject for which warrants will be queried for.
|
97
|
-
# * object_type (String) - The type of object. Must be one of your system's existing object types.
|
98
|
-
# * object_id (String) - The id of the specific object.
|
99
|
-
# @option params [Integer] :page A positive integer (starting with 1) representing the page of items to return in response. Used in conjunction with the limit param. (optional)
|
100
|
-
# @option params [Integer] :limit A positive integer representing the max number of items to return in response. (optional)
|
93
|
+
# @option params [String] :select Specifies the type of results to be returned by the query. Optionally, the `explicit` keyword can be provided (i.e. `explicit warrants`) to specify that only explicit results be returned. By default, both implicit and explicit results are returned.
|
94
|
+
# @option params [String] :for A list of conditions specifying which resources to query results for (i.e. "get all warrants **for role:admin**"). Only those warrants matching **all** of the conditions in the `for` clause are selected. If the `explicit` keyword is not specified in the `select` param, the resulting warrants are then expanded to determine if they imply other warrants (i.e. "the owner of a report is also an editor of that report"). Must be zero or more comma separated values in the format `object|relation|subject|context = val`. For object and subject filters, you can filter on all object ids by using the `*` character (i.e. `role:*`). (optional)
|
95
|
+
# @option params [String] :where A list of conditions to be applied to the result set before it is returned. If a where clause is provided, the query will only return results matching **all** conditions. Must be zero or more comma separated values in the format `object|relation|subject|context = val``. For object and subject filters, you can filter on all object ids by using the `*` character, i.e. `role:*`. (optional)
|
101
96
|
#
|
102
97
|
# @return [Array<Warrant>] list of all warrants with provided params
|
103
98
|
#
|
@@ -107,7 +102,6 @@ module Warrant
|
|
107
102
|
# @raise [Warrant::UnauthorizedError]
|
108
103
|
# @raise [Warrant::WarrantError]
|
109
104
|
def self.query(params = {})
|
110
|
-
params[:subject] = Subject.new_from_hash(params[:subject])
|
111
105
|
res = APIOperations.get(URI.parse("#{::Warrant.config.api_base}/v1/query"), params)
|
112
106
|
|
113
107
|
case res
|
@@ -115,7 +109,7 @@ module Warrant
|
|
115
109
|
warrants = JSON.parse(res.body)
|
116
110
|
warrants.map{ |warrant|
|
117
111
|
subject = Subject.new(warrant['subject']['objectType'], warrant['subject']['objectId'], warrant['subject']['relation'])
|
118
|
-
Warrant.new(warrant['objectType'], warrant['objectId'], warrant['relation'], subject, warrant['context'], warrant['
|
112
|
+
Warrant.new(warrant['objectType'], warrant['objectId'], warrant['relation'], subject, warrant['context'], warrant['isImplicit'])
|
119
113
|
}
|
120
114
|
else
|
121
115
|
APIOperations.raise_error(res)
|
data/lib/warrant/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: warrant
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 2.
|
4
|
+
version: 2.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Warrant
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2023-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Ruby library for the Warrant API at https://warrant.dev.
|
14
14
|
email: hello@warrant.dev
|