google-api-fcm 0.1.4 → 0.1.9
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
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 75565301397620df5b9d1228c69df7c6e6c7c6cadb21ddd3934ab94d2af9259a
|
4
|
+
data.tar.gz: 6ba68e2abb426cc32f86103f4ea0d9278f583cebf0e1230fa3e947d7b311dea1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f59d151afe07ee9bb34ad0e0ecd2061c995f931c80c9431e57c6f682427ad7cbb9bffa343dbf2cd8ba1cf7298e341f6166a6c0eb8a80e8ea2d814b3f114bdd53
|
7
|
+
data.tar.gz: 8a0c6f3aaa7c6caa3e1f6eaa08497d150330d4a891789f2c159ea60e5381c0e7bf0a54a8e769b94306f81e3ca81bdc11645c54a996659e1774e8a17a0376d1e2
|
@@ -11,6 +11,10 @@ module Google
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def initialize_build(**args)
|
14
|
+
if args[:token] && args[:topic]
|
15
|
+
raise ArgumentError, "Arguments :token and :topic can't be used together"
|
16
|
+
end
|
17
|
+
|
14
18
|
if args[:notification]
|
15
19
|
notification = Notification.new(
|
16
20
|
title: args[:notification][:title],
|
@@ -20,6 +24,8 @@ module Google
|
|
20
24
|
|
21
25
|
message_object_args = {
|
22
26
|
topic: args[:topic],
|
27
|
+
condition: args[:condition],
|
28
|
+
token: args[:token],
|
23
29
|
data: args[:payload]
|
24
30
|
}
|
25
31
|
|
@@ -39,6 +45,14 @@ module Google
|
|
39
45
|
message_object_args[:webpush] = args[:webpush]
|
40
46
|
end
|
41
47
|
|
48
|
+
if args.key?(:fcm_options)
|
49
|
+
message_object_args[:fcm_options] = args[:fcm_options]
|
50
|
+
end
|
51
|
+
|
52
|
+
if args.key?(:extra)
|
53
|
+
message_object_args[:extra] = args[:extra]
|
54
|
+
end
|
55
|
+
|
42
56
|
@message_object = MessageObject.new(message_object_args)
|
43
57
|
end
|
44
58
|
|
@@ -55,11 +69,14 @@ module Google
|
|
55
69
|
include Google::Apis::Core::Hashable
|
56
70
|
|
57
71
|
attr_accessor :topic
|
72
|
+
attr_accessor :condition
|
73
|
+
attr_accessor :token
|
58
74
|
attr_accessor :notification
|
59
75
|
attr_accessor :data
|
60
76
|
attr_accessor :android
|
61
77
|
attr_accessor :apns
|
62
78
|
attr_accessor :webpush
|
79
|
+
attr_accessor :fcm_options
|
63
80
|
|
64
81
|
def initialize(**args)
|
65
82
|
update!(**args)
|
@@ -68,14 +85,23 @@ module Google
|
|
68
85
|
# Update properties of this object
|
69
86
|
def update!(**args)
|
70
87
|
@topic = args[:topic] if args.key?(:topic)
|
88
|
+
@condition = args[:condition] if args.key?(:condition)
|
89
|
+
@token = args[:token] if args.key?(:token)
|
71
90
|
@notification = args[:notification] if args.key?(:notification)
|
72
91
|
if args.key?(:data) && args[:data].is_a?(Hash)
|
73
92
|
@data = { 'payload' => JSON.dump(args[:data]) }
|
74
93
|
end
|
75
94
|
|
95
|
+
if args.key?(:extra) && args[:extra].is_a?(Hash)
|
96
|
+
args[:extra].each do |key, value|
|
97
|
+
@data[key] = value.to_s
|
98
|
+
end
|
99
|
+
end
|
100
|
+
|
76
101
|
@android = args[:android] if args.key?(:android)
|
77
102
|
@apns = args[:apns] if args.key?(:apns)
|
78
103
|
@webpush = args[:webpush] if args.key?(:webpush)
|
104
|
+
@fcm_options = args[:fcm_options] if args.key?(:fcm_options)
|
79
105
|
end
|
80
106
|
end
|
81
107
|
|
@@ -34,6 +34,8 @@ module Google
|
|
34
34
|
# @private
|
35
35
|
class Representation < Google::Apis::Core::JsonRepresentation
|
36
36
|
property :topic, as: 'topic'
|
37
|
+
property :condition, as: 'condition'
|
38
|
+
property :token, as: 'token'
|
37
39
|
property :data, as: 'data'
|
38
40
|
property :notification, as: 'notification',
|
39
41
|
class: Google::Apis::Messages::Notification,
|
@@ -41,6 +43,7 @@ module Google
|
|
41
43
|
hash :android, as: 'android'
|
42
44
|
hash :apns, as: 'apns'
|
43
45
|
hash :webpush, as: 'webpush'
|
46
|
+
hash :fcm_options, as: 'fcm_options'
|
44
47
|
end
|
45
48
|
end
|
46
49
|
|
@@ -28,13 +28,15 @@ module Google
|
|
28
28
|
command.request_representation = Google::Apis::Messages::Message::Representation
|
29
29
|
command.request_object = message
|
30
30
|
|
31
|
-
if ENV['FIREBASE_DEBUG'].
|
31
|
+
if !ENV['FIREBASE_DEBUG'].nil?
|
32
32
|
log_json(command)
|
33
33
|
end
|
34
34
|
|
35
35
|
execute_or_queue_command(command, &block)
|
36
36
|
end
|
37
37
|
|
38
|
+
alias notify notify_topic
|
39
|
+
|
38
40
|
protected
|
39
41
|
|
40
42
|
def apply_command_defaults(command)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: google-api-fcm
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.9
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Krigouzov
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-04-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|
@@ -24,7 +24,7 @@ dependencies:
|
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '0.17'
|
27
|
-
description:
|
27
|
+
description:
|
28
28
|
email:
|
29
29
|
- webmaster@oniksfly.com
|
30
30
|
executables: []
|
@@ -39,7 +39,7 @@ homepage: https://github.com/oniksfly/google-api-fcm
|
|
39
39
|
licenses:
|
40
40
|
- Apache-2.0
|
41
41
|
metadata: {}
|
42
|
-
post_install_message:
|
42
|
+
post_install_message:
|
43
43
|
rdoc_options: []
|
44
44
|
require_paths:
|
45
45
|
- lib
|
@@ -54,9 +54,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
|
-
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
59
|
-
signing_key:
|
57
|
+
rubyforge_project:
|
58
|
+
rubygems_version: 2.7.6
|
59
|
+
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: Client for accessing Firebase Cloud Messaging APIs
|
62
62
|
test_files: []
|