folio_client 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/lib/folio_client/token_wrapper.rb +1 -1
- data/lib/folio_client/version.rb +1 -1
- data/lib/folio_client.rb +12 -15
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db6b3bd02eac883e93ca7a24725f1c3d4f1ef48b34a3aa6e9326070e1903f600
|
4
|
+
data.tar.gz: e2592286592f8fe064b326373dc3f8ca3123a7fa775fedcb23f00da97dc58638
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7ee03f5f2ae933bab57d6a3c6b2be09d7933b98f51ea66c07ffb09e821c4a5c9a08564125c01cd0858a4347465f8e588314b25bc26296851e61e593f8e1c42bd
|
7
|
+
data.tar.gz: '0170689c2a3d9bd2547b976cd43b7258cc3dd6c51a5a8caba9ba62774d3425e62f624024c155d3b728a7dea8df30bce23ee7f111f628c5c1649c8327891e1cc9'
|
data/Gemfile.lock
CHANGED
@@ -4,7 +4,7 @@ class FolioClient
|
|
4
4
|
# Wraps API operations to request new access token if expired
|
5
5
|
class TokenWrapper
|
6
6
|
def self.refresh(config, connection)
|
7
|
-
yield
|
7
|
+
yield.tap { |response| UnexpectedResponse.call(response) unless response.success? }
|
8
8
|
rescue UnauthorizedError
|
9
9
|
config.token = Authenticator.token(config.login_params, connection)
|
10
10
|
yield
|
data/lib/folio_client/version.rb
CHANGED
data/lib/folio_client.rb
CHANGED
@@ -58,7 +58,9 @@ class FolioClient
|
|
58
58
|
# @param path [String] the path to the Folio API request
|
59
59
|
# @param request [Hash] params to get to the API
|
60
60
|
def get(path, params = {})
|
61
|
-
response =
|
61
|
+
response = TokenWrapper.refresh(config, connection) do
|
62
|
+
connection.get(path, params, {"x-okapi-token": config.token})
|
63
|
+
end
|
62
64
|
|
63
65
|
UnexpectedResponse.call(response) unless response.success?
|
64
66
|
|
@@ -69,7 +71,9 @@ class FolioClient
|
|
69
71
|
# @param path [String] the path to the Folio API request
|
70
72
|
# @param request [json] request body to post to the API
|
71
73
|
def post(path, request = nil)
|
72
|
-
response =
|
74
|
+
response = TokenWrapper.refresh(config, connection) do
|
75
|
+
connection.post(path, request, {"x-okapi-token": config.token})
|
76
|
+
end
|
73
77
|
|
74
78
|
UnexpectedResponse.call(response) unless response.success?
|
75
79
|
|
@@ -85,25 +89,18 @@ class FolioClient
|
|
85
89
|
end
|
86
90
|
|
87
91
|
# Public methods available on the FolioClient below
|
88
|
-
# Wrap methods in `TokenWrapper` to ensure a new token is fetched automatically if expired
|
89
92
|
def fetch_hrid(...)
|
90
|
-
|
91
|
-
|
92
|
-
inventory.fetch_hrid(...)
|
93
|
-
end
|
93
|
+
inventory = Inventory.new(self)
|
94
|
+
inventory.fetch_hrid(...)
|
94
95
|
end
|
95
96
|
|
96
97
|
def fetch_marc_hash(...)
|
97
|
-
|
98
|
-
|
99
|
-
source_storage.fetch_marc_hash(...)
|
100
|
-
end
|
98
|
+
source_storage = SourceStorage.new(self)
|
99
|
+
source_storage.fetch_marc_hash(...)
|
101
100
|
end
|
102
101
|
|
103
102
|
def has_instance_status?(...)
|
104
|
-
|
105
|
-
|
106
|
-
inventory.has_instance_status?(...)
|
107
|
-
end
|
103
|
+
inventory = Inventory.new(self)
|
104
|
+
inventory.has_instance_status?(...)
|
108
105
|
end
|
109
106
|
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.6.
|
4
|
+
version: 0.6.1
|
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-02
|
11
|
+
date: 2023-03-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -189,7 +189,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
189
189
|
- !ruby/object:Gem::Version
|
190
190
|
version: '0'
|
191
191
|
requirements: []
|
192
|
-
rubygems_version: 3.
|
192
|
+
rubygems_version: 3.3.7
|
193
193
|
signing_key:
|
194
194
|
specification_version: 4
|
195
195
|
summary: Interface for interacting with the Folio ILS API.
|