signet 0.9.0 → 0.9.1

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: a9d9e93e57fb53fc7a45b67134f7974e11f15b5c7ea0c6807f0a4cd068964a51
4
- data.tar.gz: b9a0806442f9e6fc2a6b68fa8e4e247125dd029335a2a729bdfd8fcc73a7cf96
3
+ metadata.gz: d922c22c4140c29169cf488634119b758c31ac62770d7125e3cb28de71c7ffe4
4
+ data.tar.gz: c4ff15f7c7aa2947d0d82dc57baff5b7bfd3b774c46193cc6e5b9b1a989f241f
5
5
  SHA512:
6
- metadata.gz: 7655de7dfd4f1cec0bc59ea8347188ba36181735007b9dfd9a3d8daa70ee5db7804d03bbdc89a57ddfdfe53b6e0a56fa75d7b7f13d40419a7620e2e39731cda7
7
- data.tar.gz: fa9fbc85f62b104703192145af6512053b53e75508e1d0b813cd43e0e10728113617baf93e31e4338128fea998810a0f0228ab8b51d53aeb5ef7496bdcda16ff
6
+ metadata.gz: a0d67014fbcedddc4cd64b3cdba4d4f694e044d20dbe97d92edb1c707dd7adbffbb26fcef483e07b9c9a82b36111b120166553536c0e0bc8912a32a8c96ce4a9
7
+ data.tar.gz: 431881775a6acb40631aeb05de74c25d8967a70f19e301471de648c290ece266bddc6548f1f4ebb552776706faee7cc6f61f6a2794dea3b4b3ca0e3a30de1a28
@@ -1,4 +1,8 @@
1
- ## 0.9.0 (2018-08-16)
1
+ ## 0.9.1 (2018-08-29)
2
+ * Warn on EOL ruby versions.
3
+ * Fix DateTime normalization.
4
+
5
+ ## 0.9.0 (2018-08-20)
2
6
  * Add RemoteServerError class for 5xx level errors.
3
7
  * Allow to_json to be called with arguments
4
8
  * Expires_in now sets and reflects current expires_at value
data/README.md CHANGED
@@ -57,3 +57,12 @@ client.fetch_access_token!
57
57
  `gem install signet`
58
58
 
59
59
  Be sure `https://rubygems.org` is in your gem sources.
60
+
61
+ ## Supported Ruby Versions
62
+ This library is currently supported on Ruby 1.9+.
63
+ However, Ruby 2.4 or later is strongly recommended, as earlier releases have
64
+ reached or are nearing end-of-life. After March 31, 2019, Google will provide
65
+ official support only for Ruby versions that are considered current and
66
+ supported by Ruby Core (that is, Ruby versions that are either in normal
67
+ maintenance or in security maintenance).
68
+ See https://www.ruby-lang.org/en/downloads/branches/ for further details.
@@ -19,6 +19,7 @@ require 'signet'
19
19
  require 'signet/errors'
20
20
  require 'signet/oauth_2'
21
21
  require 'jwt'
22
+ require 'date'
22
23
 
23
24
  module Signet
24
25
  module OAuth2
@@ -18,10 +18,71 @@ unless defined? Signet::VERSION
18
18
  module VERSION
19
19
  MAJOR = 0
20
20
  MINOR = 9
21
- TINY = 0
21
+ TINY = 1
22
22
  PRE = nil
23
23
 
24
24
  STRING = [MAJOR, MINOR, TINY, PRE].compact.join('.')
25
+
26
+ # On March 31, 2019, set supported version to 2.4 and recommended to 2.6.
27
+ # Thereafter, follow the MRI support schedule: supported means non-EOL,
28
+ # and recommended means in normal (rather than security) maintenance.
29
+ # See https://www.ruby-lang.org/en/downloads/branches/
30
+ ##
31
+ # Minimum "supported" Ruby version (non-EOL)
32
+ # @private
33
+ #
34
+ SUPPORTED_VERSION_THRESHOLD = '1.9'.freeze
35
+ ##
36
+ # Minimum "recommended" Ruby version (normal maintenance)
37
+ # @private
38
+ #
39
+ RECOMMENDED_VERSION_THRESHOLD = '2.4'.freeze
40
+ ##
41
+ # Check Ruby version and emit a warning if it is old
42
+ # @private
43
+ #
44
+ def self.warn_on_old_ruby_version
45
+ return if ENV['GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS']
46
+ cur_version = Gem::Version.new RUBY_VERSION
47
+ if cur_version < Gem::Version.new(SUPPORTED_VERSION_THRESHOLD)
48
+ warn_unsupported_ruby cur_version, RECOMMENDED_VERSION_THRESHOLD
49
+ elsif cur_version < Gem::Version.new(RECOMMENDED_VERSION_THRESHOLD)
50
+ warn_nonrecommended_ruby cur_version, RECOMMENDED_VERSION_THRESHOLD
51
+ end
52
+ rescue ArgumentError
53
+ 'Unable to determine current Ruby version.'
54
+ end
55
+
56
+ ##
57
+ # Print a warning for an EOL version of Ruby
58
+ # @private
59
+ #
60
+ def self.warn_unsupported_ruby cur_version, recommended_version
61
+ "WARNING: You are running Ruby #{cur_version}, which has reached" +
62
+ " end-of-life and is no longer supported by Ruby Core.\n" +
63
+ 'Signet works best on supported versions of' +
64
+ ' Ruby. It is strongly recommended that you upgrade to Ruby' +
65
+ " #{recommended_version} or later. \n" +
66
+ 'See https://www.ruby-lang.org/en/downloads/branches/ for more' +
67
+ " info on the Ruby maintenance schedule.\n" +
68
+ 'To suppress this message, set the' +
69
+ ' GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS environment variable.'
70
+ end
71
+
72
+ ##
73
+ # Print a warning for a supported but nearing EOL version of Ruby
74
+ # @private
75
+ #
76
+ def self.warn_nonrecommended_ruby cur_version, recommended_version
77
+ "WARNING: You are running Ruby #{cur_version}, which is nearing" +
78
+ " end-of-life.\n" +
79
+ 'Signet works best on supported versions of' +
80
+ " Ruby. Consider upgrading to Ruby #{recommended_version} or later.\n" +
81
+ 'See https://www.ruby-lang.org/en/downloads/branches/ for more' +
82
+ " info on the Ruby maintenance schedule.\n" +
83
+ 'To suppress this message, set the' +
84
+ ' GOOGLE_CLOUD_SUPPRESS_RUBY_WARNINGS environment variable.'
85
+ end
25
86
  end
26
87
  end
27
88
  end
@@ -35,4 +35,6 @@ Gem::Specification.new do |s|
35
35
  s.add_development_dependency 'launchy', '~> 2.4'
36
36
  s.add_development_dependency 'kramdown', '~> 1.5'
37
37
  s.add_development_dependency 'simplecov', '~> 0.9'
38
+
39
+ s.post_install_message = Signet::VERSION::warn_on_old_ruby_version
38
40
  end
@@ -15,6 +15,7 @@ require 'spec_helper'
15
15
  require 'signet/oauth_2/client'
16
16
  require 'openssl'
17
17
  require 'jwt'
18
+ require 'date'
18
19
 
19
20
  conn = Faraday.default_connection
20
21
 
@@ -442,6 +443,18 @@ describe Signet::OAuth2::Client, 'configured for Google userinfo API' do
442
443
  expect(@client).to_not be_expired
443
444
  end
444
445
 
446
+ it 'should normalize values of expires_at to instances of time' do
447
+ time_formats = [DateTime.new, "12:00", 100, Time.new]
448
+ normalized_time_formats = []
449
+ time_formats.each do |time|
450
+ @client.expires_at = time
451
+ normalized_time_formats << @client.expires_at
452
+ end
453
+ normalized_time_formats.each do |time|
454
+ expect(time).to be_an_instance_of(Time)
455
+ end
456
+ end
457
+
445
458
  it 'should set expires_in when expires_at is set' do
446
459
  issued_at = Time.now
447
460
  expires_at = Time.now+100
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: signet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.9.0
4
+ version: 0.9.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Bob Aman
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2018-08-20 00:00:00.000000000 Z
12
+ date: 2018-08-29 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: addressable