folio_client 0.18.0 → 0.19.0

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: 42f8788a27374e443881099b77bfaa24961f0d38cd7577c36bc85005070a6981
4
- data.tar.gz: 794a03e9de4d8bb2987efe8889653fdf2b3f043c518f200783310479a6fc02bf
3
+ metadata.gz: 548e644e584af5ba697c8c626c9dace7e06115106068e67ae8b4fbc49c1daa98
4
+ data.tar.gz: 5ae2b2251ffb4814ea8ed4bab229fc5d4349769b6a2b2ad271cbec10e8526da4
5
5
  SHA512:
6
- metadata.gz: fab85671e97be76c1c39d0a4e30b5cf0fe48aaa6794b4d59e4f37b4197bd287e4aa7cf1433a2235205625980b86ce6c45d21790baa0734f1ae4a296d0cd62a45
7
- data.tar.gz: bf7584bc2416dec88e566b8bfca6f0b69f8d1b6347621f24d8d41ac30ed06e5e503570b5678609847f420f40a4e2a400cd1aa3421beafb73358f2781a8e6e809
6
+ metadata.gz: 6b8a03e8784b4e730d066960659a034fe3bc4d95ef4b81f792f29b5a353540aa1fae72970ee65f99a7859d8eeddfb3076ef5153fff51000ebabe296d4e2fb959
7
+ data.tar.gz: e6ad98a7fb6dd23c15400b9827f68059079fc845d2bfde25cd9bd518249ef5ce6c43edc440520d7aed36ab6dbf4c5e26ee133e56ca51a795922ec23a634a774a
data/.rubocop.yml CHANGED
@@ -1,9 +1,9 @@
1
- require:
1
+ plugins:
2
2
  - rubocop-capybara
3
3
  - rubocop-factory_bot
4
+ - rubocop-rspec_rails
4
5
  - rubocop-performance
5
6
  - rubocop-rspec
6
- - rubocop-rspec_rails
7
7
 
8
8
  AllCops:
9
9
  TargetRubyVersion: 3.0
@@ -403,3 +403,43 @@ FactoryBot/ExcessiveCreateList: # new in 2.25
403
403
  Enabled: true
404
404
  Performance/StringBytesize: # new in 1.23
405
405
  Enabled: true
406
+
407
+ Lint/ArrayLiteralInRegexp: # new in 1.71
408
+ Enabled: true
409
+ Lint/CopDirectiveSyntax: # new in 1.72
410
+ Enabled: true
411
+ Lint/RedundantTypeConversion: # new in 1.72
412
+ Enabled: true
413
+ Lint/SuppressedExceptionInNumberConversion: # new in 1.72
414
+ Enabled: true
415
+ Lint/UselessConstantScoping: # new in 1.72
416
+ Enabled: true
417
+ Style/HashSlice: # new in 1.71
418
+ Enabled: true
419
+ Style/RedundantFormat: # new in 1.72
420
+ Enabled: true
421
+ Performance/ZipWithoutBlock: # new in 1.24
422
+ Enabled: true
423
+
424
+ Lint/UselessDefaultValueArgument: # new in 1.76
425
+ Enabled: true
426
+ Lint/UselessOr: # new in 1.76
427
+ Enabled: true
428
+ Naming/PredicateMethod: # new in 1.76
429
+ Enabled: true
430
+ Style/ComparableBetween: # new in 1.74
431
+ Enabled: true
432
+ Style/EmptyStringInsideInterpolation: # new in 1.76
433
+ Enabled: true
434
+ Style/HashFetchChain: # new in 1.75
435
+ Enabled: true
436
+ Style/ItBlockParameter: # new in 1.75
437
+ Enabled: true
438
+ Style/RedundantArrayFlatten: # new in 1.76
439
+ Enabled: true
440
+ RSpec/IncludeExamples: # new in 3.6
441
+ Enabled: true
442
+ Capybara/FindAllFirst: # new in 2.22
443
+ Enabled: true
444
+ Capybara/NegationMatcherAfterVisit: # new in 2.22
445
+ Enabled: true
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- folio_client (0.18.0)
4
+ folio_client (0.19.0)
5
5
  activesupport (>= 4.2)
6
6
  dry-monads
7
7
  faraday
@@ -12,141 +12,155 @@ PATH
12
12
  GEM
13
13
  remote: https://rubygems.org/
14
14
  specs:
15
- activesupport (8.0.1)
15
+ activesupport (8.1.2)
16
16
  base64
17
- benchmark (>= 0.3)
18
17
  bigdecimal
19
18
  concurrent-ruby (~> 1.0, >= 1.3.1)
20
19
  connection_pool (>= 2.2.5)
21
20
  drb
22
21
  i18n (>= 1.6, < 2)
22
+ json
23
23
  logger (>= 1.4.2)
24
24
  minitest (>= 5.1)
25
25
  securerandom (>= 0.3)
26
26
  tzinfo (~> 2.0, >= 2.0.5)
27
27
  uri (>= 0.13.1)
28
- addressable (2.8.7)
29
- public_suffix (>= 2.0.2, < 7.0)
30
- ast (2.4.2)
31
- base64 (0.2.0)
32
- benchmark (0.4.0)
33
- bigdecimal (3.1.9)
34
- byebug (11.1.3)
35
- concurrent-ruby (1.3.5)
36
- connection_pool (2.5.0)
37
- crack (1.0.0)
28
+ addressable (2.8.8)
29
+ public_suffix (>= 2.0.2, < 8.0)
30
+ ast (2.4.3)
31
+ base64 (0.3.0)
32
+ bigdecimal (4.0.1)
33
+ byebug (13.0.0)
34
+ reline (>= 0.6.0)
35
+ concurrent-ruby (1.3.6)
36
+ connection_pool (3.0.2)
37
+ crack (1.0.1)
38
38
  bigdecimal
39
39
  rexml
40
- diff-lcs (1.5.1)
40
+ diff-lcs (1.6.2)
41
41
  docile (1.4.1)
42
42
  domain_name (0.6.20240107)
43
- drb (2.2.1)
44
- dry-core (1.1.0)
43
+ drb (2.2.3)
44
+ dry-core (1.2.0)
45
45
  concurrent-ruby (~> 1.0)
46
46
  logger
47
47
  zeitwerk (~> 2.6)
48
- dry-monads (1.7.1)
48
+ dry-monads (1.9.0)
49
49
  concurrent-ruby (~> 1.0)
50
50
  dry-core (~> 1.1)
51
51
  zeitwerk (~> 2.6)
52
- faraday (2.12.2)
52
+ faraday (2.14.0)
53
53
  faraday-net_http (>= 2.0, < 3.5)
54
54
  json
55
55
  logger
56
- faraday-cookie_jar (0.0.7)
56
+ faraday-cookie_jar (0.0.8)
57
57
  faraday (>= 0.8.0)
58
- http-cookie (~> 1.0.0)
59
- faraday-net_http (3.4.0)
60
- net-http (>= 0.5.0)
61
- hashdiff (1.1.2)
62
- http-cookie (1.0.8)
58
+ http-cookie (>= 1.0.0)
59
+ faraday-net_http (3.4.2)
60
+ net-http (~> 0.5)
61
+ hashdiff (1.2.1)
62
+ http-cookie (1.1.0)
63
63
  domain_name (~> 0.5)
64
- i18n (1.14.7)
64
+ i18n (1.14.8)
65
65
  concurrent-ruby (~> 1.0)
66
- json (2.9.1)
67
- language_server-protocol (3.17.0.4)
68
- logger (1.6.6)
69
- marc (1.3.0)
66
+ io-console (0.8.2)
67
+ json (2.18.0)
68
+ language_server-protocol (3.17.0.5)
69
+ lint_roller (1.1.0)
70
+ logger (1.7.0)
71
+ marc (1.4.0)
70
72
  nokogiri (~> 1.0)
71
73
  rexml
72
- minitest (5.25.4)
73
- net-http (0.6.0)
74
- uri
75
- nokogiri (1.18.2-arm64-darwin)
74
+ minitest (6.0.1)
75
+ prism (~> 1.5)
76
+ net-http (0.9.1)
77
+ uri (>= 0.11.1)
78
+ nokogiri (1.19.0-arm64-darwin)
76
79
  racc (~> 1.4)
77
- nokogiri (1.18.2-x86_64-darwin)
80
+ nokogiri (1.19.0-x86_64-darwin)
78
81
  racc (~> 1.4)
79
- nokogiri (1.18.2-x86_64-linux-gnu)
82
+ nokogiri (1.19.0-x86_64-linux-gnu)
80
83
  racc (~> 1.4)
81
- parallel (1.26.3)
82
- parser (3.3.7.1)
84
+ parallel (1.27.0)
85
+ parser (3.3.10.1)
83
86
  ast (~> 2.4.1)
84
87
  racc
85
- public_suffix (6.0.1)
88
+ prism (1.9.0)
89
+ public_suffix (7.0.2)
86
90
  racc (1.8.1)
87
91
  rainbow (3.1.1)
88
- rake (13.2.1)
89
- regexp_parser (2.10.0)
90
- rexml (3.4.0)
91
- rspec (3.13.0)
92
+ rake (13.3.1)
93
+ regexp_parser (2.11.3)
94
+ reline (0.6.3)
95
+ io-console (~> 0.5)
96
+ rexml (3.4.4)
97
+ rspec (3.13.2)
92
98
  rspec-core (~> 3.13.0)
93
99
  rspec-expectations (~> 3.13.0)
94
100
  rspec-mocks (~> 3.13.0)
95
- rspec-core (3.13.3)
101
+ rspec-core (3.13.6)
96
102
  rspec-support (~> 3.13.0)
97
- rspec-expectations (3.13.3)
103
+ rspec-expectations (3.13.5)
98
104
  diff-lcs (>= 1.2.0, < 2.0)
99
105
  rspec-support (~> 3.13.0)
100
- rspec-mocks (3.13.2)
106
+ rspec-mocks (3.13.7)
101
107
  diff-lcs (>= 1.2.0, < 2.0)
102
108
  rspec-support (~> 3.13.0)
103
- rspec-support (3.13.2)
104
- rubocop (1.71.2)
109
+ rspec-support (3.13.7)
110
+ rubocop (1.84.0)
105
111
  json (~> 2.3)
106
- language_server-protocol (>= 3.17.0)
112
+ language_server-protocol (~> 3.17.0.2)
113
+ lint_roller (~> 1.1.0)
107
114
  parallel (~> 1.10)
108
115
  parser (>= 3.3.0.2)
109
116
  rainbow (>= 2.2.2, < 4.0)
110
117
  regexp_parser (>= 2.9.3, < 3.0)
111
- rubocop-ast (>= 1.38.0, < 2.0)
118
+ rubocop-ast (>= 1.49.0, < 2.0)
112
119
  ruby-progressbar (~> 1.7)
113
120
  unicode-display_width (>= 2.4.0, < 4.0)
114
- rubocop-ast (1.38.0)
115
- parser (>= 3.3.1.0)
116
- rubocop-capybara (2.21.0)
117
- rubocop (~> 1.41)
118
- rubocop-factory_bot (2.26.1)
119
- rubocop (~> 1.61)
120
- rubocop-performance (1.23.1)
121
- rubocop (>= 1.48.1, < 2.0)
122
- rubocop-ast (>= 1.31.1, < 2.0)
123
- rubocop-rspec (3.4.0)
124
- rubocop (~> 1.61)
125
- rubocop-rspec_rails (2.30.0)
126
- rubocop (~> 1.61)
127
- rubocop-rspec (~> 3, >= 3.0.1)
121
+ rubocop-ast (1.49.0)
122
+ parser (>= 3.3.7.2)
123
+ prism (~> 1.7)
124
+ rubocop-capybara (2.22.1)
125
+ lint_roller (~> 1.1)
126
+ rubocop (~> 1.72, >= 1.72.1)
127
+ rubocop-factory_bot (2.28.0)
128
+ lint_roller (~> 1.1)
129
+ rubocop (~> 1.72, >= 1.72.1)
130
+ rubocop-performance (1.26.1)
131
+ lint_roller (~> 1.1)
132
+ rubocop (>= 1.75.0, < 2.0)
133
+ rubocop-ast (>= 1.47.1, < 2.0)
134
+ rubocop-rspec (3.9.0)
135
+ lint_roller (~> 1.1)
136
+ rubocop (~> 1.81)
137
+ rubocop-rspec_rails (2.32.0)
138
+ lint_roller (~> 1.1)
139
+ rubocop (~> 1.72, >= 1.72.1)
140
+ rubocop-rspec (~> 3.5)
128
141
  ruby-progressbar (1.13.0)
129
142
  securerandom (0.4.1)
130
143
  simplecov (0.22.0)
131
144
  docile (~> 1.1)
132
145
  simplecov-html (~> 0.11)
133
146
  simplecov_json_formatter (~> 0.1)
134
- simplecov-html (0.13.1)
147
+ simplecov-html (0.13.2)
135
148
  simplecov_json_formatter (0.1.4)
136
149
  tzinfo (2.0.6)
137
150
  concurrent-ruby (~> 1.0)
138
- unicode-display_width (3.1.4)
139
- unicode-emoji (~> 4.0, >= 4.0.4)
140
- unicode-emoji (4.0.4)
141
- uri (1.0.2)
142
- webmock (3.25.0)
151
+ unicode-display_width (3.2.0)
152
+ unicode-emoji (~> 4.1)
153
+ unicode-emoji (4.2.0)
154
+ uri (1.1.1)
155
+ webmock (3.26.1)
143
156
  addressable (>= 2.8.0)
144
157
  crack (>= 0.3.2)
145
158
  hashdiff (>= 0.4.0, < 2.0.0)
146
- zeitwerk (2.7.1)
159
+ zeitwerk (2.7.4)
147
160
 
148
161
  PLATFORMS
149
162
  arm64-darwin-23
163
+ arm64-darwin-24
150
164
  x86_64-darwin-19
151
165
  x86_64-darwin-20
152
166
  x86_64-darwin-21
@@ -168,4 +182,4 @@ DEPENDENCIES
168
182
  webmock
169
183
 
170
184
  BUNDLED WITH
171
- 2.4.13
185
+ 4.0.5
data/README.md CHANGED
@@ -25,10 +25,10 @@ require 'folio_client'
25
25
 
26
26
  # this will configure the client and request an access token
27
27
  client = FolioClient.configure(
28
- url: 'https://okapi-dev.stanford.edu',
29
- login_params: { username: 'xxx', password: 'yyy' },
30
- okapi_headers: { 'X-Okapi-Tenant': 'sul', 'User-Agent': 'FolioApiClient' }
31
- )
28
+ url: 'https://okapi-dev.stanford.edu',
29
+ login_params: { username: 'xxx', password: 'yyy' },
30
+ okapi_headers: { 'X-Okapi-Tenant': 'sul', 'User-Agent': 'FolioApiClient' }
31
+ )
32
32
 
33
33
  response = client.get('/organizations/organizations', {query_string_param: 'abcdef'})
34
34
 
@@ -44,7 +44,6 @@ client = FolioClient.configure(
44
44
  url: Settings.okapi.url,
45
45
  login_params: Settings.okapi.login_params,
46
46
  okapi_headers: Settings.okapi.headers,
47
- legacy_auth: true # consumers should leave set to true (default) until /login-with-expiry endpoint enabled in Poppy
48
47
  )
49
48
  ```
50
49
 
@@ -8,29 +8,22 @@ class FolioClient
8
8
  end
9
9
 
10
10
  # Request an access_token
11
- def token # rubocop:disable Metrics/AbcSize
11
+ def token
12
12
  response = FolioClient.connection.post(login_endpoint, FolioClient.config.login_params.to_json)
13
13
 
14
14
  UnexpectedResponse.call(response) unless response.success?
15
15
 
16
- # remove legacy_auth once new tokens enabled on Poppy
17
- if FolioClient.config.legacy_auth
18
- JSON.parse(response.body)['okapiToken']
19
- else
20
- access_cookie = FolioClient.cookie_jar.cookies.find { |cookie| cookie.name == 'folioAccessToken' }
16
+ access_cookie = FolioClient.cookie_jar.cookies.find { |cookie| cookie.name == 'folioAccessToken' }
21
17
 
22
- raise StandardError, "Problem with folioAccessToken cookie: #{response.headers}, #{response.body}" unless access_cookie
18
+ raise StandardError, "Problem with folioAccessToken cookie: #{response.headers}, #{response.body}" unless access_cookie
23
19
 
24
- access_cookie.value
25
- end
20
+ access_cookie.value
26
21
  end
27
22
 
28
23
  private
29
24
 
30
25
  def login_endpoint
31
- return '/authn/login-with-expiry' unless FolioClient.config.legacy_auth
32
-
33
- '/authn/login'
26
+ '/authn/login-with-expiry'
34
27
  end
35
28
  end
36
29
  end
@@ -25,7 +25,7 @@ class FolioClient
25
25
  def fetch_external_id(hrid:)
26
26
  instance_response = client.get('/search/instances', { query: "hrid==#{hrid}" })
27
27
  record_count = instance_response['totalRecords']
28
- raise ResourceNotFound, "No matching instance found for #{hrid}" if (instance_response['totalRecords']).zero?
28
+ raise ResourceNotFound, "No matching instance found for #{hrid}" if instance_response['totalRecords'].zero?
29
29
  raise MultipleResourcesFound, "Expected 1 record for #{hrid}, but found #{record_count}" if record_count > 1
30
30
 
31
31
  instance_response.dig('instances', 0, 'id')
@@ -50,10 +50,10 @@ class FolioClient
50
50
  # @param status_id [String] uuid for an instance status code
51
51
  # @return true if instance status matches the uuid param, false otherwise
52
52
  # @raise [ResourceNotFound] if search by instance HRID returns 0 results
53
- def has_instance_status?(hrid:, status_id:) # rubocop:disable Naming/PredicateName
53
+ def has_instance_status?(hrid:, status_id:) # rubocop:disable Naming/PredicatePrefix
54
54
  # get the instance record and its statusId
55
55
  instance = client.get('/inventory/instances', { query: "hrid==#{hrid}" })
56
- raise ResourceNotFound, "No matching instance found for #{hrid}" if (instance['totalRecords']).zero?
56
+ raise ResourceNotFound, "No matching instance found for #{hrid}" if instance['totalRecords'].zero?
57
57
 
58
58
  instance_status_id = instance.dig('instances', 0, 'statusId')
59
59
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  class FolioClient
4
- VERSION = '0.18.0'
4
+ VERSION = '0.19.0'
5
5
  end
data/lib/folio_client.rb CHANGED
@@ -50,9 +50,8 @@ class FolioClient
50
50
  # @param url [String] the folio API URL
51
51
  # @param login_params [Hash] the folio client login params (username:, password:)
52
52
  # @param okapi_headers [Hash] the okapi specific headers to add (X-Okapi-Tenant:, User-Agent:)
53
- # @param legacy_auth [Boolean] true to use legacy /login rather than Poppy /login-with-expiry endpoint
54
53
  # @return [FolioClient] the configured Singleton class
55
- def configure(url:, login_params:, okapi_headers:, timeout: default_timeout, legacy_auth: true)
54
+ def configure(url:, login_params:, okapi_headers:, timeout: default_timeout, **)
56
55
  # rubocop:disable Style/OpenStructUse
57
56
  instance.config = OpenStruct.new(
58
57
  # For the initial token, use a dummy value to avoid hitting any APIs
@@ -69,8 +68,7 @@ class FolioClient
69
68
  url: url,
70
69
  login_params: login_params,
71
70
  okapi_headers: okapi_headers,
72
- timeout: timeout,
73
- legacy_auth: legacy_auth # default true until we have new token endpoint enabled in Poppy
71
+ timeout: timeout
74
72
  )
75
73
  # rubocop:enable Style/OpenStructUse
76
74
 
@@ -203,7 +201,7 @@ class FolioClient
203
201
  end
204
202
 
205
203
  # @see Inventory#has_instance_status?
206
- def has_instance_status?(...) # rubocop:disable Naming/PredicateName
204
+ def has_instance_status?(...) # rubocop:disable Naming/PredicatePrefix
207
205
  Inventory
208
206
  .new
209
207
  .has_instance_status?(...)
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: folio_client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Mangiafico
8
8
  bindir: exe
9
9
  cert_chain: []
10
- date: 2025-02-18 00:00:00.000000000 Z
10
+ date: 2026-02-06 00:00:00.000000000 Z
11
11
  dependencies:
12
12
  - !ruby/object:Gem::Dependency
13
13
  name: activesupport
@@ -281,7 +281,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
281
281
  - !ruby/object:Gem::Version
282
282
  version: '0'
283
283
  requirements: []
284
- rubygems_version: 3.6.3
284
+ rubygems_version: 3.6.2
285
285
  specification_version: 4
286
286
  summary: Interface for interacting with the Folio ILS API.
287
287
  test_files: []