omniauth-identity 3.0.3 → 3.0.4

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: 629d1327cd3aa697de7139825ca429e8829886526da60aa233937643a56caf54
4
- data.tar.gz: f8fa65f35a26646fcec82b86208da5a511e7639be3388997ede74e0b8df98ca8
3
+ metadata.gz: e5de20f544ddaf124fc1b80a0ea15d97d56572034cc985e72001e177c3da2c92
4
+ data.tar.gz: 21e59364dcba511bd658c7503b4dce12fb7c26e37b7f4bec3b05c91d0d1dd4c4
5
5
  SHA512:
6
- metadata.gz: 35d08b45518df49d12131b94fdd26110448161809153f782f709369f85488a30dda1bc2fc38121e19beda06c048bf1c8db5b2f901540ab10133bd52925cfe941
7
- data.tar.gz: dc462e3a8e3733565d2d660bcf6495460e77376469f2cab70d140bff22a07c5f63b0fb3b09b94774956f1c9f47f67f2cbffdcf797e653cc112f31460a26b004a
6
+ metadata.gz: ef710bfa64cef76922f89e93ca4292c106bda7e61cb8a49133452227f65163d2c5be70fade9ecc8d973ce35281a812d837edffe27be24689b34646c48109b07a
7
+ data.tar.gz: 812f288ec96fb46afa30a61fc34caa85b4efbe8857b8fb6dbeaeab9b2c181124db8b8deea40ebbccedcfc8b78d4039dbcad609782d0955a36423e543ba293865
data/CHANGELOG.md CHANGED
@@ -8,6 +8,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8
8
 
9
9
  ## [Unreleased]
10
10
 
11
+ ## [3.0.4] - 2021-02-14
12
+
13
+ ### Added
14
+
15
+ - Add support for [sequel ORM](http://sequel.jeremyevans.net/)
16
+
11
17
  ## [3.0.3] - 2021-02-14
12
18
 
13
19
  ### Added
data/README.md CHANGED
@@ -85,6 +85,22 @@ class Identity < OmniAuth::Identity::Models::ActiveRecord
85
85
  end
86
86
  ```
87
87
 
88
+ ### Sequel
89
+
90
+ [Sequel](http://sequel.jeremyevans.net/) is an alternative to ActiveRecord.
91
+
92
+ Just include `OmniAuth::Identity::Models::Sequel` mixin, and specify
93
+ whatever else you will need.
94
+
95
+ ```ruby
96
+ class SequelTestIdentity < Sequel::Model
97
+ include OmniAuth::Identity::Models::Sequel
98
+ auth_key :email
99
+ # whatever else you want!
100
+ end
101
+ ```
102
+
103
+
88
104
  ### Mongoid
89
105
 
90
106
  Include the `OmniAuth::Identity::Models::Mongoid` mixin and specify
@@ -103,7 +119,8 @@ end
103
119
 
104
120
  ### CouchPotato
105
121
 
106
- Include the `OmniAuth::Identity::Models::CouchPotatoModule` mixin and specify fields that you will need.
122
+ Include the `OmniAuth::Identity::Models::CouchPotatoModule` mixin and specify
123
+ fields that you will need.
107
124
 
108
125
  ```ruby
109
126
  class Identity
@@ -125,7 +142,8 @@ end
125
142
 
126
143
  [NoBrainer](http://nobrainer.io/) is an ORM for [RethinkDB](https://rethinkdb.com/).
127
144
 
128
- Include the `OmniAuth::Identity::Models::NoBrainer` mixin and specify fields that you will need.
145
+ Include the `OmniAuth::Identity::Models::NoBrainer` mixin and specify
146
+ fields that you will need.
129
147
 
130
148
  ```ruby
131
149
  class Identity
@@ -2,6 +2,6 @@
2
2
 
3
3
  module OmniAuth
4
4
  module Identity
5
- VERSION = '3.0.3'
5
+ VERSION = '3.0.4'
6
6
  end
7
7
  end
@@ -15,6 +15,7 @@ module OmniAuth
15
15
  autoload :Mongoid, 'omniauth/identity/models/mongoid'
16
16
  autoload :CouchPotatoModule, 'omniauth/identity/models/couch_potato'
17
17
  autoload :NoBrainer, 'omniauth/identity/models/no_brainer'
18
+ autoload :Sequel, 'omniauth/identity/models/sequel'
18
19
  end
19
20
  end
20
21
  end
@@ -0,0 +1,37 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'nobrainer'
4
+
5
+ module OmniAuth
6
+ module Identity
7
+ module Models
8
+ # http://sequel.jeremyevans.net/ an SQL ORM
9
+ module Sequel
10
+ def self.included(base)
11
+ base.class_eval do
12
+ # NOTE: Using the deprecated :validations_class_methods because it defines
13
+ # validates_confirmation_of, while current :validation_helpers does not.
14
+ # plugin :validation_helpers
15
+ plugin :validation_class_methods
16
+
17
+ include OmniAuth::Identity::Model
18
+ include ::OmniAuth::Identity::SecurePassword
19
+
20
+ has_secure_password
21
+
22
+ alias_method :persisted?, :valid?
23
+
24
+ def self.auth_key=(key)
25
+ super
26
+ validates_uniqueness_of :key, case_sensitive: false
27
+ end
28
+
29
+ def self.locate(search_hash)
30
+ where(search_hash).first
31
+ end
32
+ end
33
+ end
34
+ end
35
+ end
36
+ end
37
+ end
@@ -0,0 +1,23 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'sequel'
4
+ # Connect to an in-memory sqlite3 database.
5
+ DB = Sequel.sqlite
6
+ DB.create_table :sequel_test_identities do
7
+ primary_key :id
8
+ String :ham_sandwich, null: false
9
+ String :password_digest, null: false
10
+ end
11
+
12
+ class SequelTestIdentity < Sequel::Model
13
+ include OmniAuth::Identity::Models::Sequel
14
+ auth_key :ham_sandwich
15
+ end
16
+
17
+ RSpec.describe(OmniAuth::Identity::Models::Sequel, db: true) do
18
+ it 'delegates locate to the where query method' do
19
+ allow(SequelTestIdentity).to receive(:where).with('ham_sandwich' => 'open faced',
20
+ 'category' => 'sandwiches').and_return(['wakka'])
21
+ expect(SequelTestIdentity.locate('ham_sandwich' => 'open faced', 'category' => 'sandwiches')).to eq('wakka')
22
+ end
23
+ end
data/spec/spec_helper.rb CHANGED
@@ -6,6 +6,7 @@ require 'simplecov' if ruby_version >= Gem::Version.new('2.7') && RUBY_ENGINE ==
6
6
  require 'rack/test'
7
7
  require 'mongoid-rspec'
8
8
  require 'sqlite3'
9
+ require 'sequel'
9
10
  require 'anonymous_active_record'
10
11
  require 'byebug' if RUBY_ENGINE == 'ruby'
11
12
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: omniauth-identity
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.3
4
+ version: 3.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Peter Boling
@@ -44,16 +44,22 @@ dependencies:
44
44
  name: anonymous_active_record
45
45
  requirement: !ruby/object:Gem::Requirement
46
46
  requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: '1.0'
47
50
  - - ">="
48
51
  - !ruby/object:Gem::Version
49
- version: 1.0.7
52
+ version: 1.0.8
50
53
  type: :development
51
54
  prerelease: false
52
55
  version_requirements: !ruby/object:Gem::Requirement
53
56
  requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: '1.0'
54
60
  - - ">="
55
61
  - !ruby/object:Gem::Version
56
- version: 1.0.7
62
+ version: 1.0.8
57
63
  - !ruby/object:Gem::Dependency
58
64
  name: mongoid
59
65
  requirement: !ruby/object:Gem::Requirement
@@ -72,14 +78,14 @@ dependencies:
72
78
  name: nobrainer
73
79
  requirement: !ruby/object:Gem::Requirement
74
80
  requirements:
75
- - - ">="
81
+ - - "~>"
76
82
  - !ruby/object:Gem::Version
77
83
  version: '0'
78
84
  type: :development
79
85
  prerelease: false
80
86
  version_requirements: !ruby/object:Gem::Requirement
81
87
  requirements:
82
- - - ">="
88
+ - - "~>"
83
89
  - !ruby/object:Gem::Version
84
90
  version: '0'
85
91
  - !ruby/object:Gem::Dependency
@@ -124,6 +130,20 @@ dependencies:
124
130
  - - "~>"
125
131
  - !ruby/object:Gem::Version
126
132
  version: '3'
133
+ - !ruby/object:Gem::Dependency
134
+ name: sequel
135
+ requirement: !ruby/object:Gem::Requirement
136
+ requirements:
137
+ - - "~>"
138
+ - !ruby/object:Gem::Version
139
+ version: '5'
140
+ type: :development
141
+ prerelease: false
142
+ version_requirements: !ruby/object:Gem::Requirement
143
+ requirements:
144
+ - - "~>"
145
+ - !ruby/object:Gem::Version
146
+ version: '5'
127
147
  - !ruby/object:Gem::Dependency
128
148
  name: sqlite3
129
149
  requirement: !ruby/object:Gem::Requirement
@@ -156,6 +176,7 @@ files:
156
176
  - lib/omniauth/identity/models/couch_potato.rb
157
177
  - lib/omniauth/identity/models/mongoid.rb
158
178
  - lib/omniauth/identity/models/no_brainer.rb
179
+ - lib/omniauth/identity/models/sequel.rb
159
180
  - lib/omniauth/identity/secure_password.rb
160
181
  - lib/omniauth/strategies/identity.rb
161
182
  - spec/omniauth/identity/model_spec.rb
@@ -163,6 +184,7 @@ files:
163
184
  - spec/omniauth/identity/models/couch_potato_spec.rb
164
185
  - spec/omniauth/identity/models/mongoid_spec.rb
165
186
  - spec/omniauth/identity/models/no_brainer_spec.rb
187
+ - spec/omniauth/identity/models/sequel_spec.rb
166
188
  - spec/omniauth/identity/secure_password_spec.rb
167
189
  - spec/omniauth/strategies/identity_spec.rb
168
190
  - spec/spec_helper.rb
@@ -196,6 +218,7 @@ test_files:
196
218
  - spec/omniauth/identity/models/couch_potato_spec.rb
197
219
  - spec/omniauth/identity/models/mongoid_spec.rb
198
220
  - spec/omniauth/identity/models/no_brainer_spec.rb
221
+ - spec/omniauth/identity/models/sequel_spec.rb
199
222
  - spec/omniauth/identity/secure_password_spec.rb
200
223
  - spec/omniauth/strategies/identity_spec.rb
201
224
  - spec/spec_helper.rb