google-api-fcm 0.1.0 → 0.1.1
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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9c41545a43261ed60e68c85cffcc631e272acc40
|
4
|
+
data.tar.gz: 0a088f1d1ca1866c3277e56ce4603e4f7edc22ce
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f107b12f24ab8578cf31cc06e84d98839e54807d9e3dcead3033373d2bf6cf032c10ff98a19fd14e06bf097fd61851cef63e11ef82e5a34a9a218994fd862eea
|
7
|
+
data.tar.gz: 5127a792147c8336861365b1b3127737e6a7ebbd974ad0c87f8cd5bb3b7a3ca960b7d16827b5558a4bce949ac2858d284b94ca48cd9d0a11e15238849d32524e
|
@@ -1,30 +1,40 @@
|
|
1
1
|
module Google
|
2
2
|
module Apis
|
3
3
|
module Messages
|
4
|
-
|
5
4
|
class Message
|
6
5
|
include Google::Apis::Core::Hashable
|
7
6
|
|
8
7
|
attr_accessor :message_object
|
9
8
|
|
10
9
|
def initialize(**args)
|
11
|
-
|
10
|
+
update!(**args)
|
11
|
+
end
|
12
12
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
13
|
+
def initialize_build(**args)
|
14
|
+
notification = Notification.new(
|
15
|
+
title: args[:notification][:title],
|
16
|
+
body: args[:notification][:body]
|
17
|
+
)
|
18
18
|
|
19
|
-
|
19
|
+
message_object_args = {
|
20
|
+
topic: args[:topic],
|
21
|
+
notification: notification,
|
22
|
+
data: args[:payload]
|
23
|
+
}
|
24
|
+
|
25
|
+
if args.key?(:webpush) && args[:webpush][:icon]
|
26
|
+
message_object_args[:webpush] = Webpush.new(args[:webpush])
|
27
|
+
end
|
20
28
|
|
21
|
-
|
22
|
-
notification = Notification.new(title: title, body: body)
|
23
|
-
@message_object = MessageObject.new(topic: topic, notification: notification, data: payload)
|
29
|
+
@message_object = MessageObject.new(message_object_args)
|
24
30
|
end
|
25
31
|
|
26
32
|
def update!(**args)
|
27
|
-
|
33
|
+
if args.key?(:message_object)
|
34
|
+
@message_object = args[:message_object]
|
35
|
+
else
|
36
|
+
initialize_build(**args)
|
37
|
+
end
|
28
38
|
end
|
29
39
|
end
|
30
40
|
|
@@ -34,6 +44,7 @@ module Google
|
|
34
44
|
attr_accessor :topic
|
35
45
|
attr_accessor :notification
|
36
46
|
attr_accessor :data
|
47
|
+
attr_accessor :webpush
|
37
48
|
|
38
49
|
def initialize(**args)
|
39
50
|
update!(**args)
|
@@ -44,13 +55,9 @@ module Google
|
|
44
55
|
@topic = args[:topic] if args.key?(:topic)
|
45
56
|
@notification = args[:notification] if args.key?(:notification)
|
46
57
|
if args.key?(:data) && args[:data].is_a?(Hash)
|
47
|
-
data = {}
|
48
|
-
args[:data].each do |key, value|
|
49
|
-
data[key.to_s] = value.to_s
|
50
|
-
end
|
51
|
-
|
52
|
-
@data = data
|
58
|
+
@data = { 'payload' => JSON.dump(args[:data]) }
|
53
59
|
end
|
60
|
+
@webpush = args[:webpush] if args.key?(:webpush)
|
54
61
|
end
|
55
62
|
end
|
56
63
|
|
@@ -70,6 +77,36 @@ module Google
|
|
70
77
|
@body = args[:body] if args.key?(:body)
|
71
78
|
end
|
72
79
|
end
|
80
|
+
|
81
|
+
class Webpush
|
82
|
+
include Google::Apis::Core::Hashable
|
83
|
+
|
84
|
+
attr_accessor :headers
|
85
|
+
attr_accessor :notification
|
86
|
+
|
87
|
+
def initialize(**args)
|
88
|
+
update!(**args)
|
89
|
+
end
|
90
|
+
|
91
|
+
def update!(**args)
|
92
|
+
@headers = args[:headers] if args.key?(:headers)
|
93
|
+
@notification = WebNotification.new(icon: args[:icon])
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
97
|
+
class WebNotification
|
98
|
+
include Google::Apis::Core::Hashable
|
99
|
+
|
100
|
+
attr_accessor :icon
|
101
|
+
|
102
|
+
def initialize(**args)
|
103
|
+
update!(**args)
|
104
|
+
end
|
105
|
+
|
106
|
+
def update!(**args)
|
107
|
+
@icon = args[:icon] if args.key?(:icon)
|
108
|
+
end
|
109
|
+
end
|
73
110
|
end
|
74
111
|
end
|
75
112
|
end
|
@@ -16,12 +16,22 @@ module Google
|
|
16
16
|
include Google::Apis::Core::JsonObjectSupport
|
17
17
|
end
|
18
18
|
|
19
|
+
class Webpush
|
20
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
21
|
+
include Google::Apis::Core::JsonObjectSupport
|
22
|
+
end
|
19
23
|
|
24
|
+
class WebNotification
|
25
|
+
class Representation < Google::Apis::Core::JsonRepresentation; end
|
26
|
+
include Google::Apis::Core::JsonObjectSupport
|
27
|
+
end
|
20
28
|
|
21
29
|
class Message
|
22
30
|
# @private
|
23
31
|
class Representation < Google::Apis::Core::JsonRepresentation
|
24
|
-
property :message_object, as: 'message',
|
32
|
+
property :message_object, as: 'message',
|
33
|
+
class: Google::Apis::Messages::MessageObject,
|
34
|
+
decorator: Google::Apis::Messages::MessageObject::Representation
|
25
35
|
end
|
26
36
|
end
|
27
37
|
|
@@ -29,8 +39,13 @@ module Google
|
|
29
39
|
# @private
|
30
40
|
class Representation < Google::Apis::Core::JsonRepresentation
|
31
41
|
property :topic, as: 'topic'
|
32
|
-
property :notification, as: 'notification', class: Google::Apis::Messages::Notification, decorator: Google::Apis::Messages::Notification::Representation
|
33
42
|
property :data, as: 'data'
|
43
|
+
property :notification, as: 'notification',
|
44
|
+
class: Google::Apis::Messages::Notification,
|
45
|
+
decorator: Google::Apis::Messages::Notification::Representation
|
46
|
+
property :webpush, as: 'webpush',
|
47
|
+
class: Google::Apis::Messages::Webpush,
|
48
|
+
decorator: Google::Apis::Messages::Webpush::Representation
|
34
49
|
end
|
35
50
|
end
|
36
51
|
|
@@ -40,6 +55,21 @@ module Google
|
|
40
55
|
property :body, as: 'body'
|
41
56
|
end
|
42
57
|
end
|
58
|
+
|
59
|
+
class Webpush
|
60
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
61
|
+
property :headers, as: 'headers'
|
62
|
+
property :notification, as: 'notification',
|
63
|
+
class: Google::Apis::Messages::WebNotification,
|
64
|
+
decorator: Google::Apis::Messages::WebNotification::Representation
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
class WebNotification
|
69
|
+
class Representation < Google::Apis::Core::JsonRepresentation
|
70
|
+
property :icon, as: 'icon'
|
71
|
+
end
|
72
|
+
end
|
43
73
|
end
|
44
74
|
end
|
45
75
|
end
|
@@ -27,8 +27,6 @@ module Google
|
|
27
27
|
command = make_simple_command(:post, 'messages:send', options)
|
28
28
|
command.request_representation = Google::Apis::Messages::Message::Representation
|
29
29
|
command.request_object = message
|
30
|
-
command.response_representation = Google::Apis::Messages::Message::Representation
|
31
|
-
command.response_class = Google::Apis::Messages::Message
|
32
30
|
|
33
31
|
execute_or_queue_command(command, &block)
|
34
32
|
end
|
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.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ilya Krigouzov
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-12-
|
11
|
+
date: 2017-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: google-api-client
|
@@ -45,7 +45,7 @@ require_paths:
|
|
45
45
|
- lib
|
46
46
|
required_ruby_version: !ruby/object:Gem::Requirement
|
47
47
|
requirements:
|
48
|
-
- - "
|
48
|
+
- - ">="
|
49
49
|
- !ruby/object:Gem::Version
|
50
50
|
version: '2.0'
|
51
51
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
@@ -55,7 +55,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
55
|
version: '0'
|
56
56
|
requirements: []
|
57
57
|
rubyforge_project:
|
58
|
-
rubygems_version: 2.
|
58
|
+
rubygems_version: 2.5.2
|
59
59
|
signing_key:
|
60
60
|
specification_version: 4
|
61
61
|
summary: Client for accessing Firebase Cloud Messaging APIs
|