snm-fcm 0.1.2 → 0.1.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/snm/fcm/version.rb +1 -1
- data/lib/snm/fcm.rb +5 -4
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d84858414150e1f38a1feb48aaa131fc59d282b26669830adadbec5fc89493e9
|
4
|
+
data.tar.gz: 957bdb675a7540a9a38fc036186edf73e6c1ce0885e7c712c490adf35c783c2e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8facdd1a526d7da68a514bf912ef2cf908c9b53cc58a8bfe6fa2d00c77adf780562ff4541fc1b6ede76904a00c66a302fb583125c9b7f2809c0aab5714ebaae
|
7
|
+
data.tar.gz: a8685c4b424486b78aa754c19bf57089cbac98650f4791ddde635060e1c81228ec635f387fa52db93f8029f85991bfea718efd9cd520024ad75c103ce3262318
|
data/lib/snm/fcm/version.rb
CHANGED
data/lib/snm/fcm.rb
CHANGED
@@ -18,13 +18,14 @@ module Snm
|
|
18
18
|
@configuration ||= Configuration.new
|
19
19
|
end
|
20
20
|
|
21
|
-
def self.
|
22
|
-
|
21
|
+
def self.setup(&block)
|
22
|
+
yield(configuration)
|
23
23
|
end
|
24
24
|
|
25
25
|
def self.deliver data={}
|
26
|
-
raise 'Data is missing' if
|
27
|
-
|
26
|
+
raise 'Data is missing' if data.nil?
|
27
|
+
|
28
|
+
HTTP.headers("Content-Type"=> "application/json", "Authorization"=> "Bearer #{get_access_token}").post("https://fcm.googleapis.com/v1/projects/#{Notification.configuration.project_id}/messages:send", json: data)
|
28
29
|
end
|
29
30
|
|
30
31
|
def self.get_access_token
|