app_rail-airtable 0.4.6 → 0.4.8
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3d413292d55b91966eeed50458ef1cd264cc278add196d53fbab2633dfd406d3
|
4
|
+
data.tar.gz: e16281efca091bc9d9e2dc2abf2f81c4c16416cd9cf27a6b34127bd191899bb0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a4c6b3fe35603c645186b1d45d67d16f4afa1d556500abb1f5467b9ae78be4b29dc847e85a9c3379ecf75ebf0b94894e5d620557096eec9abad06d8e1248017b
|
7
|
+
data.tar.gz: e61beebcf401102669f1707ddc4f2a5b6b9f7d25585b05cbace9198a1d55196739ca22e73297699fc5413c1226d1a050c754cd7f2fdbd49bdc34a436950dd90f
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
app_rail-airtable (0.4.
|
4
|
+
app_rail-airtable (0.4.8)
|
5
5
|
activesupport
|
6
6
|
airrecord
|
7
7
|
app_rail-steps
|
@@ -14,7 +14,7 @@ PATH
|
|
14
14
|
GEM
|
15
15
|
remote: https://rubygems.org/
|
16
16
|
specs:
|
17
|
-
activesupport (7.0.
|
17
|
+
activesupport (7.0.4)
|
18
18
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
19
19
|
i18n (>= 1.6, < 2)
|
20
20
|
minitest (>= 5.1)
|
@@ -23,28 +23,28 @@ GEM
|
|
23
23
|
faraday (>= 1.0, < 3.0)
|
24
24
|
faraday-net_http_persistent
|
25
25
|
net-http-persistent
|
26
|
-
app_rail-steps (0.2.
|
27
|
-
bcrypt (3.1.
|
26
|
+
app_rail-steps (0.2.16)
|
27
|
+
bcrypt (3.1.18)
|
28
28
|
byebug (11.1.3)
|
29
29
|
concurrent-ruby (1.1.10)
|
30
|
-
connection_pool (2.
|
30
|
+
connection_pool (2.3.0)
|
31
31
|
diff-lcs (1.4.4)
|
32
|
-
faraday (2.
|
33
|
-
faraday-net_http (
|
32
|
+
faraday (2.6.0)
|
33
|
+
faraday-net_http (>= 2.0, < 3.1)
|
34
34
|
ruby2_keywords (>= 0.0.4)
|
35
|
-
faraday-net_http (
|
36
|
-
faraday-net_http_persistent (2.0
|
37
|
-
faraday
|
35
|
+
faraday-net_http (3.0.1)
|
36
|
+
faraday-net_http_persistent (2.1.0)
|
37
|
+
faraday (~> 2.5)
|
38
38
|
net-http-persistent (~> 4.0)
|
39
|
-
i18n (1.
|
39
|
+
i18n (1.12.0)
|
40
40
|
concurrent-ruby (~> 1.0)
|
41
|
-
minitest (5.
|
42
|
-
mustermann (
|
41
|
+
minitest (5.16.3)
|
42
|
+
mustermann (2.0.2)
|
43
43
|
ruby2_keywords (~> 0.0.1)
|
44
44
|
net-http-persistent (4.0.1)
|
45
45
|
connection_pool (~> 2.2)
|
46
46
|
rack (2.2.3)
|
47
|
-
rack-protection (2.2.
|
47
|
+
rack-protection (2.2.2)
|
48
48
|
rack
|
49
49
|
rack-test (1.1.0)
|
50
50
|
rack (>= 1.0, < 3)
|
@@ -63,14 +63,14 @@ GEM
|
|
63
63
|
rspec-support (~> 3.10.0)
|
64
64
|
rspec-support (3.10.2)
|
65
65
|
ruby2_keywords (0.0.5)
|
66
|
-
sinatra (2.2.
|
67
|
-
mustermann (~>
|
66
|
+
sinatra (2.2.2)
|
67
|
+
mustermann (~> 2.0)
|
68
68
|
rack (~> 2.2)
|
69
|
-
rack-protection (= 2.2.
|
69
|
+
rack-protection (= 2.2.2)
|
70
70
|
tilt (~> 2.0)
|
71
71
|
thor (1.1.0)
|
72
|
-
tilt (2.0.
|
73
|
-
tzinfo (2.0.
|
72
|
+
tilt (2.0.11)
|
73
|
+
tzinfo (2.0.5)
|
74
74
|
concurrent-ruby (~> 1.0)
|
75
75
|
|
76
76
|
PLATFORMS
|
@@ -12,7 +12,7 @@ module AppRail
|
|
12
12
|
|
13
13
|
def self.included(klass)
|
14
14
|
klass.extend(ClassMethods)
|
15
|
-
klass.prepend(InstanceMethods)
|
15
|
+
klass.prepend(InstanceMethods)
|
16
16
|
end
|
17
17
|
|
18
18
|
module ClassMethods
|
@@ -47,38 +47,30 @@ module AppRail
|
|
47
47
|
end
|
48
48
|
|
49
49
|
module InstanceMethods
|
50
|
-
def
|
51
|
-
|
52
|
-
super('Email' => kwargs[:email], 'Password Hash' => self.class.password_hash(kwargs[:password]), 'Access Token' => self.class.next_access_token)
|
53
|
-
else
|
54
|
-
super
|
55
|
-
end
|
50
|
+
def valid_password?(password)
|
51
|
+
BCrypt::Password.new(password_hash) == password
|
56
52
|
end
|
57
|
-
end
|
58
53
|
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
def password_hash
|
64
|
-
self['Password Hash']
|
65
|
-
end
|
54
|
+
def password_hash
|
55
|
+
self['Password Hash']
|
56
|
+
end
|
66
57
|
|
67
|
-
|
68
|
-
|
58
|
+
def oauth_session
|
59
|
+
ensure_access_token!
|
69
60
|
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
61
|
+
{
|
62
|
+
access_token: self['Access Token'],
|
63
|
+
scope: :user,
|
64
|
+
token_type: :bearer,
|
65
|
+
expires_in: 31_536_000 # 1 year
|
66
|
+
}
|
67
|
+
end
|
77
68
|
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
69
|
+
def ensure_access_token!
|
70
|
+
unless self['Access Token']
|
71
|
+
self['Access Token'] = User.next_access_token
|
72
|
+
save
|
73
|
+
end
|
82
74
|
end
|
83
75
|
end
|
84
76
|
end
|
@@ -68,8 +68,10 @@ module AppRail
|
|
68
68
|
|
69
69
|
def self.sign_in_route(name)
|
70
70
|
post "/#{name}/session" do
|
71
|
+
halt [401, { error: 'Invalid client_id' }.to_json] unless params['client_id'] == oauth_client_id
|
72
|
+
|
71
73
|
resource = name.classify_constantize.authenticate_by_params(params)
|
72
|
-
halt 401 unless resource
|
74
|
+
halt [401, { error: 'Invalid credentials' }.to_json] unless resource
|
73
75
|
|
74
76
|
resource.oauth_session.to_json
|
75
77
|
end
|
data/templates/project/Gemfile
CHANGED
@@ -3,10 +3,12 @@
|
|
3
3
|
source 'https://rubygems.org'
|
4
4
|
git_source(:github) { |repo| "https://github.com/#{repo}.git" }
|
5
5
|
|
6
|
-
ruby '
|
6
|
+
ruby '3.1.2'
|
7
7
|
|
8
|
-
gem 'app_rail-airtable'
|
8
|
+
gem 'app_rail-airtable'
|
9
9
|
gem 'app_rail-steps'
|
10
|
+
gem 'sinatra', '~> 3.0', '>= 3.0.2'
|
11
|
+
gem 'puma'
|
10
12
|
|
11
13
|
group :development do
|
12
14
|
gem 'dotenv'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: app_rail-airtable
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brooke-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-10-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|
@@ -213,7 +213,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
213
213
|
- !ruby/object:Gem::Version
|
214
214
|
version: '0'
|
215
215
|
requirements: []
|
216
|
-
rubygems_version: 3.
|
216
|
+
rubygems_version: 3.3.7
|
217
217
|
signing_key:
|
218
218
|
specification_version: 4
|
219
219
|
summary: Gem to help building App Rail servers using Airtable as a backend
|