toast 1.0.6 → 1.0.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/toast/plural_assoc_request.rb +4 -2
- data/lib/toast/request_helpers.rb +3 -3
- data/lib/toast/singular_assoc_request.rb +4 -2
- data/lib/toast/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 450e24a27e15daf28e41278e02d6083a071e0241
|
4
|
+
data.tar.gz: 9e6df21a6ecc522b1ad9527d0814bd7bf975f573
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c5da5a44660b1285ca41e658cb603b4279a88ca2b9ca2c54dbf1eb03508417cb3a822132254dfbfff45c293cd08411870b1a864382b17f72a91975f2848e8dc7
|
7
|
+
data.tar.gz: b0f100c216e10e010a3dae053ee2dedba1429d776722af8e2e860bc078ccbf8796a9021e6b1cb53400cfd4cb8e57d0b71c11336e4efbcbd89d67c646cdcd7bdd
|
@@ -208,7 +208,8 @@ class Toast::PluralAssocRequest
|
|
208
208
|
call_handler(@config.via_link.handler, source, target, @uri_params)
|
209
209
|
|
210
210
|
response :ok,
|
211
|
-
msg: "linked #{target_model_class.name}##{@id} with #{source.class}##{source.id}.#{@config.assoc_name}"
|
211
|
+
msg: "linked #{target_model_class.name}##{@id} with #{source.class}##{source.id}.#{@config.assoc_name}",
|
212
|
+
body: Toast.settings.link_unlink_via_post ? '' : nil
|
212
213
|
|
213
214
|
rescue ActiveRecord::RecordNotFound => error
|
214
215
|
response :not_found, msg: error.message
|
@@ -257,7 +258,8 @@ class Toast::PluralAssocRequest
|
|
257
258
|
call_handler(@config.via_unlink.handler, source, target_model_class.find(id), @uri_params)
|
258
259
|
|
259
260
|
response :ok,
|
260
|
-
msg: "unlinked #{target_model_class.name}##{id} from #{source.class}##{source.id}.#{@config.assoc_name}"
|
261
|
+
msg: "unlinked #{target_model_class.name}##{id} from #{source.class}##{source.id}.#{@config.assoc_name}",
|
262
|
+
body: Toast.settings.link_unlink_via_post ? '' : nil
|
261
263
|
|
262
264
|
rescue ActiveRecord::RecordNotFound => error
|
263
265
|
response :not_found, msg: error.message
|
@@ -12,9 +12,9 @@ module Toast::RequestHelpers
|
|
12
12
|
# relies on HTTP_X_FORWARDED* headers
|
13
13
|
def base_uri request
|
14
14
|
port = ":#{request.port}" unless request.port.in?([80,443])
|
15
|
-
# remove recource path part form full path (namespace remains)
|
15
|
+
# remove recource path part form full path (namespace remains)
|
16
16
|
path = request.path.sub(request.path_parameters[:toast_path],'')
|
17
|
-
(request.protocol + request.host + port.to_s + path).chomp('/')
|
17
|
+
(request.protocol + request.host + port.to_s + path).chomp('/')
|
18
18
|
end
|
19
19
|
|
20
20
|
# split the name and id of the resource from a LinkHeader
|
@@ -90,7 +90,7 @@ module Toast::RequestHelpers
|
|
90
90
|
|
91
91
|
unless Rails.env == 'production'
|
92
92
|
# put message in body, too, if body is free
|
93
|
-
body
|
93
|
+
body = msg if body.blank?
|
94
94
|
end
|
95
95
|
|
96
96
|
[ Rack::Utils::SYMBOL_TO_STATUS_CODE[status_sym],
|
@@ -113,7 +113,8 @@ class Toast::SingularAssocRequest
|
|
113
113
|
|
114
114
|
@config.via_link.handler.call(source, target_model_class.find(target_id), @uri_params)
|
115
115
|
response :ok,
|
116
|
-
msg: "linked #{source.class}##{source.id} with #{target_model_class.name}##{@id}"
|
116
|
+
msg: "linked #{source.class}##{source.id} with #{target_model_class.name}##{@id}",
|
117
|
+
body: Toast.settings.link_unlink_via_post ? '' : nil
|
117
118
|
|
118
119
|
rescue NotAllowed => error
|
119
120
|
return response :unauthorized, msg: "not authorized by allow block in: #{error.source_location}"
|
@@ -182,7 +183,8 @@ class Toast::SingularAssocRequest
|
|
182
183
|
call_handler(@config.via_unlink.handler, source, target, @uri_params)
|
183
184
|
|
184
185
|
response :ok,
|
185
|
-
msg: "unlinked #{source.class}##{source.id} from #{target_model_class.name}##{target_id}"
|
186
|
+
msg: "unlinked #{source.class}##{source.id} from #{target_model_class.name}##{target_id}",
|
187
|
+
body: Toast.settings.link_unlink_via_post ? '' : nil
|
186
188
|
|
187
189
|
rescue NotAllowed => error
|
188
190
|
return response :unauthorized,
|
data/lib/toast/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: toast
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- robokopp (Robert Annies)
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|