tramway-api 0.6.1.2 → 0.6.1.3
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 +4 -4
- data/app/controllers/tramway/api/application_controller.rb +11 -3
- data/lib/tramway/api/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 685306ba5192ad4a31885a29f774e3892f2b0e807c2d65323c3fb4aabdcb5fe4
|
4
|
+
data.tar.gz: 391fd9136d462647cc2b36e50a4cc1f8255fe3da57fd043b238dcc64cc90bcfb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2ec68fd04e3e14a4f85855942fed20f163f0eca33ad0acc1c487f5116059eb689962e4bb7af0a7cb1f1fd4f67fd06e2851919a70940c489b669e555e1249f3b1
|
7
|
+
data.tar.gz: 9aeae6018d957203230b6e45c01b0dd80ff857a0bb50b4d26590de8e7baccac7afa8889b8c63d5939c26a8d807bbe36d250edcb77fa8abf34ba547aecf8875bd
|
@@ -11,10 +11,18 @@ module Tramway
|
|
11
11
|
render json: { data: [] }, status: :not_found
|
12
12
|
end
|
13
13
|
|
14
|
+
def unauthorized
|
15
|
+
head :unauthorized
|
16
|
+
end
|
17
|
+
|
14
18
|
protected
|
15
19
|
|
20
|
+
def authenticate_user
|
21
|
+
authenticate_for Tramway::Api.user_based_model
|
22
|
+
end
|
23
|
+
|
16
24
|
def authenticate
|
17
|
-
|
25
|
+
unauthorized unless entity.present? && entity.authenticate(auth_params[:password])
|
18
26
|
end
|
19
27
|
|
20
28
|
def auth_token
|
@@ -30,12 +38,12 @@ module Tramway
|
|
30
38
|
if Tramway::Api.user_based_model.respond_to? :from_token_request
|
31
39
|
Tramway::Api.user_based_model.from_token_request request
|
32
40
|
else
|
33
|
-
Tramway::Api.user_based_model.find_by
|
41
|
+
params[:auth] && Tramway::Api.user_based_model.find_by(email: auth_params[:email])
|
34
42
|
end
|
35
43
|
end
|
36
44
|
|
37
45
|
def auth_params
|
38
|
-
params
|
46
|
+
params[:auth]&.permit :email, :password
|
39
47
|
end
|
40
48
|
end
|
41
49
|
end
|
data/lib/tramway/api/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tramway-api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.6.1.
|
4
|
+
version: 0.6.1.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Pavel Kalashnikov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-05-
|
11
|
+
date: 2019-05-17 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: knock
|