j7w1 0.0.23 → 0.0.24
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/j7w1/sns_push_client.rb +18 -8
- data/lib/j7w1/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: 83d3f2bd8cde5d3e11d40a37b06dc0092b322811
|
4
|
+
data.tar.gz: d37d2f3da9f420cce773a18a4bacff0326c078b1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 74afc75e3406e59f282a623b37f05899ab61157d8100593b72113cfdc428188ce3d26c69472fc9782f0171cded322a86812c74fe401bf0eecac068e62b82f514
|
7
|
+
data.tar.gz: 0e70ffa766a22f87473acb3495b75dd5ccf9d72c5d127aa77b577e9f5be7b5e55da46f6790a1aa6ba054b14af361d2112c6faa52a1da51977337e78c4f0113e3
|
data/lib/j7w1/sns_push_client.rb
CHANGED
@@ -6,17 +6,23 @@ module J7W1
|
|
6
6
|
|
7
7
|
APNS_MAX_MESSAGE_SIZE = 40
|
8
8
|
|
9
|
-
|
9
|
+
INPUT_PAYLOAD_TABLE = {
|
10
|
+
ios: {
|
10
11
|
message: :alert,
|
11
12
|
badge: :badge,
|
12
13
|
sound: :sound,
|
13
|
-
|
14
|
-
|
15
|
-
ANDROID_TABLE = {
|
14
|
+
}.freeze,
|
15
|
+
android: {
|
16
16
|
message: :message,
|
17
17
|
badge: :badge,
|
18
18
|
sound: :sound,
|
19
19
|
data: :data,
|
20
|
+
}.freeze,
|
21
|
+
}.freeze
|
22
|
+
|
23
|
+
DEFAULT_SOUND_VALUE = {
|
24
|
+
android: true,
|
25
|
+
ios: 'default',
|
20
26
|
}.freeze
|
21
27
|
|
22
28
|
def create_ios_application(name, certs, private_key, options)
|
@@ -132,7 +138,7 @@ module J7W1
|
|
132
138
|
end
|
133
139
|
|
134
140
|
content = {
|
135
|
-
aps:
|
141
|
+
aps: message_content(message_value, platform: :ios),
|
136
142
|
}
|
137
143
|
content.merge! data: data if data
|
138
144
|
|
@@ -143,12 +149,16 @@ module J7W1
|
|
143
149
|
message_value.merge!(data: data)
|
144
150
|
{
|
145
151
|
GCM: {
|
146
|
-
data:
|
152
|
+
data: message_content(message_value, platform: :android),
|
147
153
|
}.to_json
|
148
154
|
}
|
149
155
|
end
|
150
156
|
|
151
|
-
def
|
157
|
+
def message_content(content, platform: nil)
|
158
|
+
table = INPUT_PAYLOAD_TABLE[platform]
|
159
|
+
|
160
|
+
content[:sound] = DEFAULT_SOUND_VALUE[platform] if content[:sound] == true
|
161
|
+
|
152
162
|
table.keys.reduce({}) do |h, key|
|
153
163
|
h[table[key]] = content[key]
|
154
164
|
h
|
@@ -165,7 +175,7 @@ module J7W1
|
|
165
175
|
end
|
166
176
|
|
167
177
|
module_function :create_sns_client, :create_ios_application, :create_device_endpoint, :push,
|
168
|
-
:payload_for, :ios_payload_for, :android_payload_for, :content_from, :
|
178
|
+
:payload_for, :ios_payload_for, :android_payload_for, :content_from, :message_content,
|
169
179
|
:destroy_device_endpoint, :destroy_application_endpoint
|
170
180
|
end
|
171
181
|
end
|
data/lib/j7w1/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: j7w1
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.24
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- condor
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-07-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|