postmark-inbound 0.0.2 → 0.0.3

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: d459f72857c9460b4326097acfb1cb7e4307cbe1
4
- data.tar.gz: dab4585dec8aaf993599bdfb3a3144f9ce8b89a3
3
+ metadata.gz: fe7694d0faeedc5cdd97dd2e63d330bec50b9ea6
4
+ data.tar.gz: c3ec1d7e11bc8158817ae9d9370e37b632030349
5
5
  SHA512:
6
- metadata.gz: a9d185ee96cb449c307d46a3a1c432fb23ce10a712ff94277eef30aaeeb87cc3136fc026ecea7976de20374f886f130876391cdee6c0055e131bb0a7c06383fc
7
- data.tar.gz: 4362e2b58199943e1ab6c9393cd8eb36ab1751737ac96de7ef2c41941f32ffcf28550e76405da56037b69aaff75d9ab166dd6661c21ba7f831c5e3e32c45f528
6
+ metadata.gz: 9c7d26a417d122ac4485ab42e07c1518ec8ea00d393905a6e97db72c00c4834f24b3f361ce6799433b5faaa3446b812dbb0af7a6519fcd99e4fd774ba761a68f
7
+ data.tar.gz: a47d758e4a19c7aba0fd4159a4caf1b0c814b719f0dcc19e90cb03ce399f2b4432717ee89520ca67c9a27d0c05f6d2e970208248ede534b542cdb8dde0ec4671
@@ -6,26 +6,15 @@ module PINS
6
6
  module Helper
7
7
 
8
8
  def parse_json(json)
9
- obj = JSON.parse(json)
10
- return parse_pm(keys_to_sym(obj)).merge!(catch_pm_headers(obj[:headers]))
9
+ obj = JSON.parse(downcase_keys(json), {symbolize_names: true})
10
+ return parse_pm(obj).merge!(catch_pm_headers(obj[:headers]))
11
11
  end
12
12
 
13
- # Convert all Hash keys to lowercase symbols
14
- # @param obj [Object] any Ruby object
15
- def keys_to_sym(obj)
16
- case obj
17
- when Array
18
- obj.each do |v|
19
- keys_to_sym(v)
20
- end
21
- when Hash
22
- obj.keys.each do |k|
23
- if k.class == String
24
- obj[k.downcase.to_sym] = keys_to_sym(obj.delete(k))
25
- end
26
- end
27
- end
28
- return obj
13
+ # Convert JSON keys to lowercase
14
+ # @param json [String]
15
+ # @return [String] converted JSON
16
+ def downcase_keys(json)
17
+ json.gsub(/"\w+":/) { |m| m.downcase }
29
18
  end
30
19
 
31
20
  # Additional parsing/conversions
@@ -94,6 +83,3 @@ module PINS
94
83
  end
95
84
 
96
85
  end
97
-
98
-
99
- [{'A' => 1, 'Base' => 'Text', 'He' => {'llo' => 2, 'NONE' => 0}, 'aRRAy' => [1,2,{a: 1, 'BB' => "two"}]}]
@@ -1,5 +1,5 @@
1
1
  module PINS
2
2
 
3
- Version = '0.0.2'
3
+ Version = '0.0.3'
4
4
 
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: postmark-inbound
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ken J.
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-12-28 00:00:00.000000000 Z
11
+ date: 2017-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: kajiki