omniauth-ekuaishou 0.1.0 → 0.2.0

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: 843966ec9516a983699d334a36915021457e21bb39829ef1073dd990c9008742
4
- data.tar.gz: a087780d3564137e167e07bdc5acb74a8c5196affd7b1ba0d59868f3dbdeb90f
3
+ metadata.gz: 1a9db35a70811ae93a5621785285aaf0721b96fde9a935692d406f5cfcd42a4a
4
+ data.tar.gz: 9399a320f12dc4483caf686973c86a285e4024b5c143cae9d720a8f0083c46cf
5
5
  SHA512:
6
- metadata.gz: 1ee25f17a8edf0dad9948ad28427fe578ebca8a08bdc3398ef58ed035fdcd5153a69b9cb8c24dd9cc24eda04d624ba6e3a90ab188b751762f1a4ddddf6ebcf2a
7
- data.tar.gz: 8b0872f8f400d0718924cadc3411c5b9542b9895496cf809b2e0fea81a9c44360bab2d40395dda19977497cd1ca6c9d72353ac33e7ea98ea62b617f0f1ab3b91
6
+ metadata.gz: 250c609fe82b04dab58190e5e129d234ab141bc844e3990260213b5d97cd2c8ec853284b8503cfd5866ef16474093ff6c5eaad26c2a682b7cd859f87b0bf32da
7
+ data.tar.gz: d2a42c587f145e46be77a6489425570680aa1f4449275072201b97532bcf07cbbd498d628d98766aad3b2feb2a24b5e502aab72a5bcdb7a8f9df5e0516620b67
data/.gitignore CHANGED
@@ -9,3 +9,4 @@
9
9
 
10
10
  # rspec failure tracking
11
11
  .rspec_status
12
+ *.gem
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- omniauth-ekuaishou (0.1.0)
4
+ omniauth-ekuaishou (0.2.0)
5
5
  omniauth (~> 2.0)
6
6
  omniauth-oauth2 (~> 1.7.1)
7
7
 
@@ -4,10 +4,10 @@ module OmniAuth
4
4
  class << self
5
5
  def from_hash(client, hash)
6
6
  return unless hash && hash['code'] == 0 && hash.dig('data', 'access_token').present?
7
- data = hash['data']
8
- super(client, data.merge(
9
- 'expires_in' => data['access_token_expires_in']
10
- ))
7
+
8
+ data = hash['data'].merge('expires_in' => hash.dig('data', 'access_token_expires_in'))
9
+ data['refresh_token_expires_at'] ||= Time.now.to_i + data['refresh_token_expires_in'].to_i if data['refresh_token_expires_in'].present?
10
+ super(client, data)
11
11
  end
12
12
  end
13
13
  end
@@ -1,5 +1,5 @@
1
1
  module OmniAuth
2
2
  module Ekuaishou
3
- VERSION = "0.1.0"
3
+ VERSION = "0.2.0"
4
4
  end
5
5
  end
@@ -46,11 +46,19 @@ module OmniAuth
46
46
  ))
47
47
  end
48
48
 
49
+ credentials do
50
+ hash = {"token" => access_token.token}
51
+ hash["refresh_token"] = access_token.refresh_token if access_token.expires? && access_token.refresh_token
52
+ hash["expires_at"] = access_token.expires_at if access_token.expires?
53
+ hash["expires"] = access_token.expires?
54
+ hash["refresh_token_expires_at"] = access_token['refresh_token_expires_at'] if access_token['refresh_token_expires_at'].present?
55
+ hash
56
+ end
57
+
49
58
  extra do
50
59
  {
51
60
  scope: scope,
52
- raw_info: raw_info,
53
- refresh_token_expires_in: access_token['refresh_token_expires_in']
61
+ raw_info: raw_info
54
62
  }
55
63
  end
56
64
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-ekuaishou
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - jimcheung
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2021-06-14 00:00:00.000000000 Z
11
+ date: 2021-06-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: omniauth