apnotic 1.3.1 → 1.4.0
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 +12 -4
- data/apnotic.gemspec +1 -1
- data/lib/apnotic/connection.rb +1 -1
- data/lib/apnotic/connection_pool.rb +6 -2
- data/lib/apnotic/version.rb +1 -1
- metadata +5 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 52c487725927cc9b79c090d0634bce9dd0e96c36
|
4
|
+
data.tar.gz: e648e0c236840ad9225390158e6ee4e29e2ea21e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 621e9091d1d87837d1d19c9570d42428f9c455d6e73e17276700bbb37f5d7945da120e4c85c4014876ddeb4aee98b74fbf31985f6c8bd0662e1515c0bcc0d7eb
|
7
|
+
data.tar.gz: 65ee144d6642318eb65cac3d1b0424f93f468e22d586ba855e474853d959ff8365dbd60ba8787f5dfe3fe72176150be4b2d99e3c6bac1981e181d381b37cc5d9
|
data/README.md
CHANGED
@@ -166,7 +166,9 @@ class MyWorker
|
|
166
166
|
APNOTIC_POOL = Apnotic::ConnectionPool.new({
|
167
167
|
cert_path: Rails.root.join("config", "certs", "apns_certificate.pem"),
|
168
168
|
cert_pass: "mypass"
|
169
|
-
}, size: 5)
|
169
|
+
}, size: 5) do |connection|
|
170
|
+
connection.on(:error) { |exception| puts "Exception has been raised: #{exception}" }
|
171
|
+
end
|
170
172
|
|
171
173
|
def perform(token)
|
172
174
|
APNOTIC_POOL.with do |connection|
|
@@ -265,7 +267,9 @@ connection.on(:error) { |exception| puts "Exception has been raised: #{exception
|
|
265
267
|
For your convenience, a wrapper around the [Connection Pool](https://github.com/mperham/connection_pool) gem is here for you. To create a new connection pool:
|
266
268
|
|
267
269
|
```ruby
|
268
|
-
Apnotic::ConnectionPool.new(connection_options, connection_pool_options)
|
270
|
+
Apnotic::ConnectionPool.new(connection_options, connection_pool_options) do |connection|
|
271
|
+
connection.on(:error) { |exception| puts "Exception has been raised: #{exception}" }
|
272
|
+
end
|
269
273
|
```
|
270
274
|
|
271
275
|
For example:
|
@@ -273,13 +277,17 @@ For example:
|
|
273
277
|
```ruby
|
274
278
|
APNOTIC_POOL = Apnotic::ConnectionPool.new({
|
275
279
|
cert_path: "apns_certificate.pem"
|
276
|
-
}, size: 5)
|
280
|
+
}, size: 5) do |connection|
|
281
|
+
connection.on(:error) { |exception| puts "Exception has been raised: #{exception}" }
|
282
|
+
end
|
277
283
|
```
|
278
284
|
|
279
285
|
It is also possible to create a connection pool that points to the Apple Development servers by calling instead:
|
280
286
|
|
281
287
|
```ruby
|
282
|
-
Apnotic::ConnectionPool.development(connection_options, connection_pool_options)
|
288
|
+
Apnotic::ConnectionPool.development(connection_options, connection_pool_options) do |connection|
|
289
|
+
connection.on(:error) { |exception| puts "Exception has been raised: #{exception}" }
|
290
|
+
end
|
283
291
|
```
|
284
292
|
|
285
293
|
|
data/apnotic.gemspec
CHANGED
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "net-http2", ">= 0.
|
21
|
+
spec.add_dependency "net-http2", ">= 0.18", "< 2"
|
22
22
|
spec.add_dependency "connection_pool", "~> 2.0"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
data/lib/apnotic/connection.rb
CHANGED
@@ -3,7 +3,7 @@ require 'openssl'
|
|
3
3
|
|
4
4
|
module Apnotic
|
5
5
|
|
6
|
-
APPLE_DEVELOPMENT_SERVER_URL = "https://api.
|
6
|
+
APPLE_DEVELOPMENT_SERVER_URL = "https://api.sandbox.push.apple.com:443"
|
7
7
|
APPLE_PRODUCTION_SERVER_URL = "https://api.push.apple.com:443"
|
8
8
|
|
9
9
|
class Connection
|
@@ -7,13 +7,17 @@ module Apnotic
|
|
7
7
|
class << self
|
8
8
|
def new(options={}, pool_options={})
|
9
9
|
::ConnectionPool.new(pool_options) do
|
10
|
-
Apnotic::Connection.new(options)
|
10
|
+
connection = Apnotic::Connection.new(options)
|
11
|
+
yield(connection)
|
12
|
+
connection
|
11
13
|
end
|
12
14
|
end
|
13
15
|
|
14
16
|
def development(options={}, pool_options={})
|
15
17
|
::ConnectionPool.new(pool_options) do
|
16
|
-
Apnotic::Connection.development(options)
|
18
|
+
connection = Apnotic::Connection.development(options)
|
19
|
+
yield(connection)
|
20
|
+
connection
|
17
21
|
end
|
18
22
|
end
|
19
23
|
end
|
data/lib/apnotic/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apnotic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Roberto Ostinelli
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-07-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: net-http2
|
@@ -16,7 +16,7 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: '0.
|
19
|
+
version: '0.18'
|
20
20
|
- - "<"
|
21
21
|
- !ruby/object:Gem::Version
|
22
22
|
version: '2'
|
@@ -26,7 +26,7 @@ dependencies:
|
|
26
26
|
requirements:
|
27
27
|
- - ">="
|
28
28
|
- !ruby/object:Gem::Version
|
29
|
-
version: '0.
|
29
|
+
version: '0.18'
|
30
30
|
- - "<"
|
31
31
|
- !ruby/object:Gem::Version
|
32
32
|
version: '2'
|
@@ -137,7 +137,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
137
137
|
version: '0'
|
138
138
|
requirements: []
|
139
139
|
rubyforge_project:
|
140
|
-
rubygems_version: 2.
|
140
|
+
rubygems_version: 2.6.14
|
141
141
|
signing_key:
|
142
142
|
specification_version: 4
|
143
143
|
summary: Apnotic is an Apple Push Notification gem able to provide instant feedback.
|