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 +4 -4
- data/lib/postmark-inbound/helper.rb +7 -21
- data/lib/postmark-inbound/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: fe7694d0faeedc5cdd97dd2e63d330bec50b9ea6
|
4
|
+
data.tar.gz: c3ec1d7e11bc8158817ae9d9370e37b632030349
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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(
|
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
|
14
|
-
# @param
|
15
|
-
|
16
|
-
|
17
|
-
|
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"}]}]
|
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.
|
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:
|
11
|
+
date: 2017-03-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: kajiki
|