casdoor-ruby-sdk 1.1.1 → 1.1.2

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: c7442875c53f487dff6e4968e27e7aec47b23a2143799305b7c324ca32594479
4
- data.tar.gz: 3fb25488582dc9fa39ee6ad226eab7514bc23ced81f946b3562a7e5fa9b5fb4d
3
+ metadata.gz: 9b4321645840f3099b3e3110a79eb81eae7cf082f5ffcf2165238f0ca172c6f9
4
+ data.tar.gz: 67ade61abfaf98aee3fc5cb8b2166e43696472f7b3d069b7eeb0993c68cef8e5
5
5
  SHA512:
6
- metadata.gz: de59e3233811816621ad27f50b3d8639e780f8ce1fbf50ca9e361e466f9458eb1ec455a990991ca7ed1af6f181331c1572583cb1df658fc6bee43020b01f2e15
7
- data.tar.gz: bc47f66464a2f7d9206e97437c8babb9aa99ea2a13e70c2798de0fdf701f1434f3ebdcb76f7985d2707872d443148dc0704ba557d1613f0775a1ec571017132e
6
+ metadata.gz: 8869f76745de4b3afefaa7a6c557e5db89c236b6ef39108127bdd08d0d44479b10ac6b9acd55e48f4292ac27a98bc370cfc1f8c05676358cb00f17947aa05577
7
+ data.tar.gz: e304a2c98279903e241ffcd3d1ec9412400da08b6ebd909944aac3c12e0efc5b089e320c7b62b359c5e40b9758b51bd3a3f8ae4756d108be732fdc6128b8a45f
@@ -29,8 +29,14 @@ module Casdoor
29
29
  get_pagination_objects('get-records', Record, organization_name, page, page_size, query_map)
30
30
  end
31
31
 
32
+ # Gets the record by name, or nil if it doesn't exist. Casdoor has no API to get a single record, so it searches
33
+ # the records by name. Like the other APIs that read records, it needs the access token of an admin user, see
34
+ # with_access_token().
32
35
  def get_record(name)
33
- get_object('get-record', Record, 'id' => get_id(name))
36
+ name = name.to_s.split('/').last.to_s
37
+ # The name filter matches the records whose names contain the given name
38
+ records, = get_pagination_records(1, 100, 'field' => 'name', 'value' => name)
39
+ records.find { |record| record.name == name }
34
40
  end
35
41
 
36
42
  def add_record(record)
@@ -33,8 +33,10 @@ module Casdoor
33
33
  get_object('get-transaction', Transaction, 'id' => get_id(name))
34
34
  end
35
35
 
36
+ # Casdoor has no get-user-transactions API, get-transactions filters the transactions by user
36
37
  def get_user_transactions(user_name)
37
- get_objects('get-user-transactions', Transaction, 'owner' => organization_name, 'user' => user_name)
38
+ get_objects('get-transactions', Transaction, 'owner' => organization_name, 'field' => 'user',
39
+ 'value' => user_name)
38
40
  end
39
41
 
40
42
  def update_transaction(transaction)
@@ -16,5 +16,5 @@
16
16
 
17
17
  module Casdoor
18
18
  # Set by semantic-release in CI when a new version is released, see .releaserc.json
19
- VERSION = '1.1.1'
19
+ VERSION = '1.1.2'
20
20
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: casdoor-ruby-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.1
4
+ version: 1.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yang Luo