gilgamesh 0.0.6 → 0.0.8
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 +4 -4
- data/lib/gilgamesh.rb +6 -6
- data/lib/gilgamesh/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 51a4b5e7a6534b963ca1bfa27250c198a9d0fc01
|
4
|
+
data.tar.gz: 1048c2c8c825192d947d6dc55a02f3353ead3e91
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 18ef8c26276406fd9c8860d4c59618af561ad2b7f3c6f63c71601b84d2774abbb4b2ebd2da5860b79bde4cd7ad3b9810ec9509aabe4817b451327e66616e70d3
|
7
|
+
data.tar.gz: 12fe0a64e5076dd8cdea1f1b5f6c07f77d6f14cd4591dcc21b479bdc78582bdf430a4e4e07b4b8fe2d4bb52cbec793f35878e334041c83a0d55c7541562c05eb
|
data/lib/gilgamesh.rb
CHANGED
@@ -3,12 +3,13 @@ require "faraday"
|
|
3
3
|
require "json"
|
4
4
|
|
5
5
|
class Gilgamesh
|
6
|
-
attr :api_key, :conn, :api_url
|
6
|
+
attr :api_key, :conn, :api_url, :default_icon
|
7
7
|
attr_reader :response
|
8
8
|
|
9
|
-
def initialize(api_key, api_url: "http://gcm-http.googleapis.com/gcm/send")
|
9
|
+
def initialize(api_key, default_icon:, api_url: "http://gcm-http.googleapis.com/gcm/send")
|
10
10
|
@api_key = api_key
|
11
11
|
@api_url = api_url
|
12
|
+
@default_icon = default_icon
|
12
13
|
end
|
13
14
|
|
14
15
|
def conn
|
@@ -17,16 +18,16 @@ class Gilgamesh
|
|
17
18
|
end
|
18
19
|
end
|
19
20
|
|
20
|
-
def push(registration_token, title:, body:)
|
21
|
+
def push(registration_token, title:, body:, click_action: nil, icon: nil)
|
21
22
|
body = {
|
22
23
|
to: registration_token,
|
23
24
|
notification: {
|
24
25
|
title: title,
|
25
26
|
body: body,
|
26
|
-
icon:
|
27
|
-
click_action: 'com.welbe.OPEN_MAIN_ACTIVITY'
|
27
|
+
icon: icon || default_icon
|
28
28
|
}
|
29
29
|
}
|
30
|
+
body[:notification].merge!(click_action: click_action) unless click_action.nil?
|
30
31
|
|
31
32
|
@response = conn.post do |req|
|
32
33
|
req.headers['Authorization'] = "key=#{api_key}"
|
@@ -43,5 +44,4 @@ class Gilgamesh
|
|
43
44
|
"Unauthorized: API key is not valid"
|
44
45
|
end
|
45
46
|
end
|
46
|
-
|
47
47
|
end
|
data/lib/gilgamesh/version.rb
CHANGED