oauth_im 0.15.2 → 0.15.4

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: 4749aa8af3a4a6985c6d1d75993628037546650a37763713dc832a2c8e42336e
4
- data.tar.gz: 9bb51b3e52a787b8983a2de1eb979e2e60175bef2627cfbfb9b395101de17133
3
+ metadata.gz: 340c3017228bd8deac795d9b39c291a9f0d20662c213c0e04c503fd22bcb5bc4
4
+ data.tar.gz: 867e207345538f7861d140874f5d95481867b15292b8cbeb6854d74aa36d0bb8
5
5
  SHA512:
6
- metadata.gz: 053b4ff02c5542685dfabd6d58dfd2a0effc15f40a407b91674028b785f5238a88ff8530d2b8182d34bcce5847fa37a8a421643494a7de27873b8594dd4d3216
7
- data.tar.gz: 6453b5f666529f3b8d4323e2899bf9bf03d7bb527accde2195479d84504b6c6adf08398920dad800ebbbce984be87060fb52e35724633a9aa4d0f21872d6a7bf
6
+ metadata.gz: e19cb411c221a5c6300ab9e0fdbc1d2c45fc2d052d94d700d666e82de8bc5d3d034062e17c9115a2a391c97dfed9a929a74e5faf60dd75cded1ac5b199236eaa
7
+ data.tar.gz: 29119e6529f226beb84eecfda8bfc0f30c001c67e9f33067a9a1d209d27d4b4dda34b125f2b7a252f8a10d08eac9e835a9b65205995b3910ec204a3402025bcf
@@ -28,31 +28,37 @@ module OauthIm
28
28
  private
29
29
 
30
30
  def user_attrs_for(response)
31
- response.success_response.then do |results|
32
- results&.users.presence ||
33
- [results&.user.presence].compact
31
+ users_for(response).map do |attrs|
32
+ attrs
33
+ .to_h
34
+ .with_indifferent_access
35
+ .merge api_key: api_key,
36
+ idp_url: idp_url
34
37
  end
35
38
  end
36
39
 
40
+ def users_for(response)
41
+ results = response.success_response
42
+ [results&.users, results&.user].flatten.compact
43
+ end
44
+
37
45
  def proxy_users_for(response)
38
46
  user_attrs_for(response).map { |attrs| ProxyUser.new(attrs) }
39
47
  end
40
48
 
41
49
  def search(term:, query:, limit:, offset:)
42
- proxy_users_for client.search_users_by_query(
43
- search: search_params(
44
- term: term, query: query, limit: limit, offset: offset
45
- )
46
- )
50
+ search_query = search_params_for term: term,
51
+ query: query,
52
+ limit: limit,
53
+ offset: offset
54
+ proxy_users_for client.search_users_by_query search: search_query
47
55
  end
48
56
 
49
- def search_params(term:, query:, limit:, offset:)
50
- {
51
- numberOfResults: limit,
57
+ def search_params_for(term:, query:, limit:, offset:)
58
+ { numberOfResults: limit,
52
59
  startRow: offset,
53
60
  queryString: term,
54
- query: query&.to_json
55
- }.reject { |_key, val| val.blank? }
61
+ query: query&.to_json }.reject { |_key, val| val.blank? }
56
62
  end
57
63
  end
58
64
  end
@@ -11,7 +11,6 @@ require 'fusionauth/fusionauth_client'
11
11
 
12
12
  module OauthIm
13
13
  module HasRegistrationData
14
- delegate :email, to: :attrs
15
14
  delegate :role, :grade_level, :school, :district, :state,
16
15
  to: :registration_data
17
16
  delegate :name, :id,
@@ -25,6 +24,10 @@ module OauthIm
25
24
  delegate :name, :id,
26
25
  to: :state, prefix: true
27
26
 
27
+ def email
28
+ attrs[:email]
29
+ end
30
+
28
31
  def registrations
29
32
  attrs[:registrations] || []
30
33
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module OauthIm
4
- VERSION = '0.15.2'
4
+ VERSION = '0.15.4'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oauth_im
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.15.2
4
+ version: 0.15.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Eric Connally
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-06-12 00:00:00.000000000 Z
11
+ date: 2024-06-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fusionauth_client