haveapi-client 0.23.3 → 0.23.5
Sign up to get free protection for your applications and to get access to all the features.
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
|
data/haveapi-client.gemspec
CHANGED
@@ -18,10 +18,10 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.
|
22
|
-
spec.
|
23
|
-
spec.
|
24
|
-
spec.
|
25
|
-
spec.
|
26
|
-
spec.
|
21
|
+
spec.add_dependency 'activesupport', '>= 7.0'
|
22
|
+
spec.add_dependency 'highline', '~> 2.1.0'
|
23
|
+
spec.add_dependency 'json'
|
24
|
+
spec.add_dependency 'require_all', '~> 2.0.0'
|
25
|
+
spec.add_dependency 'rest-client', '~> 2.1.0'
|
26
|
+
spec.add_dependency 'ruby-progressbar', '~> 1.13.0'
|
27
27
|
end
|
@@ -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
|
@@ -5,10 +5,12 @@ module HaveAPI::Client
|
|
5
5
|
module Boolean
|
6
6
|
def self.to_b(str)
|
7
7
|
return true if str === true
|
8
|
-
return true if str =~ /^(true|t|yes|y|1)$/i
|
9
|
-
|
10
8
|
return false if str === false
|
11
|
-
|
9
|
+
|
10
|
+
if str.respond_to?(:=~)
|
11
|
+
return true if str =~ /^(true|t|yes|y|1)$/i
|
12
|
+
return false if str =~ /^(false|f|no|n|0)$/i
|
13
|
+
end
|
12
14
|
|
13
15
|
false
|
14
16
|
end
|