haveapi-client 0.23.4 → 0.23.5
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7d50d025c1b475f639ceb4503bf5030bf0d97cd96e03f34f2d48c0fdb592646d
|
4
|
+
data.tar.gz: d4cfc1d470c048fccfd41a9d02d20250dedf4b7e5c6f856d7e47b2d06d5656bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ed4c03e9dad72f24eb388f33e37f58bfa0359603721056a7cad4341a184b22ffc8b401ad8e1918e4244790f236399694c0dd09c083f2051d9bdf66660fe6ef38
|
7
|
+
data.tar.gz: 2b37aa2e6172253b62fce09bca20881a3a11e8c2bc55e09774a8c0a247461fa9188dd8b17355256c91b4d9bcb086efe1fb0cda2defc24d66cd1fb3dd0bf9e4b1
|
@@ -8,7 +8,14 @@ module HaveAPI::Client::Authentication
|
|
8
8
|
def setup
|
9
9
|
@via = @opts[:via] || :header
|
10
10
|
@token = @opts[:token]
|
11
|
-
|
11
|
+
|
12
|
+
@valid_to =
|
13
|
+
case @opts[:valid_to]
|
14
|
+
when Time # usually given at runtime
|
15
|
+
@opts[:valid_to]
|
16
|
+
when Integer # loaded from config
|
17
|
+
Time.at(@opts[:valid_to])
|
18
|
+
end
|
12
19
|
|
13
20
|
request_token unless @token
|
14
21
|
|
@@ -30,12 +37,7 @@ module HaveAPI::Client::Authentication
|
|
30
37
|
end
|
31
38
|
|
32
39
|
def save
|
33
|
-
{ token: @token, valid_to: @valid_to }
|
34
|
-
end
|
35
|
-
|
36
|
-
def load(hash)
|
37
|
-
@token = hash[:token]
|
38
|
-
@valid_to = hash[:valid_to]
|
40
|
+
{ token: @token, valid_to: @valid_to && @valid_to.to_i }
|
39
41
|
end
|
40
42
|
|
41
43
|
def renew
|