push_to_sns 0.3.3 → 0.4.0
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6ce7165abc98c6a55c314c5ea9add5a96abd7e3d
|
4
|
+
data.tar.gz: 2252458242c7cbcc967e0acaf39e0ae54d71e3f3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4701e0e3d22d36a9d2fb301f766f09d3cbd4322d5ca6780bf6912ad5078ab7d2445cc835f478ecd1628f860a356ddea4d38b548266793858e3307b6b608d2cc6
|
7
|
+
data.tar.gz: fc033abf703a2969f79af6c6aa1b059395466f5b37afc29c0dfabed5feabadd75455a48c6ec51b864ab641e0147898ce9360012db5e848a54559684b679a8bc5
|
@@ -1,7 +1,5 @@
|
|
1
1
|
module PushToSNS
|
2
2
|
class AndroidPushNotification < BasicPushNotification
|
3
|
-
DEFAULT_MESSAGE = "Android Push Notification"
|
4
|
-
|
5
3
|
def message
|
6
4
|
{ GCM: { data: default_payload.deeper_merge(payload) }.to_json }
|
7
5
|
end
|
@@ -9,13 +7,13 @@ module PushToSNS
|
|
9
7
|
private
|
10
8
|
|
11
9
|
def default_payload
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
10
|
+
basic_payload = {}
|
11
|
+
basic_payload[:title] = payload[:title] if payload[:title]
|
12
|
+
basic_payload[:message] = payload[:message] if payload[:message]
|
13
|
+
basic_payload[:smallIcon] = payload[:small_icon] if payload[:small_icon]
|
14
|
+
basic_payload[:sound] = payload[:sound] if payload[:sound]
|
17
15
|
|
18
|
-
|
16
|
+
basic_payload
|
19
17
|
end
|
20
18
|
end
|
21
19
|
end
|
@@ -1,21 +1,23 @@
|
|
1
1
|
module PushToSNS
|
2
2
|
class IosPushNotification < BasicPushNotification
|
3
|
-
DEFAULT_MESSAGE = "IOS Push Notification"
|
4
|
-
|
5
3
|
def message
|
6
4
|
basic_message = {
|
7
5
|
apns => {
|
8
|
-
aps:
|
9
|
-
|
10
|
-
}.merge(payload)
|
11
|
-
}
|
6
|
+
aps: default_payload.merge(payload)
|
7
|
+
}.to_json
|
12
8
|
}
|
13
|
-
basic_message[apns][:aps][:badge] = payload[:badge] if payload[:badge]
|
14
|
-
basic_message[apns][:aps][:sound] = payload[:sound] if payload[:sound]
|
15
|
-
basic_message[apns] = basic_message[apns].to_json
|
16
9
|
basic_message
|
17
10
|
end
|
18
11
|
|
12
|
+
def default_payload
|
13
|
+
basic_payload = {}
|
14
|
+
basic_payload[:title] = payload[:title] if payload[:title]
|
15
|
+
basic_payload[:alert] = payload[:message] if payload[:message]
|
16
|
+
basic_payload[:badge] = payload[:badge] if payload[:badge]
|
17
|
+
basic_payload[:sound] = payload[:sound] if payload[:sound]
|
18
|
+
basic_payload
|
19
|
+
end
|
20
|
+
|
19
21
|
private
|
20
22
|
|
21
23
|
def apns
|
@@ -52,6 +52,14 @@ module PushToSNS
|
|
52
52
|
@sound ||= self.class.sound
|
53
53
|
end
|
54
54
|
|
55
|
+
def title
|
56
|
+
@title ||= self.class.title
|
57
|
+
end
|
58
|
+
|
59
|
+
def small_icon
|
60
|
+
@small_icon ||= self.class.small_icon
|
61
|
+
end
|
62
|
+
|
55
63
|
private
|
56
64
|
|
57
65
|
def call_or_read(proc_or_object, *arguments)
|
@@ -63,7 +71,7 @@ module PushToSNS
|
|
63
71
|
end
|
64
72
|
|
65
73
|
class << self
|
66
|
-
[:type, :message, :badge, :sound].each do |method_name|
|
74
|
+
[:type, :message, :badge, :sound, :title, :small_icon].each do |method_name|
|
67
75
|
property_name = "input_#{method_name}".to_sym
|
68
76
|
attr_accessor property_name
|
69
77
|
|
data/lib/push_to_sns/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: push_to_sns
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- juliogarciag
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|