moromi-aws-sns 0.12.0 → 0.13.0

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: cd6c8cad33c5f12466294a0faeaabce0fc910f81
4
- data.tar.gz: 1d413d4511b3bbf71e124b56d949ec8ba34e7359
3
+ metadata.gz: 58088388b1d00086e4b0505c5ded7b974cf661c3
4
+ data.tar.gz: ff9025ba2034cd7e758ac61553014551d24e4bab
5
5
  SHA512:
6
- metadata.gz: e6168df685bba3f1dcc4cddcaecf31040e37df3077bd74b423f4b33f0133efc7f1312fcf4115efc71500b9e23d56d918b6612ee8382ef02e777af3c2245fe931
7
- data.tar.gz: 6b780788a05c925753aace43b0ad18c41b30ba91f052d50607c8108ea4665f63c4aebf0c19cb967e70e111954ecd98fefe874690330c98dfc1a1a1ed647b20cb
6
+ metadata.gz: 549c0c4f8038b9adbb65b88a811d0528d236befec3a9aae0ef69654eb7aa77fe5d38628742b639f5cc57e7cb3e44b26a9345fc571f1091cb4b7259efd1173693
7
+ data.tar.gz: f337eb459813397ff54b87c7e26c5cfc7599bf8f5a783958f6dd33a1786de85d98cdfa0bc874152b514f2fd7660355b278ee9244f62dabaaa2547aae35d1e780
@@ -58,7 +58,7 @@ module Moromi
58
58
  end
59
59
 
60
60
  def to_data_hash
61
- {
61
+ base = {
62
62
  title: @title,
63
63
  body: @body,
64
64
  android_channel_id: @android_channel_id,
@@ -71,9 +71,9 @@ module Moromi
71
71
  body_loc_args: @body_loc_args,
72
72
  title_loc_key: @title_loc_key,
73
73
  title_loc_args: @title_loc_args,
74
- type: @type,
75
- custom_data: @custom_data.to_json
74
+ type: @type
76
75
  }
76
+ flatten_hash(@custom_data).merge(base)
77
77
  end
78
78
 
79
79
  def to_message_json
@@ -85,6 +85,18 @@ module Moromi
85
85
  def setup_initial_custom_data(custom_data)
86
86
  custom_data
87
87
  end
88
+
89
+ def flatten_hash(hash)
90
+ hash.each_with_object({}) do |(k, v), h|
91
+ if v.is_a? Hash
92
+ flatten_hash(v).map do |h_k, h_v|
93
+ h["#{k}_#{h_k}".to_sym] = h_v
94
+ end
95
+ else
96
+ h[k] = v
97
+ end
98
+ end
99
+ end
88
100
  end
89
101
  end
90
102
  end
@@ -1,7 +1,7 @@
1
1
  module Moromi
2
2
  module Aws
3
3
  module Sns
4
- VERSION = '0.12.0'
4
+ VERSION = '0.13.0'
5
5
  end
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: moromi-aws-sns
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.12.0
4
+ version: 0.13.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Takahiro Ooishi