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: 584ba14950bbcb83911f4e85654d5d50d606da0a8bc5ade37f6f0900a04a9431
4
- data.tar.gz: 0ced7bdf0e1a6f7443adbf661643e1576c30556d74978b57e861b19abdf424b5
3
+ metadata.gz: 7d50d025c1b475f639ceb4503bf5030bf0d97cd96e03f34f2d48c0fdb592646d
4
+ data.tar.gz: d4cfc1d470c048fccfd41a9d02d20250dedf4b7e5c6f856d7e47b2d06d5656bf
5
5
  SHA512:
6
- metadata.gz: 1d502d72fc07d5b227063ac729947a0e2122a8db67455acbac8f124bed9579c7c5a2b76bfa92a19928727e207ac6e7640f224edc25473b89f466d43641432901
7
- data.tar.gz: e8d96366f9b33022c1892b41a1cb63c66722b6b88382e395946592b718bfb4cc9a5ddd808b70c29226aec62bba285567155ed2d6dde95859c3e73291338032a7
6
+ metadata.gz: ed4c03e9dad72f24eb388f33e37f58bfa0359603721056a7cad4341a184b22ffc8b401ad8e1918e4244790f236399694c0dd09c083f2051d9bdf66660fe6ef38
7
+ data.tar.gz: 2b37aa2e6172253b62fce09bca20881a3a11e8c2bc55e09774a8c0a247461fa9188dd8b17355256c91b4d9bcb086efe1fb0cda2defc24d66cd1fb3dd0bf9e4b1
@@ -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.add_runtime_dependency 'activesupport', '>= 7.0'
22
- spec.add_runtime_dependency 'highline', '~> 2.1.0'
23
- spec.add_runtime_dependency 'json'
24
- spec.add_runtime_dependency 'require_all', '~> 2.0.0'
25
- spec.add_runtime_dependency 'rest-client', '~> 2.1.0'
26
- spec.add_runtime_dependency 'ruby-progressbar', '~> 1.13.0'
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
@@ -73,11 +73,6 @@ module HaveAPI::Client
73
73
  def save
74
74
  @opts
75
75
  end
76
-
77
- # Load auth provider attributes from previous #save call.
78
- def load(hash)
79
- @opts = hash
80
- end
81
76
  end
82
77
  end
83
78
  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
- @valid_to = @opts[:valid_to]
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
- return false if str =~ /^(false|f|no|n|0)$/i
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
@@ -1,6 +1,6 @@
1
1
  module HaveAPI
2
2
  module Client
3
3
  PROTOCOL_VERSION = '2.0'.freeze
4
- VERSION = '0.23.3'.freeze
4
+ VERSION = '0.23.5'.freeze
5
5
  end
6
6
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: haveapi-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.23.3
4
+ version: 0.23.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jakub Skokan