nypl_sierra_api_client 1.1.0 → 1.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/nypl_sierra_api_client.rb +19 -2
  3. metadata +4 -4
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 82e6e4a869d4151703b816abea4f6774b015be7d0a6703648de2306ed42a20da
4
- data.tar.gz: 1aa79afd819567f025bc049bbd8f2c5e16613a807161deb045b3475fca4558d8
3
+ metadata.gz: caabcc105e5fa564b09906a50a7c2c83781435ae2997aeb5b1b546c2a5d5196d
4
+ data.tar.gz: ee28dd954ac82a925c01d4b3c386d7116c45a3a4a9901c19c725f3570c6dd51e
5
5
  SHA512:
6
- metadata.gz: 69e7d9f2889259802eeb7cb48a97251cb713e8cdddb30189300c2ba49c2847caa040b69641ada2a8e6a2269dec240fda6f3bd5ab03a8029fb5072d8e851b05ca
7
- data.tar.gz: dc5e94f8650598f978dc068eacb3b76dd9eca87fb6f41ee5b489f62fe8279a51898bb24d79c4dd7b1be1c6933a6071dccc2b73ce37270f7bbe0a3b9c692fed1a
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
- # For now, these are the methods we support:
56
- raise SierraApiClientError, "Unsupported method: #{method}" unless ['get', 'post'].include? method.downcase
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.1.0
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: []