jm81auth 0.1.3 → 0.1.4

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
  SHA1:
3
- metadata.gz: 5be975f805f23aee8547187c269bf7f6bd5a36cf
4
- data.tar.gz: 4b6eadb3981c392207c1a6ad98e3049b55874586
3
+ metadata.gz: 0c3c59397d88dbdf28d7e4d648d31add2778816b
4
+ data.tar.gz: 5f9c327cf43476a2461cb2fbbd2143f60e1e6260
5
5
  SHA512:
6
- metadata.gz: 83eb1c01a3aa7bd494212c8cabb293c84f05137055da739d1cd74ee63e893a2be2afb3a5b2bf03040bcf3e2ede707255c03ad7eaeb6bffeada9ce9ff35b17bf1
7
- data.tar.gz: 87d29b77340727b2be625384a38497db6bcc5912be328587ed68fbfc5ff29ee15048d1e7f73b7b34e9de1d66bba4db79395f65698885f55e1b0bcb2f5759bcb1
6
+ metadata.gz: cd400241266aabd44738a03ebb93a7ca7d5b56e618bfad3ea44241acd8a8cf47a0cf621095a05c71c81f372f079a955757012d3fdce58094b12bb7a3dd51c890
7
+ data.tar.gz: 3032d568c94dffae893cb2d17148f4ba5c7ff29a114ed4cc38b37dcc1637aea071bc5d98af16cc38ff20b4c631926766889672efacd87a5c556346694951b0a5
@@ -19,10 +19,10 @@ module Jm81auth
19
19
  #
20
20
  # @return [AuthToken]
21
21
  def create_token
22
- if respond_to? :belongs_to
23
- auth_tokens.create! user: user, last_used_at: Time.now.utc
24
- else
22
+ if self.respond_to? :add_auth_token
25
23
  add_auth_token user: user, last_used_at: Time.now.utc
24
+ else
25
+ auth_tokens.create! user: user, last_used_at: Time.now.utc
26
26
  end
27
27
  end
28
28
 
@@ -65,7 +65,11 @@ module Jm81auth
65
65
  token, config.jwt_secret, config.jwt_algorithm
66
66
  ).first
67
67
 
68
- auth_token = self[payload['auth_token_id']]
68
+ if self.respond_to? :[]
69
+ auth_token = self[payload['auth_token_id']]
70
+ else
71
+ auth_token = find payload['auth_token_id']
72
+ end
69
73
 
70
74
  if payload['auth_token_id'].nil?
71
75
  raise DecodeError, "auth_token_id missing: #{payload}"
@@ -50,7 +50,11 @@ module Jm81auth
50
50
  display_name: oauth.display_name
51
51
  )
52
52
 
53
- method = user.add_auth_method oauth.provider_data
53
+ if user.respond_to? :add_auth_method
54
+ method = user.add_auth_method oauth.provider_data
55
+ else
56
+ method = user.auth_methods.create! oauth.provider_data
57
+ end
54
58
  end
55
59
 
56
60
  method.create_token
@@ -1,3 +1,3 @@
1
1
  module Jm81auth
2
- VERSION = '0.1.3'
2
+ VERSION = '0.1.4'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: jm81auth
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jared Morgan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-12-27 00:00:00.000000000 Z
11
+ date: 2019-12-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httpclient