warrant 2.0.0 → 2.1.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
2
  SHA256:
3
- metadata.gz: 1a31b7215d1f5c43c9324a9456bfeed330a0c6656e899f670be1a41a9a9ab0a0
4
- data.tar.gz: a8b43559d231b5a54ab06ff22fdd37ce9123f0bc1442523d23cecf936da56aea
3
+ metadata.gz: 78f048c8c4f4611aafd280b84cce9cd09d8d664b6892030ec564bf34b80215ea
4
+ data.tar.gz: bba96bc3e9c504487af9b5ebad98b673b3592eb9b72fecba81ebf33e52ae54de
5
5
  SHA512:
6
- metadata.gz: 7e931736321f72d8ed39331104a5a72a3ebc85680b21659edd6eefc0ade2cd93206bd32865ebb0df51020f3067fc93e6136866c407ebe14d52fd6758019cadd8
7
- data.tar.gz: 8a273c5d903a66e3e5fc8a4d7bba657f2e3c6b9188f0ebe8cc25b27e2dda361e139eb62a9651ab0650026ba1b400c2bd3615346cffdfeda1e8352ec3123dd9e7
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, :is_direct_match
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, is_direct_match = 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
- @is_direct_match = is_direct_match
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] :object_type The type of object. Must be one of your system's existing object types. (optional)
94
- # @option params [String] :relation The relation for this object to subject association. The relation must be valid as per the object type definition. (optional)
95
- # @option params [String] :subject The subject to query warrants for. This should be in the format `OBJECT_TYPE:OBJECT_ID`, i.e. `user:8`
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['isDirectMatch'])
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)
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Warrant
4
- VERSION = "2.0.0"
4
+ VERSION = "2.1.0"
5
5
  end
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.0.0
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: 2022-12-22 00:00:00.000000000 Z
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