toast 1.0.6 → 1.0.7

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fcf34faf2722c917e10c577473faa6a9b53831fb
4
- data.tar.gz: 9f0f82599a3f566ac690509d18870eb383a4af71
3
+ metadata.gz: 450e24a27e15daf28e41278e02d6083a071e0241
4
+ data.tar.gz: 9e6df21a6ecc522b1ad9527d0814bd7bf975f573
5
5
  SHA512:
6
- metadata.gz: e0b50c7153ee3bcf91aecd387ea6bd6ca525239cc9e76597085cae557b3f937545a40405e9cedfd0991cccd969b0b78722d507bae2899aeb6923bdafcbb1e4ea
7
- data.tar.gz: 13ff423f0903aef4e5a577ef8e03a2f79a8366e783ca4035655188608bcb2ed84a9ec0617b5761002a3a4a84ddcb658ea3f363ac821c2407eae0bf6635115962
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 ||= msg
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
@@ -1,3 +1,3 @@
1
1
  module Toast
2
- VERSION = '1.0.6'
2
+ VERSION = '1.0.7'
3
3
  end
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.6
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-13 00:00:00.000000000 Z
11
+ date: 2019-02-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails