tramway-api 1.8.7 → 1.8.7.1
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: c1faafafdc03424f40bb3675cca9cd65a974c0fcdd12e5aea93a9e938c4ac780
|
4
|
+
data.tar.gz: a14a18d4b13ed34ae78e24efc07dd6a47f67612633086b5e6988f13f6286a5a8
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e1f1524a1819cf04ec8776dcbbd6751395c0bdf7197fd01c5515e8be13ae1e0c0865acd9d6a233d073a3b242d7a0566d87d5921a42bfad0a3646b75d5412f620
|
7
|
+
data.tar.gz: 203d0b68c69a8767c51e9937fccbc0a5bebe3c6e9b95c8db1c12a05970f3314fc6ae2aaf6ca84501cd7fab2856bc483fcff0e495dd8e15133ed5b130db2e14bf
|
@@ -6,37 +6,6 @@ module Tramway
|
|
6
6
|
include ::Knock::Authenticable
|
7
7
|
protect_from_forgery with: :null_session, if: proc { |c| c.request.format == 'application/json' }
|
8
8
|
rescue_from ActiveRecord::RecordNotFound, with: :not_found if Rails.env.production?
|
9
|
-
before_action :load_application
|
10
|
-
|
11
|
-
def load_application
|
12
|
-
if engine_loaded(request).present?
|
13
|
-
build_application_with_engine engine_loaded request
|
14
|
-
elsif application_class(request).present?
|
15
|
-
@application = application_class(request).camelize.constantize.first
|
16
|
-
else
|
17
|
-
@application = application_object request
|
18
|
-
end
|
19
|
-
end
|
20
|
-
|
21
|
-
private
|
22
|
-
|
23
|
-
def build_application_with_engine(engine_loaded)
|
24
|
-
engine_module = "::Tramway::#{engine_loaded.camelize}".constantize
|
25
|
-
@application = "#{engine_module}::#{engine_module.application.to_s.camelize}".constantize.first
|
26
|
-
@application_engine = engine_loaded
|
27
|
-
end
|
28
|
-
|
29
|
-
def application_class(request)
|
30
|
-
Constraints::DomainConstraint.new(request.domain).application_class
|
31
|
-
end
|
32
|
-
|
33
|
-
def engine_loaded(request)
|
34
|
-
Constraints::DomainConstraint.new(request.domain).engine_loaded
|
35
|
-
end
|
36
|
-
|
37
|
-
def application_object(request)
|
38
|
-
Constraints::DomainConstraint.new(request.domain).application_object
|
39
|
-
end
|
40
9
|
|
41
10
|
def not_found
|
42
11
|
render json: { data: [] }, status: :not_found
|
data/lib/tramway/api/version.rb
CHANGED