active_record_api-rest 1.0.9 → 1.0.10
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: 5725a7eed108dec0d342fede5c8c2009f4eb34fd00f66ee5bc320ac72d8bd596
|
4
|
+
data.tar.gz: 72f6903479ce6fc8b2a7f37d583cdb55f9ac039aea541ff76e312d2a755fd024
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80fda6094d96f54182dc0f137296d7f9400b553aca15e7c408267ec85b91acce507b67b062eccc5603159c9628f63b7790c8b54db6a28a933eb0b8a398ba7c7b
|
7
|
+
data.tar.gz: 0b41e08348262252dfa058d03aafeed3fb5e83c454e1ea0751058b022599b78b8634cd00ac293b9706332830206f91105bd17cd458f1224ca19ef2bb5429b065
|
@@ -39,9 +39,12 @@ module ActiveRecordApi
|
|
39
39
|
protected
|
40
40
|
|
41
41
|
def redirect_to_model
|
42
|
-
|
43
|
-
|
44
|
-
|
42
|
+
redirect_to "#{protocol}://#{request.host_with_port}#{request.path}/#{model.id}", status: :see_other
|
43
|
+
end
|
44
|
+
|
45
|
+
def protocol
|
46
|
+
return 'http://' if Rails.env.development?
|
47
|
+
'https://'
|
45
48
|
end
|
46
49
|
|
47
50
|
def only_valid_params
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: active_record_api-rest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.10
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Full Measure Education
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -150,7 +150,6 @@ files:
|
|
150
150
|
- lib/active_record_api/rest/controller.rb
|
151
151
|
- lib/active_record_api/rest/graceful_errors.rb
|
152
152
|
- lib/active_record_api/rest/index_controller.rb
|
153
|
-
- lib/active_record_api/rest/request_url_generator.rb
|
154
153
|
- lib/active_record_api/rest/spec.rb
|
155
154
|
- lib/active_record_api/rest/spec/rest_controller_shared_example.rb
|
156
155
|
- lib/active_record_api/rest/version.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
require 'active_attr'
|
2
|
-
|
3
|
-
module ActiveRecordApi
|
4
|
-
module Rest
|
5
|
-
class RequestUrlGenerator
|
6
|
-
include ActiveAttr::Model
|
7
|
-
|
8
|
-
attribute :request
|
9
|
-
attribute :new_params, default: {}
|
10
|
-
|
11
|
-
delegate :host, :path, to: :request, prefix: true
|
12
|
-
|
13
|
-
def url
|
14
|
-
"#{micro_service_url}#{request_path}?#{new_params.to_param}"
|
15
|
-
end
|
16
|
-
|
17
|
-
def micro_service_url
|
18
|
-
"#{protocol}#{request_host}/api/#{micro_service_name}"
|
19
|
-
end
|
20
|
-
|
21
|
-
def micro_service_name
|
22
|
-
Rails.application.class.parent.to_s.underscore.tr('_', '-')
|
23
|
-
end
|
24
|
-
|
25
|
-
def protocol
|
26
|
-
return 'http://' if Rails.env.development?
|
27
|
-
'https://'
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
end
|