notify_user 0.3.1 → 0.3.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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8d21b220862a946109126fd399260454de810107
|
4
|
+
data.tar.gz: 84d380d7553c60678ccaaf4846f71570c41d3d2c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 957169fda235cd41be58726384b17f9a03b4981c2611878daf07d09a346dad9d0b8bb57f7c3ed49664e79f1bdb4750f4e2fa76ed4b3dfcde9662888fd3f7e3c7
|
7
|
+
data.tar.gz: 0ec1c8ff6731c5c0769f1f5e372331728049e8be4c36130583bee81e86b6216b73ef43f7fa781ad9907c9e287de91bac02766fa7ff5c232e2fb5620c3712f450
|
data/README.md
CHANGED
@@ -53,17 +53,6 @@ wwtd
|
|
53
53
|
## APNS providers
|
54
54
|
By default, we use [Houston](https://github.com/nomad/houston/) to deliver push notifications via APNS from the server.
|
55
55
|
|
56
|
-
The initialiser for `notify_user` contains the following configuration when delivering via Houston:
|
57
|
-
```
|
58
|
-
# Number of connections Houston will maintain to APNS:
|
59
|
-
config.connection_pool_size = 3
|
60
|
-
|
61
|
-
# Time in seconds Houston will wait for a free connection before failing:
|
62
|
-
config.connection_pool_timeout = 300
|
63
|
-
```
|
64
|
-
|
65
|
-
We maintain persistent connections to APNS via background workers, and these values will allow you to configure how many connections the workers maintain, as well as the amount of time to wait for an idle connection before timing out.
|
66
|
-
|
67
56
|
You also need to provide exported versions of your push notification certificate and key as .pem files, these instructions come from the [APN on Rails](https://github.com/PRX/apn_on_rails) project on how to do that:
|
68
57
|
|
69
58
|
Once you have the certificate from Apple for your application, export your key
|
@@ -5,9 +5,8 @@ module NotifyUser
|
|
5
5
|
class Apns < Push
|
6
6
|
NO_ERROR = -42
|
7
7
|
INVALID_TOKEN_ERROR = 8
|
8
|
-
CONNECTION = APNConnection.new
|
9
8
|
|
10
|
-
attr_accessor :push_options
|
9
|
+
attr_accessor :push_options, :apn_connection
|
11
10
|
|
12
11
|
def initialize(notifications, devices, options)
|
13
12
|
super(notifications, devices, options)
|
@@ -17,7 +16,10 @@ module NotifyUser
|
|
17
16
|
end
|
18
17
|
|
19
18
|
def push
|
20
|
-
|
19
|
+
APNConnection::POOL.with do |apn_conn|
|
20
|
+
@apn_connection = apn_conn
|
21
|
+
send_notifications
|
22
|
+
end
|
21
23
|
end
|
22
24
|
|
23
25
|
private
|
@@ -25,11 +27,11 @@ module NotifyUser
|
|
25
27
|
attr_accessor :devices
|
26
28
|
|
27
29
|
def connection
|
28
|
-
|
30
|
+
apn_connection.connection
|
29
31
|
end
|
30
32
|
|
31
33
|
def reset_connection
|
32
|
-
|
34
|
+
apn_connection.reset
|
33
35
|
end
|
34
36
|
|
35
37
|
def setup_options
|
@@ -14,11 +14,4 @@ NotifyUser.setup do |config|
|
|
14
14
|
|
15
15
|
# Provider for APNS:
|
16
16
|
config.apns_provider = :houston
|
17
|
-
|
18
|
-
# Number of connections Houston will maintain to APNS:
|
19
|
-
config.connection_pool_size = 3
|
20
|
-
|
21
|
-
# Time in seconds Houston will wait for a free connection before failing:
|
22
|
-
config.connection_pool_timeout = 300
|
23
|
-
|
24
17
|
end
|
data/lib/notify_user.rb
CHANGED
@@ -20,14 +20,6 @@ module NotifyUser
|
|
20
20
|
mattr_accessor :apns_provider
|
21
21
|
@@apns_provider = nil
|
22
22
|
|
23
|
-
# Number of connections Houston will maintain to APNS:
|
24
|
-
mattr_accessor :connection_pool_size
|
25
|
-
@@connection_pool_size = nil
|
26
|
-
|
27
|
-
# Time in seconds Houston will wait for a free connection before failing:
|
28
|
-
mattr_accessor :connection_pool_timeout
|
29
|
-
@@connection_pool_timeout = nil
|
30
|
-
|
31
23
|
# Used to set up NotifyUser from the initializer.
|
32
24
|
def self.setup
|
33
25
|
yield self
|
data/lib/notify_user/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notify_user
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.3.
|
4
|
+
version: 0.3.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tom Spacek
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-11-
|
11
|
+
date: 2015-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rails
|