webpush 0.2.1 → 0.2.2
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/.travis.yml +3 -0
- data/README.md +3 -0
- data/lib/webpush/request.rb +7 -2
- data/lib/webpush/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7e6ccc3dd4787eae13fbe2da57c74f0d9f9c5c46
|
4
|
+
data.tar.gz: 331ade4d71f9919f63984e1d2b746e73cda4d34a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e41e01d1e5018e304f53bcc3de50e2ad7c0e6906b9f46fad27248e98bf9e969f760a1f1b598721d3da303ca007b08debf01ed4f880f89035056dcaa4d86f999f
|
7
|
+
data.tar.gz: e48347fae1ea9fc2c14d13710b6ebe8344cc189189c135c1239110bc7d3404c20a791872687ee1f52c65299c8a53957c5de9bee52ef34f769a3bcad007a5f0db
|
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -2,6 +2,7 @@
|
|
2
2
|
|
3
3
|
[](https://codeclimate.com/github/zaru/webpush)
|
4
4
|
[](https://travis-ci.org/zaru/webpush)
|
5
|
+
[](https://badge.fury.io/rb/webpush)
|
5
6
|
|
6
7
|
This Gem will send the Web Push API. It supports the encryption necessary to payload.
|
7
8
|
|
@@ -39,6 +40,7 @@ Webpush.payload_send(
|
|
39
40
|
message: JSON.generate(message),
|
40
41
|
p256dh: "BO/aG9nYXNkZmFkc2ZmZHNmYWRzZmFl...",
|
41
42
|
auth: "aW1hcmthcmFpa3V6ZQ==",
|
43
|
+
ttl: 600, #optional, ttl in seconds, defaults to 2419200 (4 weeks)
|
42
44
|
api_key: "[GoogleDeveloper APIKEY]" # optional, not used in Firefox.
|
43
45
|
)
|
44
46
|
```
|
@@ -48,6 +50,7 @@ Webpush.payload_send(
|
|
48
50
|
```ruby
|
49
51
|
Webpush.payload_send(
|
50
52
|
endpoint: "https://android.googleapis.com/gcm/send/eah7hak....",
|
53
|
+
ttl: 600, #optional, ttl in seconds, defaults to 2419200 (4 weeks)
|
51
54
|
api_key: "[GoogleDeveloper APIKEY]" # optional, not used in Firefox.
|
52
55
|
)
|
53
56
|
```
|
data/lib/webpush/request.rb
CHANGED
@@ -10,7 +10,12 @@ module Webpush
|
|
10
10
|
uri = URI.parse(@endpoint)
|
11
11
|
http = Net::HTTP.new(uri.host, uri.port)
|
12
12
|
http.use_ssl = true
|
13
|
-
|
13
|
+
if @options[:cert_store]
|
14
|
+
http.cert_store = @options[:cert_store]
|
15
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_PEER
|
16
|
+
else
|
17
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
18
|
+
end
|
14
19
|
req = Net::HTTP::Post.new(uri.request_uri, headers)
|
15
20
|
req.body = body
|
16
21
|
http.request(req)
|
@@ -49,7 +54,7 @@ module Webpush
|
|
49
54
|
end
|
50
55
|
|
51
56
|
def api_key?
|
52
|
-
!(api_key.nil? || api_key.empty?)
|
57
|
+
!(api_key.nil? || api_key.empty?) && @endpoint =~ /\Ahttps:\/\/.+\.googleapis\.com/
|
53
58
|
end
|
54
59
|
|
55
60
|
def encrypted_payload?
|
data/lib/webpush/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: webpush
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- zaru@sakuraba
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: hkdf
|