apns_simple 1.0.1 → 1.1.0

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
  SHA1:
3
- metadata.gz: 8ab64c50e081ffa4e0d9233da507a24c82d7fcd8
4
- data.tar.gz: 4984dc7e23541b24026df63d0a4b53991d4637c4
3
+ metadata.gz: 51268e8fa7d8d4eef9af6e2dfa9d7c8403cb1518
4
+ data.tar.gz: dcd4161167952f0638ab5c6125968f94a6d78145
5
5
  SHA512:
6
- metadata.gz: 4a2ab7af1d60ac62b169bced7b57f9d2bb22e4ab5cae64c0d410fb5ea8dd655187094f0b88570ed57a015e828d7528f4d1e3a1b3ea43b6269d646a3b9b1ee4fa
7
- data.tar.gz: b03c19f8c22807ab5209b89cbbfd5c224dddd1e5e59ac2f34d41b82ada91d5b7a6f139090cc91cc1bfb7c11a840852e9b213a85c5162ec0c0a87a038299395cd
6
+ metadata.gz: 7efb6608223756f87afc446e36e58c9070dea16113e730eb6e52ba839d4fd98d0785219dfca2840066def30ef76471ee51269f0ce410444c43f0dc99ce5bf1a9
7
+ data.tar.gz: afe120a7462aac8ec1a2c69cb90038111ff27d755b5ad486977ba9d487a0e47d07493fe2f7bcc3fac1f7cea49f02f80f7384d53118564000c149b47f210e64af
@@ -46,38 +46,36 @@ module ApnsSimple
46
46
  end
47
47
 
48
48
  def push(notification)
49
- begin
50
- notification.error = true
51
- sock = TCPSocket.new(host, port)
52
- ssl = OpenSSL::SSL::SSLSocket.new(sock, ssl_context)
53
- ssl.sync = true
54
- ssl.connect
55
- ssl.write(notification.payload)
49
+ notification.error = true
50
+ sock = TCPSocket.new(host, port)
51
+ ssl = OpenSSL::SSL::SSLSocket.new(sock, ssl_context)
52
+ ssl.connect
53
+ ssl.write(notification.payload)
54
+ ssl.flush
56
55
 
57
- ready = IO.select([ssl], [], [], TIMEOUT)
56
+ ready = IO.select([ssl], [], [], TIMEOUT)
58
57
 
59
- unless ready
60
- notification.error_message = "No response from APNS server received in #{TIMEOUT} seconds. Exit by timeout."
61
- return
62
- end
58
+ unless ready
59
+ notification.error_message = "No response from APNS server received in #{TIMEOUT} seconds. Exit by timeout."
60
+ return
61
+ end
63
62
 
64
- readable_ssl_socket = ready.first.first
63
+ readable_ssl_socket = ready.first.first
65
64
 
66
- if (error = readable_ssl_socket.read(ERROR_BYTES_COUNT))
67
- command, code, _index = error.unpack('ccN')
68
- if command == COMMAND
69
- notification.error_code = code
70
- notification.error_message = "CODE: #{code}, DESCRIPTION: #{CODES[code]}"
71
- else
72
- notification.error_message = "Unknown command received from APNS server: #{command}"
73
- end
65
+ if (error = readable_ssl_socket.read(ERROR_BYTES_COUNT))
66
+ command, code, _index = error.unpack('ccN')
67
+ if command == COMMAND
68
+ notification.error_code = code
69
+ notification.error_message = "CODE: #{code}, DESCRIPTION: #{CODES[code]}"
74
70
  else
75
- notification.error = false
71
+ notification.error_message = "Unknown command received from APNS server: #{command}"
76
72
  end
77
- ensure
78
- ssl.close if ssl
79
- sock.close if sock
73
+ else
74
+ notification.error = false
80
75
  end
76
+ ensure
77
+ ssl.close if ssl
78
+ sock.close if sock
81
79
  end
82
80
 
83
81
  private
@@ -1,3 +1,3 @@
1
1
  module ApnsSimple
2
- VERSION = '1.0.1'
2
+ VERSION = '1.1.0'
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apns_simple
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.1
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrey Voronkov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-11-30 00:00:00.000000000 Z
11
+ date: 2015-12-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler