gilgamesh 0.0.6 → 0.0.8

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: f102ba0f4fe36e9e4db482e25c07d92909eaea2d
4
- data.tar.gz: b3343f6129c254c53d7c5a52ba8cba9b8258c9a1
3
+ metadata.gz: 51a4b5e7a6534b963ca1bfa27250c198a9d0fc01
4
+ data.tar.gz: 1048c2c8c825192d947d6dc55a02f3353ead3e91
5
5
  SHA512:
6
- metadata.gz: 76cd78ecde315b982a6f82782df8178971ecbcea1988eaf69e3c474353987a48ec3dca702d38862fa573562ec3f568659582317622455ad83dc0101443fa88ba
7
- data.tar.gz: 727ba39b9bc5967883f7cbb0c609266fa38ed55bd510d319a2b81e8df7be75800be554aac77666786abc31e61ed9e7604343d3b2d775eaa471905ff7ef46c500
6
+ metadata.gz: 18ef8c26276406fd9c8860d4c59618af561ad2b7f3c6f63c71601b84d2774abbb4b2ebd2da5860b79bde4cd7ad3b9810ec9509aabe4817b451327e66616e70d3
7
+ data.tar.gz: 12fe0a64e5076dd8cdea1f1b5f6c07f77d6f14cd4591dcc21b479bdc78582bdf430a4e4e07b4b8fe2d4bb52cbec793f35878e334041c83a0d55c7541562c05eb
@@ -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: 'ic_launcher',
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
@@ -1,3 +1,3 @@
1
1
  class Gilgamesh
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.8"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gilgamesh
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.6
4
+ version: 0.0.8
5
5
  platform: ruby
6
6
  authors:
7
7
  - ecuageo