google-api-fcm 0.0.1 → 0.1.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: 76a314583edbd705b27869dc5b6439e79317075d
4
- data.tar.gz: ff8a6b107f3c603353f0b8722f0a1a8303446211
3
+ metadata.gz: 2b18c9a80aa74c0d84ef9122db088c44376997f8
4
+ data.tar.gz: 928de98bc4e05954c0f8f677a6565e90dc13a07a
5
5
  SHA512:
6
- metadata.gz: '02958cf1e129570176d2159bc7cbf8bdd74927bfdf8b9974362e0fc0b3432fb0fbfce5a6f194f9d5120e3ae7cc5a53d5a3e073ded5bd2c52bf9f1e956f8b7c44'
7
- data.tar.gz: 015ac774df70696bb6b5884eecd2a8a1f6c9bd3817848aac045fba496f373bbb98961b5121b0f87c8d89f20933b122afcd8f09589ae5216ee87a5fd4fba4a149
6
+ metadata.gz: daebfd873171266fefdddfae7f6f8fccae129f3cc90ae8543c2dddb464235010df6e5fce305e9ff87e4d619a01d989fb2dfbc5a7399d9e49f781fc822aa61e6f
7
+ data.tar.gz: 465dee724fb85f6b6d4a4f62ecbd30953b27385ffd7a0e24b28ec042457d3854b93480c74cde0e0a052224abe74f3ad9bfc21c8a528a3fe0cf8ee0deebe119bd
@@ -18,9 +18,9 @@ module Google
18
18
 
19
19
  end
20
20
 
21
- def initialize_build(topic:, title:, body:)
21
+ def initialize_build(topic:, title:, body:, payload: nil)
22
22
  notification = Notification.new(title: title, body: body)
23
- @message_object = MessageObject.new(topic: topic, notification: notification)
23
+ @message_object = MessageObject.new(topic: topic, notification: notification, data: payload)
24
24
  end
25
25
 
26
26
  def update!(**args)
@@ -33,6 +33,7 @@ module Google
33
33
 
34
34
  attr_accessor :topic
35
35
  attr_accessor :notification
36
+ attr_accessor :data
36
37
 
37
38
  def initialize(**args)
38
39
  update!(**args)
@@ -42,6 +43,14 @@ module Google
42
43
  def update!(**args)
43
44
  @topic = args[:topic] if args.key?(:topic)
44
45
  @notification = args[:notification] if args.key?(:notification)
46
+ 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
53
+ end
45
54
  end
46
55
  end
47
56
 
@@ -63,4 +72,4 @@ module Google
63
72
  end
64
73
  end
65
74
  end
66
- end
75
+ end
@@ -30,6 +30,7 @@ module Google
30
30
  class Representation < Google::Apis::Core::JsonRepresentation
31
31
  property :topic, as: 'topic'
32
32
  property :notification, as: 'notification', class: Google::Apis::Messages::Notification, decorator: Google::Apis::Messages::Notification::Representation
33
+ property :data, as: 'data'
33
34
  end
34
35
  end
35
36
 
@@ -41,4 +42,4 @@ module Google
41
42
  end
42
43
  end
43
44
  end
44
- end
45
+ 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.0.1
4
+ version: 0.1.0
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-03 00:00:00.000000000 Z
11
+ date: 2017-12-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: google-api-client