parsnip 0.0.3 → 0.0.4

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.
Files changed (3) hide show
  1. data/lib/parsnip/version.rb +1 -1
  2. data/lib/parsnip.rb +4 -2
  3. metadata +1 -1
@@ -1,3 +1,3 @@
1
1
  module Parsnip
2
- VERSION = '0.0.3'
2
+ VERSION = '0.0.4'
3
3
  end
data/lib/parsnip.rb CHANGED
@@ -38,14 +38,16 @@ module Parsnip
38
38
  def json_nip(body)
39
39
  JSON.parse(body) and nil
40
40
  rescue JSON::ParserError => e
41
- nip({ error: e.to_s }.to_json, 'application/json; charset=utf-8')
41
+ nip({ errors: [ e.to_s ] }.to_json, 'application/json; charset=utf-8')
42
42
  end
43
43
 
44
44
  def xml_nip(body)
45
45
  (Nokogiri::XML(body) { | config | config.strict }) and nil
46
46
  rescue Nokogiri::XML::SyntaxError => e
47
47
  error = Nokogiri::XML::Builder.new(encoding: 'UTF-8') do | xml |
48
- xml.error e.to_s
48
+ xml.errors {
49
+ xml.error e.to_s
50
+ }
49
51
  end
50
52
  nip(error.to_xml, 'application/xml; charset=utf-8')
51
53
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: parsnip
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: