hey-you-fcm-push 0.1.2 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/hey_you/channels/fcm_push.rb +13 -3
- data/lib/hey_you_fcm_push/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8c286e9339b6ef0cc781b92c78cb47bd1850cedf08dc210798cead1d711d1002
|
4
|
+
data.tar.gz: 19e09925db997861cbf98f374fd1edb6bcbbdab5f26e981bfa87d6e57adc6649
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d0af3921010cbce6a05c327bdeaf61646c039c97a022bc39cf00ac2bfd4935eb9743bc425d3afb4be9c35cca3bafe5f3fe2aaa374c55ef5473764114d409c135
|
7
|
+
data.tar.gz: b7e5220ee1e99beaf54f3f90367bf634abf6ba134a7ec2b00c1c224aace2adec8abf6aa60c53a9a4e3f3243cc2f572214c22a3ecf05b5da3c23b6a1ff6f3cc6a
|
@@ -10,6 +10,7 @@ module HeyYou
|
|
10
10
|
# @param [HeyYou::Builder] builder - builder with notifications texts and settings
|
11
11
|
# @option [String] name - Output Only. The identifier of the message sent
|
12
12
|
# @option [String] token - Registration token to send a message to.
|
13
|
+
# @option [String] to - Alias for `token`. `token` in high priority.
|
13
14
|
# @option [String] topic - Topic name to send a message to, e.g. "weather".
|
14
15
|
# @option [String] condition - Condition to send a message to, e.g. "'foo' in topics && 'bar' in topics".
|
15
16
|
# @option [Hash] notification - Basic notification template to use across all platforms.
|
@@ -19,12 +20,21 @@ module HeyYou
|
|
19
20
|
# @option [Hash] fcm_options - Platform independent options for features provided by the FCM SDKs.
|
20
21
|
# @option [Hash] push_data - Input only. Arbitrary key/value payload. The key should not be a reserved word ("from", "message_type", or any word starting with "google" or "gcm").
|
21
22
|
#
|
22
|
-
# @return [Hash] - FCM
|
23
|
+
# @return [Array{Hash}] - FCM responses
|
23
24
|
#
|
24
25
|
# @see: https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#resource:-message
|
25
26
|
def send!(builder, **options)
|
26
|
-
|
27
|
-
|
27
|
+
options[:token] ||= options[:to]
|
28
|
+
|
29
|
+
if options[:token].is_a?(Array)
|
30
|
+
messages = options[:token].map { |token| build_message(builder, **options.merge(token: token)) }
|
31
|
+
end
|
32
|
+
|
33
|
+
messages ||= [build_message(builder, **options)]
|
34
|
+
|
35
|
+
messages.map do |message|
|
36
|
+
HeyYouFcmPush::Connection.instance.send_notification(message, validate_only: options[:validate_only])
|
37
|
+
end
|
28
38
|
end
|
29
39
|
|
30
40
|
private
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hey-you-fcm-push
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sergey Nesterov
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-01-19 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hey-you
|