grocer 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
- data/grocer.gemspec +1 -1
- data/lib/grocer/connection.rb +3 -3
- data/lib/grocer/feedback_connection.rb +6 -2
- data/lib/grocer/push_connection.rb +6 -2
- data/lib/grocer/server.rb +2 -1
- data/lib/grocer/version.rb +1 -1
- metadata +10 -4
data/grocer.gemspec
CHANGED
@@ -25,7 +25,7 @@ Gem::Specification.new do |gem|
|
|
25
25
|
gem.require_paths = ["lib"]
|
26
26
|
gem.version = Grocer::VERSION
|
27
27
|
|
28
|
-
gem.add_development_dependency 'rspec', '~> 2.10
|
28
|
+
gem.add_development_dependency 'rspec', '~> 2.10'
|
29
29
|
gem.add_development_dependency 'pry', '~> 0.9.8'
|
30
30
|
gem.add_development_dependency 'mocha'
|
31
31
|
gem.add_development_dependency 'bourne'
|
data/lib/grocer/connection.rb
CHANGED
@@ -9,9 +9,9 @@ module Grocer
|
|
9
9
|
|
10
10
|
def initialize(options = {})
|
11
11
|
@certificate = options.fetch(:certificate) { nil }
|
12
|
+
@passphrase = options.fetch(:passphrase) { nil }
|
12
13
|
@gateway = options.fetch(:gateway) { fail NoGatewayError }
|
13
14
|
@port = options.fetch(:port) { fail NoPortError }
|
14
|
-
@passphrase = options.fetch(:passphrase) { nil }
|
15
15
|
@retries = options.fetch(:retries) { 3 }
|
16
16
|
end
|
17
17
|
|
@@ -54,10 +54,10 @@ module Grocer
|
|
54
54
|
def with_connection
|
55
55
|
attempts = 1
|
56
56
|
begin
|
57
|
-
|
57
|
+
connect
|
58
58
|
yield
|
59
59
|
rescue StandardError, Errno::EPIPE
|
60
|
-
raise unless attempts <
|
60
|
+
raise unless attempts < retries
|
61
61
|
|
62
62
|
destroy_connection
|
63
63
|
attempts += 1
|
@@ -9,8 +9,7 @@ module Grocer
|
|
9
9
|
SANDBOX_GATEWAY = 'feedback.sandbox.push.apple.com'
|
10
10
|
|
11
11
|
def initialize(options)
|
12
|
-
options
|
13
|
-
options = defaults.merge(options.deep_symbolize_keys)
|
12
|
+
options = apply_defaults(options)
|
14
13
|
super(Connection.new(options))
|
15
14
|
end
|
16
15
|
|
@@ -27,5 +26,10 @@ module Grocer
|
|
27
26
|
Grocer.env == 'production' ? PRODUCTION_GATEWAY : SANDBOX_GATEWAY
|
28
27
|
end
|
29
28
|
|
29
|
+
def apply_defaults(options)
|
30
|
+
options.extend Extensions::DeepSymbolizeKeys
|
31
|
+
defaults.merge(options.deep_symbolize_keys)
|
32
|
+
end
|
33
|
+
|
30
34
|
end
|
31
35
|
end
|
@@ -10,8 +10,7 @@ module Grocer
|
|
10
10
|
SANDBOX_GATEWAY = 'gateway.sandbox.push.apple.com'
|
11
11
|
|
12
12
|
def initialize(options)
|
13
|
-
options
|
14
|
-
options = defaults.merge(options.deep_symbolize_keys)
|
13
|
+
options = apply_defaults(options)
|
15
14
|
super(Connection.new(options))
|
16
15
|
end
|
17
16
|
|
@@ -35,5 +34,10 @@ module Grocer
|
|
35
34
|
end
|
36
35
|
end
|
37
36
|
|
37
|
+
def apply_defaults(options)
|
38
|
+
options.extend Extensions::DeepSymbolizeKeys
|
39
|
+
defaults.merge(options.deep_symbolize_keys)
|
40
|
+
end
|
41
|
+
|
38
42
|
end
|
39
43
|
end
|
data/lib/grocer/server.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'thread'
|
2
|
+
require 'openssl'
|
2
3
|
require 'grocer/notification_reader'
|
3
4
|
require 'grocer/ssl_server'
|
4
5
|
|
@@ -22,7 +23,7 @@ module Grocer
|
|
22
23
|
Thread.new {
|
23
24
|
begin
|
24
25
|
NotificationReader.new(client).each(¬ifications.method(:push))
|
25
|
-
rescue Errno::EBADF, NoMethodError
|
26
|
+
rescue Errno::EBADF, NoMethodError, OpenSSL::OpenSSLError
|
26
27
|
# Expected when another thread closes the socket
|
27
28
|
end
|
28
29
|
}
|
data/lib/grocer/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: grocer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.12
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-06-
|
14
|
+
date: 2012-06-14 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
@@ -20,7 +20,7 @@ dependencies:
|
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
22
22
|
- !ruby/object:Gem::Version
|
23
|
-
version: 2.10
|
23
|
+
version: '2.10'
|
24
24
|
type: :development
|
25
25
|
prerelease: false
|
26
26
|
version_requirements: !ruby/object:Gem::Requirement
|
@@ -28,7 +28,7 @@ dependencies:
|
|
28
28
|
requirements:
|
29
29
|
- - ~>
|
30
30
|
- !ruby/object:Gem::Version
|
31
|
-
version: 2.10
|
31
|
+
version: '2.10'
|
32
32
|
- !ruby/object:Gem::Dependency
|
33
33
|
name: pry
|
34
34
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,12 +165,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
165
165
|
- - ! '>='
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
|
+
segments:
|
169
|
+
- 0
|
170
|
+
hash: 1066047643388989879
|
168
171
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
169
172
|
none: false
|
170
173
|
requirements:
|
171
174
|
- - ! '>='
|
172
175
|
- !ruby/object:Gem::Version
|
173
176
|
version: '0'
|
177
|
+
segments:
|
178
|
+
- 0
|
179
|
+
hash: 1066047643388989879
|
174
180
|
requirements: []
|
175
181
|
rubyforge_project:
|
176
182
|
rubygems_version: 1.8.24
|