warrant 2.0.0.rc3 → 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: 4843a74fe1b3946f08604adac74e8aaea3f62d78cf8c737675c04a95b276703d
4
- data.tar.gz: 27a4e728b04fef498d7ff4b7e1c030d5ccbc10f5272aec4a8ccb4be15c22b836
3
+ metadata.gz: 78f048c8c4f4611aafd280b84cce9cd09d8d664b6892030ec564bf34b80215ea
4
+ data.tar.gz: bba96bc3e9c504487af9b5ebad98b673b3592eb9b72fecba81ebf33e52ae54de
5
5
  SHA512:
6
- metadata.gz: 93c04647e27e78c116990c3980fbee91057d3bae5cdbd7fe9711e50585476f91919cc5a24e98f1abab6cdbcd0848eca3e20a74b1af7fae6f58d2e973d2b080a9
7
- data.tar.gz: 01cfa6e56f75d458e41f39af8b8190e76205cf9f93c69107fab52e0645ffbef5a0a8de9333e0a729c95725b2010e0cb874016d7191225d0ba68bd86e967ad667
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.rc3"
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.rc3
4
+ version: 2.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Warrant
8
- autorequire:
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
@@ -49,7 +49,7 @@ metadata:
49
49
  source_code_uri: https://github.com/warrant-dev/warrant-ruby
50
50
  changelog_uri: https://github.com/warrant-dev/warrant-ruby/CHANGELOG.md
51
51
  documentation_uri: https://docs.warrant.dev/
52
- post_install_message:
52
+ post_install_message:
53
53
  rdoc_options: []
54
54
  require_paths:
55
55
  - lib
@@ -60,12 +60,12 @@ required_ruby_version: !ruby/object:Gem::Requirement
60
60
  version: 2.3.0
61
61
  required_rubygems_version: !ruby/object:Gem::Requirement
62
62
  requirements:
63
- - - ">"
63
+ - - ">="
64
64
  - !ruby/object:Gem::Version
65
- version: 1.3.1
65
+ version: '0'
66
66
  requirements: []
67
- rubygems_version: 3.1.4
68
- signing_key:
67
+ rubygems_version: 3.2.33
68
+ signing_key:
69
69
  specification_version: 4
70
70
  summary: Warrant Ruby Library
71
71
  test_files: []