warrant 0.1.1 → 0.1.2

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: 5243205fa7c1a3a21d681d66ab0071c2b71c95fb018a9812b7844919611c8b31
4
- data.tar.gz: f36c01ea86c7cb028b142fc30eae84824e6ef861915d3f71038052b704cedb8e
3
+ metadata.gz: 96189752075819b0a26871afd176789c4cd60293e934b638b5ecfff4b048c8c5
4
+ data.tar.gz: b3831fc0752a1a64ac0da49a9e585d3eef739196ed4a9a3deffb68d3277a7429
5
5
  SHA512:
6
- metadata.gz: 4675af03e0ca8a149e5b01c0a58a6e7f72064597c167a4a6ddef76e98975d321dcb0efe1feafe85df558207f070cbae2969dd3c84bafeaad35a99ad97aa9c31c
7
- data.tar.gz: 188ddcc865f033900b0f1b11e4ba49d11ce5a6ff01a0cc67387a07e0600e048ccbbbe75c0f6297a9b4eeefb9e759f71c3104d4fe5a8d2221610b649b56fad630
6
+ metadata.gz: a577fdd115b97e9f4a7518545c70b9ad9b3f54bfddad9b544bb56e4d431d4a06d6f0d9de2876496051c0f7c90311917788ed3d37545f19ae99e749422a59a06a
7
+ data.tar.gz: e8dd7505fa2ca83ed231602b0fee52eece2ca7e43b3783dc539d76f879e3d9058821c658e1af0c5aeb9544eadb5130aac4206d04b737c94c9ad36cce4d2ea0e6
data/README.md CHANGED
@@ -28,13 +28,13 @@ require 'warrant'
28
28
  Warrant.api_key = 'api_test_f5dsKVeYnVSLHGje44zAygqgqXiLJBICbFzCiAg1E='
29
29
  ```
30
30
 
31
- ### `createUser(user_id, username)`
31
+ ### `createUser(email, user_id, tenant_id)`
32
32
 
33
- This method creates a user entity in Warrant with the specified `userId`. Provide an optional `username` to make it easier to identify users in the Warrant dashboard.
33
+ This method creates a user entity in Warrant with the specified `email`, `user_id` (optional), and `tenant_id` (optional). If `user_id` is not provided, one will be generated for the user.
34
34
 
35
35
  ```ruby
36
36
  # Create user with `user.id` as the user_id and `user.email` as the username
37
- Warrant::WarrantClient.create_user(user.id, user.email)
37
+ Warrant::WarrantClient.create_user(user.email, user.id)
38
38
 
39
39
  # Create user with generated id
40
40
  Warrant::WarrantClient.create_user()
@@ -2,9 +2,10 @@
2
2
 
3
3
  module Warrant
4
4
  class UserWarrant
5
- attr_reader :object_type, :object_id, :relation, :user
5
+ attr_reader :id, :object_type, :object_id, :relation, :user
6
6
 
7
- def initialize(object_type, object_id, relation, user_id)
7
+ def initialize(id, object_type, object_id, relation, user_id)
8
+ @id = id
8
9
  @object_type = object_type
9
10
  @object_id = object_id
10
11
  @relation = relation
@@ -2,9 +2,10 @@
2
2
 
3
3
  module Warrant
4
4
  class UsersetWarrant
5
- attr_reader :object_type, :object_id, :relation, :user
5
+ attr_reader :id, :object_type, :object_id, :relation, :user
6
6
 
7
- def initialize(object_type, object_id, relation, user)
7
+ def initialize(id, object_type, object_id, relation, user)
8
+ @id = id
8
9
  @object_type = object_type
9
10
  @object_id = object_id
10
11
  @relation = relation
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Warrant
4
- VERSION = "0.1.1"
4
+ VERSION = "0.1.2"
5
5
  end
@@ -107,15 +107,27 @@ module Warrant
107
107
  case res
108
108
  when Net::HTTPSuccess
109
109
  if res_json['user']['userId']
110
- UserWarrant.new(res_json['objectType'], res_json['objectId'], res_json['relation'], res_json['user']['userId'])
110
+ UserWarrant.new(res_json['id'], res_json['objectType'], res_json['objectId'], res_json['relation'], res_json['user']['userId'])
111
111
  elsif res_json['user']['objectType']
112
- UsersetWarrant.new(res_json['objectType'], res_json['objectId'], res_json['relation'], res_json['user'])
112
+ UsersetWarrant.new(res_json['id'], res_json['objectType'], res_json['objectId'], res_json['relation'], res_json['user'])
113
113
  end
114
114
  else
115
115
  res_json
116
116
  end
117
117
  end
118
118
 
119
+ def delete_warrant(warrant_id)
120
+ uri = URI.parse("#{Warrant.config.api_base}/v1/warrants/#{warrant_id}")
121
+ res = delete(uri)
122
+
123
+ case res
124
+ when Net::HTTPSuccess
125
+ return
126
+ else
127
+ res_json
128
+ end
129
+ end
130
+
119
131
  def assign_role_to_user(user_id, role_id)
120
132
  uri = URI.parse("#{Warrant.config.api_base}/v1/users/#{user_id}/roles/#{role_id}")
121
133
  res = post(uri)
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: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Warrant
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-01-26 00:00:00.000000000 Z
11
+ date: 2022-05-05 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