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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2eca2c85bbb5fd1f118954f2f84268617eb448a8
4
- data.tar.gz: 4f3b323f129aa24d9e08b6728855b28d6cfd785f
3
+ metadata.gz: 06a53dc343be985c42f8c89388a5015ed3411470
4
+ data.tar.gz: 065c3be767648a416ae5d93cc808a315499034bc
5
5
  SHA512:
6
- metadata.gz: aeb77a312ffae634dd3d9999cade4c3965aa8319ff72cd4e4d0a63aa696128f0735d7da8064da602375deeb0a25a3b6dbc7f8fee182436d3d21cdf99c83c326a
7
- data.tar.gz: 8158857321754b9683a473ab2c591a41b475b928b4ed5c75796416cbc162b5caa4b4ad734ccbd897f7ba7bb890348e3da8e917a3bdc6631b101be959692f08a0
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.0'
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.new(File.read("path_to_certificate.pem"), "password_or_nil")
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)
@@ -1,9 +1,24 @@
1
1
  module ApnsKit
2
2
  class Certificate
3
3
 
4
- def initialize(cert_data, passphrase = nil)
5
- @key = OpenSSL::PKey::RSA.new(cert_data, passphrase)
6
- @certificate = OpenSSL::X509::Certificate.new(cert_data)
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
@@ -1,3 +1,3 @@
1
1
  module ApnsKit
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.2"
3
3
  end
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.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-04-22 00:00:00.000000000 Z
11
+ date: 2016-06-15 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http-2