notifiable-apns-apnotic 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +6 -2
- data/lib/notifiable/apns/apnotic/async.rb +14 -11
- data/lib/notifiable/apns/apnotic/version.rb +1 -1
- data/notifiable-apns-apnotic.gemspec +2 -0
- metadata +30 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: bc122147628e88344ba5bc681034a679425ed27c
|
4
|
+
data.tar.gz: 07e2d79154c4ec9a6e44a26cad10ef8c0997cb50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a00372c8b589ac39e40ea44437a8fda5e2a1a32df9a2aa484728d56dd400359b5e8bb34aa145f74132488adf1ac96dbb44fc4f766c806674efe119082cad7a1
|
7
|
+
data.tar.gz: 3a3d60a5cd56809998fbe1b672405c732f0678cf29d833b44af1c1e72934a9ea1546b712beb7f135cca7dfd61292cf23f11e04f66b85b4499448c7cba88292c1
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
notifiable-apns-apnotic (0.2.
|
4
|
+
notifiable-apns-apnotic (0.2.1)
|
5
5
|
apnotic (~> 1.4.1)
|
6
6
|
notifiable-core (>= 0.1.3)
|
7
7
|
|
@@ -28,13 +28,15 @@ GEM
|
|
28
28
|
concurrent-ruby (1.0.5)
|
29
29
|
connection_pool (2.2.2)
|
30
30
|
diff-lcs (1.3)
|
31
|
+
factory_bot (4.11.0)
|
32
|
+
activesupport (>= 3.0.0)
|
31
33
|
http-2 (0.9.0)
|
32
34
|
i18n (1.1.0)
|
33
35
|
concurrent-ruby (~> 1.0)
|
34
36
|
minitest (5.11.3)
|
35
37
|
net-http2 (0.18.0)
|
36
38
|
http-2 (= 0.9.0)
|
37
|
-
notifiable-core (0.1.
|
39
|
+
notifiable-core (0.1.4)
|
38
40
|
activerecord
|
39
41
|
activerecord-import
|
40
42
|
pg (1.1.0)
|
@@ -61,10 +63,12 @@ PLATFORMS
|
|
61
63
|
|
62
64
|
DEPENDENCIES
|
63
65
|
bundler (~> 1.16)
|
66
|
+
factory_bot
|
64
67
|
notifiable-apns-apnotic!
|
65
68
|
pg
|
66
69
|
rake (~> 10.0)
|
67
70
|
rspec (~> 3.0)
|
71
|
+
rspec-mocks
|
68
72
|
|
69
73
|
BUNDLED WITH
|
70
74
|
1.16.4
|
@@ -18,9 +18,7 @@ module Notifiable
|
|
18
18
|
def enqueue(device, notification)
|
19
19
|
raise "certificate missing" if certificate.nil?
|
20
20
|
raise "bundle_id missing" if bundle_id.nil?
|
21
|
-
|
22
|
-
connection = ::Apnotic::Connection.new(cert_path: StringIO.new(certificate), cert_pass: passphrase, url: url)
|
23
|
-
|
21
|
+
|
24
22
|
apnotic_notification = build_notification(device, notification)
|
25
23
|
|
26
24
|
push = connection.prepare_push(apnotic_notification)
|
@@ -34,12 +32,6 @@ module Notifiable
|
|
34
32
|
end
|
35
33
|
|
36
34
|
connection.push_async(push)
|
37
|
-
|
38
|
-
# wait for all requests to be completed
|
39
|
-
connection.join
|
40
|
-
|
41
|
-
# close the connection
|
42
|
-
connection.close
|
43
35
|
end
|
44
36
|
|
45
37
|
|
@@ -48,9 +40,20 @@ module Notifiable
|
|
48
40
|
self.sandbox? ? ::Apnotic::APPLE_DEVELOPMENT_SERVER_URL : ::Apnotic::APPLE_PRODUCTION_SERVER_URL
|
49
41
|
end
|
50
42
|
|
51
|
-
|
43
|
+
def flush
|
44
|
+
@connection.join
|
45
|
+
end
|
52
46
|
|
53
|
-
|
47
|
+
def close
|
48
|
+
super.close
|
49
|
+
connection.close
|
50
|
+
@connection = nil
|
51
|
+
end
|
52
|
+
|
53
|
+
def connection
|
54
|
+
@connection ||= ::Apnotic::Connection.new(cert_path: StringIO.new(certificate), cert_pass: passphrase, url: url)
|
55
|
+
end
|
56
|
+
|
54
57
|
def build_notification(device, notification)
|
55
58
|
payload = ::Apnotic::Notification.new(device.token)
|
56
59
|
payload.alert = {}
|
@@ -26,6 +26,8 @@ Gem::Specification.new do |spec|
|
|
26
26
|
spec.add_development_dependency "bundler", "~> 1.16"
|
27
27
|
spec.add_development_dependency "rake", "~> 10.0"
|
28
28
|
spec.add_development_dependency "rspec", "~> 3.0"
|
29
|
+
spec.add_development_dependency "rspec-mocks"
|
29
30
|
spec.add_development_dependency "pg"
|
31
|
+
spec.add_development_dependency "factory_bot"
|
30
32
|
|
31
33
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifiable-apns-apnotic
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brooke-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-08-
|
11
|
+
date: 2018-08-27 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: notifiable-core
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '3.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec-mocks
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: pg
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -94,6 +108,20 @@ dependencies:
|
|
94
108
|
- - ">="
|
95
109
|
- !ruby/object:Gem::Version
|
96
110
|
version: '0'
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: factory_bot
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '0'
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: '0'
|
97
125
|
description:
|
98
126
|
email:
|
99
127
|
- matt@futureworkshops.com
|