notifiable-apns-apnotic 0.3.1 → 0.3.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0053d718817d4f1a1c809b812bde24d20d59af5de14c5be5d5b0236bc81b1398
4
- data.tar.gz: 3ac5f6e41c83c47d91b3d6c2641e1bb6460f523ec77da29c0299825e1d63560e
3
+ metadata.gz: e5fb0a493afb44c6ea1a369055cb892b23013b2f2cda940be1f4bb2358371d63
4
+ data.tar.gz: ff37f0058a0ba88ec7d25628f9a6935a918f5262d5523f1e2ae688063be4bfb0
5
5
  SHA512:
6
- metadata.gz: ef1c7eef6372cade56488679c1ab60c52a3851443d3e0dcc4873228b39923657d522dbba83727bf2c017c650cb0cec3b88155ce7cdd12dc0c8b03b184b18a0b8
7
- data.tar.gz: 76025cc8f05e563cb1700bad9960f811ed6564baa9ad54da3c278968484186b4723a1e8110edd43bec628cd014af84ef4c25e3933a2071033596563863a1b73b
6
+ metadata.gz: 57b186f9c355a675dff545469a498053ffe62fff7ca0ecfac3a8a8befc95f8f156d9bde6c05fbd67f6813919397f659c99db348a02747ce6680c13f88296db67
7
+ data.tar.gz: c5d428433a78ece29484256722a037361f8b0712ae1d8dccddbfb929e4f31975b5b2aaeac8550ca297bbc63fcb37e51b144cb8ddeb2e6fe874c846836c110e91
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- notifiable-apns-apnotic (0.3.1)
4
+ notifiable-apns-apnotic (0.3.2)
5
5
  apnotic (~> 1.4.1)
6
6
  grocer (~> 0.7.1)
7
7
  notifiable-core (>= 0.1.3)
@@ -15,7 +15,7 @@ GEM
15
15
  activemodel (= 5.2.1)
16
16
  activesupport (= 5.2.1)
17
17
  arel (>= 9.0)
18
- activerecord-import (0.25.0)
18
+ activerecord-import (0.26.0)
19
19
  activerecord (>= 3.2)
20
20
  activesupport (5.2.1)
21
21
  concurrent-ruby (~> 1.0, >= 1.0.2)
@@ -40,7 +40,7 @@ GEM
40
40
  minitest (5.11.3)
41
41
  net-http2 (0.18.0)
42
42
  http-2 (= 0.9.0)
43
- notifiable-core (0.2.0)
43
+ notifiable-core (0.2.3)
44
44
  activerecord
45
45
  activerecord-import
46
46
  pg (1.1.0)
@@ -21,15 +21,22 @@ module Notifiable
21
21
  raise "bundle_id missing" if bundle_id.nil?
22
22
 
23
23
  apnotic_notification = build_notification(device, notification)
24
-
25
- push = connection.prepare_push(apnotic_notification)
26
- push.on(:response) {|response| process_response(response, device) }
27
-
28
- connection.push_async(push)
24
+ apnotic_enqueue(apnotic_notification, device)
25
+
26
+ rescue SocketError => e
27
+ # create a new connection and retry
28
+ close_connection
29
+ apnotic_enqueue(apnotic_notification, device)
29
30
  end
30
31
 
31
32
 
32
33
  private
34
+ def apnotic_enqueue(apnotic_notification, device)
35
+ push = connection.prepare_push(apnotic_notification)
36
+ push.on(:response) {|response| process_response(response, device) }
37
+ connection.push_async(push)
38
+ end
39
+
33
40
  def url
34
41
  self.sandbox? ? ::Apnotic::APPLE_DEVELOPMENT_SERVER_URL : ::Apnotic::APPLE_PRODUCTION_SERVER_URL
35
42
  end
@@ -43,10 +50,14 @@ module Notifiable
43
50
  end
44
51
  end
45
52
 
46
- def flush
53
+ def close_connection
47
54
  connection.join
48
55
  connection.close
49
- @connection = nil
56
+ @connection = nil
57
+ end
58
+
59
+ def flush
60
+ close_connection
50
61
  process_feedback
51
62
  end
52
63
 
@@ -1,7 +1,7 @@
1
1
  module Notifiable
2
2
  module Apns
3
3
  module Apnotic
4
- VERSION = "0.3.1"
4
+ VERSION = "0.3.2"
5
5
  end
6
6
  end
7
7
  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.3.1
4
+ version: 0.3.2
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-09-30 00:00:00.000000000 Z
11
+ date: 2018-10-08 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: notifiable-core