folio_client 0.13.0 → 0.14.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: c3b597d27e912d256a895af940e312d24e85acf5c234f48788c6716a4e8947de
4
- data.tar.gz: 9700fb07ff086e5b6c833897abd921adaa8efd19e173c8948484ad5d554614a2
3
+ metadata.gz: 52b3024a210528d439f1d65a9e8a0b62b1b5359d0ae639612f46b7f2808759e2
4
+ data.tar.gz: 168ccfccfa8155171bd0ccba099ad91bd16533ea148b87867f6df3fd3aa617fb
5
5
  SHA512:
6
- metadata.gz: a8256c90e8c80390e5536d4c988140d30074481d6d8b958a3e8321b81e6dc0f2f7634f3e5253abe7c9b60b22fbebb5246fe6f9052c93b658d621a108a1598ff9
7
- data.tar.gz: 99e52e340c66cc0233e577e73840880c2a0f9b2eea758b42418784124a524d1c7d1fc73ede20dd8bdd77aa0d69f44843eebd0f82e08067306b687b0082dc326b
6
+ metadata.gz: 618c561b2f7f69baa03733e9a4f1cca3cf50e3d2bdc98924a9d759639634e98fc2f27f8868c8876eab034da6963976d58e54d396f39379f9e9223a762584490a
7
+ data.tar.gz: f0ddf15d1b38e14f3e8b506fbf6aa6249b05c77c35192c7a0315307e6ffe48c586ed66863f200279360217f8edc15f705c8d83b0d7c0c710a1ab9b047ec35f6f
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- folio_client (0.13.0)
4
+ folio_client (0.14.0)
5
5
  activesupport (>= 4.2, < 8)
6
6
  dry-monads
7
7
  faraday
@@ -11,21 +11,30 @@ PATH
11
11
  GEM
12
12
  remote: https://rubygems.org/
13
13
  specs:
14
- activesupport (7.0.8)
14
+ activesupport (7.1.1)
15
+ base64
16
+ bigdecimal
15
17
  concurrent-ruby (~> 1.0, >= 1.0.2)
18
+ connection_pool (>= 2.2.5)
19
+ drb
16
20
  i18n (>= 1.6, < 2)
17
21
  minitest (>= 5.1)
22
+ mutex_m
18
23
  tzinfo (~> 2.0)
19
24
  addressable (2.8.5)
20
25
  public_suffix (>= 2.0.2, < 6.0)
21
26
  ast (2.4.2)
22
27
  base64 (0.1.1)
28
+ bigdecimal (3.1.4)
23
29
  byebug (11.1.3)
24
30
  concurrent-ruby (1.2.2)
31
+ connection_pool (2.4.1)
25
32
  crack (0.4.5)
26
33
  rexml
27
34
  diff-lcs (1.5.0)
28
35
  docile (1.4.0)
36
+ drb (2.1.1)
37
+ ruby2_keywords
29
38
  dry-core (1.0.1)
30
39
  concurrent-ruby (~> 1.0)
31
40
  zeitwerk (~> 2.6)
@@ -49,15 +58,16 @@ GEM
49
58
  scrub_rb (>= 1.0.1, < 2)
50
59
  unf
51
60
  minitest (5.20.0)
61
+ mutex_m (0.1.2)
52
62
  parallel (1.23.0)
53
- parser (3.2.2.3)
63
+ parser (3.2.2.4)
54
64
  ast (~> 2.4.1)
55
65
  racc
56
66
  public_suffix (5.0.3)
57
- racc (1.7.1)
67
+ racc (1.7.3)
58
68
  rainbow (3.1.1)
59
- rake (13.0.6)
60
- regexp_parser (2.8.1)
69
+ rake (13.1.0)
70
+ regexp_parser (2.8.2)
61
71
  rexml (3.2.6)
62
72
  rspec (3.12.0)
63
73
  rspec-core (~> 3.12.0)
@@ -84,7 +94,7 @@ GEM
84
94
  rubocop-ast (>= 1.28.1, < 2.0)
85
95
  ruby-progressbar (~> 1.7)
86
96
  unicode-display_width (>= 2.4.0, < 3.0)
87
- rubocop-ast (1.29.0)
97
+ rubocop-ast (1.30.0)
88
98
  parser (>= 3.2.1.0)
89
99
  rubocop-capybara (2.19.0)
90
100
  rubocop (~> 1.41)
@@ -93,8 +103,8 @@ GEM
93
103
  rubocop-performance (1.19.1)
94
104
  rubocop (>= 1.7.0, < 2.0)
95
105
  rubocop-ast (>= 0.4.0)
96
- rubocop-rspec (2.24.1)
97
- rubocop (~> 1.33)
106
+ rubocop-rspec (2.25.0)
107
+ rubocop (~> 1.40)
98
108
  rubocop-capybara (~> 2.17)
99
109
  rubocop-factory_bot (~> 2.22)
100
110
  ruby-progressbar (1.13.0)
@@ -106,18 +116,18 @@ GEM
106
116
  simplecov_json_formatter (~> 0.1)
107
117
  simplecov-html (0.12.3)
108
118
  simplecov_json_formatter (0.1.4)
109
- standard (1.31.1)
119
+ standard (1.31.2)
110
120
  language_server-protocol (~> 3.17.0.2)
111
121
  lint_roller (~> 1.0)
112
- rubocop (~> 1.56.2)
122
+ rubocop (~> 1.56.4)
113
123
  standard-custom (~> 1.0.0)
114
124
  standard-performance (~> 1.2)
115
125
  standard-custom (1.0.2)
116
126
  lint_roller (~> 1.0)
117
127
  rubocop (~> 1.50)
118
- standard-performance (1.2.0)
128
+ standard-performance (1.2.1)
119
129
  lint_roller (~> 1.1)
120
- rubocop-performance (~> 1.19.0)
130
+ rubocop-performance (~> 1.19.1)
121
131
  tzinfo (2.0.6)
122
132
  concurrent-ruby (~> 1.0)
123
133
  unf (0.1.4)
data/README.md CHANGED
@@ -123,6 +123,47 @@ client.interface_details(id: 'c6f7470e-6229-45ce-b3f9-32006e9affcf')
123
123
  "createdByUserId"=>"38524916-598d-4edf-a2ef-04bba7e78ad6",
124
124
  "updatedDate"=>"2023-02-16T22:27:51.515+00:00",
125
125
  "updatedByUserId"=>"38524916-598d-4edf-a2ef-04bba7e78ad6"}}
126
+
127
+ # Get list of users (filtered with an optional query)
128
+ # see https://s3.amazonaws.com/foliodocs/api/mod-users/r/users.html#users_get
129
+ client.users(query: 'username=="test*"')
130
+ => {"users"=>
131
+ [{"username"=>"testing",
132
+ "id"=>"bbbadd51-c2f1-4107-a54d-52b39087725c",
133
+ "externalSystemId"=>"00324439",
134
+ "barcode"=>"2559202566",
135
+ "active"=>false,
136
+ "departments"=>[],
137
+ "proxyFor"=>[],
138
+ "personal"=>
139
+ {"lastName"=>"Testing",
140
+ "firstName"=>"Test",
141
+ "email"=>"foliotesting@lists.stanford.edu",
142
+ "addresses"=>
143
+ [{"countryId"=>"US",
144
+ "addressLine1"=>"13 Fake St",
145
+ "city"=>"Palo Alto",
146
+ "region"=>"California",
147
+ "postalCode"=>"94301",
148
+ "addressTypeId"=>"93d3d88d-499b-45d0-9bc7-ac73c3a19880",
149
+ "primaryAddress"=>true}]},
150
+ "createdDate"=>"2023-10-01T08:50:37.203+00:00",
151
+ "updatedDate"=>"2023-10-01T08:50:37.203+00:00",
152
+ "metadata"=>
153
+ {"createdDate"=>"2023-09-02T02:51:43.448+00:00",
154
+ "createdByUserId"=>"58d0aaf6-dcda-4d5e-92da-012e6b7dd766",
155
+ "updatedDate"=>"2023-10-01T08:50:37.196+00:00",
156
+ "updatedByUserId"=>"58d0aaf6-dcda-4d5e-92da-012e6b7dd766"},
157
+ "customFields"=>{"affiliation"=>"affiliate:sponsored"}}],
158
+ "totalRecords"=>1,
159
+ "resultInfo"=>{"totalRecords"=>1, "facets"=>[], "diagnostics"=>[]}}
160
+
161
+ # Get specific user info
162
+ # see https://s3.amazonaws.com/foliodocs/api/mod-users/r/users.html#users_get
163
+ client.user_details(id: 'bbbadd51-c2f1-4107-a54d-52b39087725c')
164
+ => {"username"=>"testing",
165
+ "id"=>"bbbadd51-c2f1-4107-a54d-52b39087725c",
166
+ "externalSystemId"=>"00324439", ... # same response as above, but for single user
126
167
  ```
127
168
 
128
169
  ## Development
data/api_test.rb CHANGED
@@ -23,6 +23,8 @@ pp(client.fetch_marc_hash(instance_hrid: "a666"))
23
23
  puts client.fetch_marc_xml(instance_hrid: "a666")
24
24
  puts client.fetch_marc_xml(barcode: "20503330279")
25
25
 
26
+ puts client.users(query: 'username=="pet*"')
27
+
26
28
  records = marc_files.flat_map do |marc_file_path|
27
29
  MARC::Reader.new(marc_file_path).to_a
28
30
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ class FolioClient
4
+ # Query user records in Folio; see
5
+ # https://s3.amazonaws.com/foliodocs/api/mod-users/r/users.html
6
+ class Users
7
+ attr_accessor :client
8
+
9
+ # @param client [FolioClient] the configured client
10
+ def initialize(client)
11
+ @client = client
12
+ end
13
+
14
+ # @param query [String] an optional query to limit the number of users returned
15
+ # @param limit [Integer] the number of results to return (defaults to 10,000)
16
+ # @param offset [Integer] the offset for results returned (defaults to 0)
17
+ # @param lang [String] language code for returned results (defaults to 'en')
18
+ def fetch_list(query: nil, limit: 10000, offset: 0, lang: "en")
19
+ params = {limit: limit, offset: offset, lang: lang}
20
+ params[:query] = query if query
21
+ client.get("/users", params)
22
+ end
23
+
24
+ # @param id [String] id for requested user
25
+ # @param lang [String] language code for returned results (defaults to 'en')
26
+ def fetch_user_details(id:, lang: "en")
27
+ client.get("/users/#{id}", {
28
+ lang: lang
29
+ })
30
+ end
31
+ end
32
+ end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class FolioClient
4
- VERSION = "0.13.0"
4
+ VERSION = "0.14.0"
5
5
  end
data/lib/folio_client.rb CHANGED
@@ -75,7 +75,8 @@ class FolioClient
75
75
  :edit_marc_json, :fetch_external_id, :fetch_hrid, :fetch_instance_info,
76
76
  :fetch_marc_hash, :fetch_marc_xml, :get, :has_instance_status?,
77
77
  :http_get_headers, :http_post_and_put_headers, :interface_details,
78
- :job_profiles, :organization_interfaces, :organizations, :post, :put, to:
78
+ :job_profiles, :organization_interfaces, :organizations, :users, :user_details,
79
+ :post, :put, to:
79
80
  :instance end
80
81
 
81
82
  attr_accessor :config
@@ -232,6 +233,20 @@ class FolioClient
232
233
  .fetch_interface_details(...)
233
234
  end
234
235
 
236
+ # @see Users#fetch_list
237
+ def users(...)
238
+ Users
239
+ .new(self)
240
+ .fetch_list(...)
241
+ end
242
+
243
+ # @see Users#fetch_user_details
244
+ def user_details(...)
245
+ Users
246
+ .new(self)
247
+ .fetch_user_details(...)
248
+ end
249
+
235
250
  def default_timeout
236
251
  120
237
252
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: folio_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.13.0
4
+ version: 0.14.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Mangiafico
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-10-04 00:00:00.000000000 Z
11
+ date: 2023-11-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: activesupport
@@ -198,6 +198,7 @@ files:
198
198
  - lib/folio_client/records_editor.rb
199
199
  - lib/folio_client/source_storage.rb
200
200
  - lib/folio_client/unexpected_response.rb
201
+ - lib/folio_client/users.rb
201
202
  - lib/folio_client/version.rb
202
203
  homepage: https://github.com/sul-dlss/folio_client
203
204
  licenses: []
@@ -221,7 +222,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
221
222
  - !ruby/object:Gem::Version
222
223
  version: '0'
223
224
  requirements: []
224
- rubygems_version: 3.4.19
225
+ rubygems_version: 3.4.21
225
226
  signing_key:
226
227
  specification_version: 4
227
228
  summary: Interface for interacting with the Folio ILS API.