apns_kit 0.1.1 → 0.1.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/README.md +3 -2
- data/lib/apns_kit/certificate.rb +18 -3
- data/lib/apns_kit/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: 06a53dc343be985c42f8c89388a5015ed3411470
|
4
|
+
data.tar.gz: 065c3be767648a416ae5d93cc808a315499034bc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: afe8d12f62bfaed403c619a0317278e709548dbe09b5f4fbff569d40bc9d30a6da951fed400e89d1961399ac8df2c2c3c30e7f242d7cf5ce9b52ad17084e7e59
|
7
|
+
data.tar.gz: 58016e6f3089816a3a3b38776e6c11e8b244faf85930d90ba99b75d547ab945a32a22e933132b570e850aa8a3d888cb084dcaaab9754448ebde9a0f641ff48c8
|
data/README.md
CHANGED
@@ -8,7 +8,7 @@ A simple to use gem that interfaces with Apple's new HTTP/2 APNs Service
|
|
8
8
|
Add this line to your application's Gemfile:
|
9
9
|
|
10
10
|
```ruby
|
11
|
-
gem 'apns_kit', '~> 0.1.
|
11
|
+
gem 'apns_kit', '~> 0.1.1'
|
12
12
|
```
|
13
13
|
|
14
14
|
And then execute:
|
@@ -24,7 +24,8 @@ Or install it yourself as:
|
|
24
24
|
```ruby
|
25
25
|
require 'apns_kit'
|
26
26
|
|
27
|
-
certificate = ApnsKit::Certificate.
|
27
|
+
certificate = ApnsKit::Certificate.from_p12_file(File.read("path_to_cert.p12"), "password_or_nil")
|
28
|
+
certificate = ApnsKit::Certificate.from_pem_file(File.read("path_to_cert.pem"), "password_or_nil")
|
28
29
|
|
29
30
|
# create a production client (you can also call ApnsKit::Client.development with the same options)
|
30
31
|
# pool_size is the number of open connections defaults to 1 (advisable to keep the default value)
|
data/lib/apns_kit/certificate.rb
CHANGED
@@ -1,9 +1,24 @@
|
|
1
1
|
module ApnsKit
|
2
2
|
class Certificate
|
3
3
|
|
4
|
-
|
5
|
-
|
6
|
-
|
4
|
+
class << self
|
5
|
+
|
6
|
+
def from_p12_file(data, passphrase = nil)
|
7
|
+
p12 = OpenSSL::PKCS12.new(data, passphrase)
|
8
|
+
ApnsKit::Certificate.new(p12.key, p12.certificate)
|
9
|
+
end
|
10
|
+
|
11
|
+
def from_pem_file(data, passphrase = nil)
|
12
|
+
key = OpenSSL::PKey::RSA.new(data, passphrase)
|
13
|
+
certificate = OpenSSL::X509::Certificate.new(data)
|
14
|
+
ApnsKit::Certificate.new(key, certificate)
|
15
|
+
end
|
16
|
+
|
17
|
+
end
|
18
|
+
|
19
|
+
def initialize(key, certificate)
|
20
|
+
@key = key
|
21
|
+
@certificate = certificate
|
7
22
|
end
|
8
23
|
|
9
24
|
def ssl_context
|
data/lib/apns_kit/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apns_kit
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Chris Recalis
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-06-15 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http-2
|