svbclient 3.2.1 → 3.2.2

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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/svbclient.rb +11 -7
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c92446f878f0317a46f337ce57c2f137b964f0f9
4
- data.tar.gz: e6e4f4e3e5eceb79b6a2666764bd33ec32db79c3
3
+ metadata.gz: 1aca09ed58e59e32a13bd7e8c324e8f2544f4f84
4
+ data.tar.gz: 124d011d799c750cce04aeae833c3c036de3683e
5
5
  SHA512:
6
- metadata.gz: 1c4b4c1f1b9b2fb0025c9204c7a568ac5ec85832a51950f192979d3fc693d38651beae3801980229bbd2ee8da08d607c6d0f4f048d6a56b078d9b17d864eff80
7
- data.tar.gz: 46d321d0a2b61ed8b9381c1d4ff0235fee5b0030be36205ca45e11a8db41899bc3bffc4593a57b67440e44237d5ba7ebe6e38292f647dfa643c31c240dd1d134
6
+ metadata.gz: 262973ab50e187760b491b2f5c5cfe2e6088e7bb145e24e88adfcbbadfca3cc321a1271b462a770da539fd1a2e855c08b93dd89595dd53124a1ea63750445e25
7
+ data.tar.gz: 5a73b8bad451c297c456847d1f6c83ccdbcaec56b347b1d6ec7ffcd695bbe85e11d208e82de528637a55f0c8f2469e0362d267eeae7b9577663b8782cee55e9d
data/lib/svbclient.rb CHANGED
@@ -16,7 +16,7 @@ require 'uri'
16
16
  require 'rest-client'
17
17
 
18
18
  class SVBClient
19
- def initialize(api_key, hmac, base_url: 'https://api.svb.com')
19
+ def initialize(api_key, hmac = nil, base_url: 'https://api.svb.com')
20
20
  @API_KEY = api_key
21
21
  @HMAC_SECRET = hmac
22
22
  @BASE_URL = base_url
@@ -28,15 +28,19 @@ class SVBClient
28
28
  end
29
29
 
30
30
  def headers(method, path, query, body)
31
- mytimestamp = Time.now.to_i.to_s
32
- signature = signature(mytimestamp, method, path, query, body)
33
-
34
- {
35
- "X-Timestamp": mytimestamp,
36
- "X-Signature": signature,
31
+ hs = {
37
32
  "Authorization": "Bearer " + @API_KEY,
38
33
  "Content-Type": "application/json"
39
34
  }
35
+
36
+ if @HMAC_SECRET
37
+ mytimestamp = Time.now.to_i.to_s
38
+ signature = signature(mytimestamp, method, path, query, body)
39
+ hs["X-Timestamp"] = mytimestamp
40
+ hs["X-Signature"] = signature
41
+ end
42
+
43
+ hs
40
44
  end
41
45
 
42
46
  def delete(path)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: svbclient
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Silicon Valley Bank