deep_unrest 0.1.19 → 0.1.20

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
  SHA1:
3
- metadata.gz: 317b3b779f913e0f2f35efb492b435d9a82ccb24
4
- data.tar.gz: 84257c5cd43e9432282aff3850a13c59f38d348d
3
+ metadata.gz: 298848186d99b08b61138ee69e64f4b7e1533323
4
+ data.tar.gz: 6e6e1d641b427c8bff316dddc5022645c4a0d9e3
5
5
  SHA512:
6
- metadata.gz: d898250158f68276e68902274f69ce4ee485f69d94ea2b6b7f310228be3dca0ead2612bda7ecd724c0a3ae13d1101937785efa3a42529ba0f41f8477a92851d7
7
- data.tar.gz: 8d3301ff0198b9f8fcdd4db6097186e9b31bbf43937d724a9ddbc7734c6a0faae216d5813e97e8ed6f000b48546f2bddb86b99928eb63b3bd9fe5163c4260596
6
+ metadata.gz: 294ef08f72dc4b7c75af39139be6860aca9728556e20856618a42bdd105f0e59a7559817ce6903f1a4a8cf64327fda14303cf44f49df91bd6b63af9a4a1495a7
7
+ data.tar.gz: 412601b198372de42790ca4985737d3ee9f876703d595fb3741000bfcad7a55edd8dbda7e053697e06814008ed53b869639c1b5adc2de4f0d660d077ec19327a
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module DeepUnrest
4
- VERSION = '0.1.19'
4
+ VERSION = '0.1.20'
5
5
  end
data/lib/deep_unrest.rb CHANGED
@@ -400,6 +400,15 @@ module DeepUnrest
400
400
  rx.match(key)
401
401
  end
402
402
 
403
+ # handle error titles in cases where error value is an array
404
+ def self.format_error_title(title)
405
+ if title.is_a?(Array)
406
+ title.join(', ')
407
+ else
408
+ title
409
+ end
410
+ end
411
+
403
412
  def self.format_errors(operation, path_info, values)
404
413
  if operation
405
414
  return values.map do |msg|
@@ -415,7 +424,7 @@ module DeepUnrest
415
424
  field_name].reject(&:empty?).compact.join('.')
416
425
  deep_unrest_path = [operation[:dr_error_key],
417
426
  field_name].compact.join('.')
418
- { title: "#{path_info[:field].humanize} #{msg}",
427
+ { title: "#{path_info[:field].humanize} #{format_error_title(msg)}",
419
428
  detail: msg,
420
429
  source: { pointer: pointer,
421
430
  deepUnrestPath: deep_unrest_path,
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: deep_unrest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.19
4
+ version: 0.1.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Lynn Hurley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-20 00:00:00.000000000 Z
11
+ date: 2017-07-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rails