nypl_sierra_api_client 1.1.0 → 1.2.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 +4 -4
- data/lib/nypl_sierra_api_client.rb +19 -2
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: caabcc105e5fa564b09906a50a7c2c83781435ae2997aeb5b1b546c2a5d5196d
|
4
|
+
data.tar.gz: ee28dd954ac82a925c01d4b3c386d7116c45a3a4a9901c19c725f3570c6dd51e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 02744457c93e208183dfd10a918ab47bd2be2945b1ab3877ac4af15648da4636e71edde276d73dcc2f9f5e971d72c6cf027c9ac2bad99f58f1ae6d7de9c7946d
|
7
|
+
data.tar.gz: bc02013959688226a4e115deb6ed7dce14c2e4e15b136905d79a5371d9e84450982662cbbbcdf9ee14d8258385cc680be0f2c2b2e83100e93f0e08af1d3a0c52
|
@@ -31,6 +31,23 @@ class SierraApiClient
|
|
31
31
|
@retries = 0
|
32
32
|
end
|
33
33
|
|
34
|
+
def put (path, body, options = {})
|
35
|
+
options = parse_http_options options
|
36
|
+
# Default to POSTing JSON unless explicitly stated otherwise
|
37
|
+
options[:headers]['Content-Type'] = 'application/json' unless options[:headers]['Content-Type']
|
38
|
+
|
39
|
+
do_request 'put', path, options do |request|
|
40
|
+
request.body = body
|
41
|
+
request.body = request.body.to_json unless options[:headers]['Content-Type'] != 'application/json'
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
def delete (path, options = {})
|
46
|
+
options = parse_http_options options
|
47
|
+
|
48
|
+
do_request 'delete', path, options
|
49
|
+
end
|
50
|
+
|
34
51
|
def get (path, options = {})
|
35
52
|
options = parse_http_options options
|
36
53
|
|
@@ -52,8 +69,8 @@ class SierraApiClient
|
|
52
69
|
private
|
53
70
|
|
54
71
|
def do_request (method, path, options = {})
|
55
|
-
|
56
|
-
|
72
|
+
|
73
|
+
raise SierraApiClientError, "Unsupported method: #{method}" unless ['get', 'post', 'put', 'delete'].include? method.downcase
|
57
74
|
|
58
75
|
authenticate! if options[:authenticated]
|
59
76
|
|
metadata
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: nypl_sierra_api_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- nonword
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
date: 2020-04-21 00:00:00.000000000 Z
|
@@ -23,7 +23,7 @@ homepage: https://github.com/NYPL/ruby-sierra-api-client
|
|
23
23
|
licenses:
|
24
24
|
- MIT
|
25
25
|
metadata: {}
|
26
|
-
post_install_message:
|
26
|
+
post_install_message:
|
27
27
|
rdoc_options: []
|
28
28
|
require_paths:
|
29
29
|
- lib
|
@@ -39,7 +39,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
39
39
|
version: '0'
|
40
40
|
requirements: []
|
41
41
|
rubygems_version: 3.1.2
|
42
|
-
signing_key:
|
42
|
+
signing_key:
|
43
43
|
specification_version: 4
|
44
44
|
summary: NYPL Sierra API client
|
45
45
|
test_files: []
|