grocer 0.0.9 → 0.0.10
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +38 -40
- data/lib/grocer/ssl_server.rb +1 -0
- data/lib/grocer/version.rb +1 -1
- data/spec/grocer/ssl_server_spec.rb +7 -0
- metadata +40 -15
data/README.md
CHANGED
@@ -127,6 +127,44 @@ end
|
|
127
127
|
from the Apple Push Notification Service before raising any errors to client
|
128
128
|
code.
|
129
129
|
|
130
|
+
## Acceptance Testing
|
131
|
+
|
132
|
+
Grocer ships with framework to setup a real looking APNS server. It listens on
|
133
|
+
a real SSL-capable socket bound to localhost.
|
134
|
+
|
135
|
+
You can setup an APNS client to talk to it, then inspect the notifications the
|
136
|
+
server received.
|
137
|
+
|
138
|
+
The server simply exposes a blocking queue where notifications are placed when
|
139
|
+
they are received. It is your responsibility to timeout if a message is not
|
140
|
+
received in a reasonable amount of time.
|
141
|
+
|
142
|
+
For example, in RSpec:
|
143
|
+
|
144
|
+
```ruby
|
145
|
+
require 'timeout'
|
146
|
+
|
147
|
+
describe "apple push notifications" do
|
148
|
+
before do
|
149
|
+
@server = Grocer.server(port: 2195)
|
150
|
+
@server.accept # starts listening in background
|
151
|
+
end
|
152
|
+
|
153
|
+
after do
|
154
|
+
@server.close
|
155
|
+
end
|
156
|
+
|
157
|
+
specify "As a user, I receive notifications on my phone when awesome things happen" do
|
158
|
+
# ... exercise code that would send APNS notifications ...
|
159
|
+
|
160
|
+
Timeout.timeout(3) {
|
161
|
+
notification = @server.notifications.pop # blocking
|
162
|
+
notification.alert.should == "An awesome thing happened"
|
163
|
+
}
|
164
|
+
end
|
165
|
+
end
|
166
|
+
```
|
167
|
+
|
130
168
|
### Device Token
|
131
169
|
|
132
170
|
A device token is obtained from within the iOS app. More details are in Apple's
|
@@ -176,43 +214,3 @@ openssl pkcs12 -in exported_certificate.p12 -out certificate.pem -nodes -clcerts
|
|
176
214
|
```
|
177
215
|
|
178
216
|
The `certificate.pem` file that is generated can be used with **grocer**.
|
179
|
-
|
180
|
-
## Acceptance Testing
|
181
|
-
|
182
|
-
** YET TO BE IMPLEMENTED **
|
183
|
-
|
184
|
-
Grocer ships with framework to setup a real looking APNS server. It listens on
|
185
|
-
a real SSL-capable socket bound to localhost.
|
186
|
-
|
187
|
-
You can setup an APNS client to talk to it, then inspect the notifications the
|
188
|
-
server received.
|
189
|
-
|
190
|
-
The server simply exposes a blocking queue where notifications are placed when
|
191
|
-
they are received. It is your responsibility to timeout if a message is not
|
192
|
-
received in a reasonable amount of time.
|
193
|
-
|
194
|
-
For example, in RSpec:
|
195
|
-
|
196
|
-
```ruby
|
197
|
-
require 'timeout'
|
198
|
-
|
199
|
-
describe "apple push notifications" do
|
200
|
-
before do
|
201
|
-
@server = Grocer.server(port: 2195)
|
202
|
-
@server.accept # starts listening in background
|
203
|
-
end
|
204
|
-
|
205
|
-
after do
|
206
|
-
@server.close
|
207
|
-
end
|
208
|
-
|
209
|
-
specify "As a user, I receive notifications on my phone when awesome things happen" do
|
210
|
-
# ... exercise code that would send APNS notifications ...
|
211
|
-
|
212
|
-
Timeout.timeout(3) {
|
213
|
-
notification = @server.notifications.pop # blocking
|
214
|
-
notification.alert.should == "An awesome thing happened"
|
215
|
-
}
|
216
|
-
end
|
217
|
-
end
|
218
|
-
```
|
data/lib/grocer/ssl_server.rb
CHANGED
data/lib/grocer/version.rb
CHANGED
@@ -30,6 +30,13 @@ describe Grocer::SSLServer do
|
|
30
30
|
end
|
31
31
|
|
32
32
|
describe "#close" do
|
33
|
+
it "shutdowns the SSL socket" do
|
34
|
+
mock_ssl_server.expects(:shutdown)
|
35
|
+
|
36
|
+
subject.accept # "open" socket
|
37
|
+
subject.close
|
38
|
+
end
|
39
|
+
|
33
40
|
it "closes the SSL socket" do
|
34
41
|
mock_ssl_server.expects(:close)
|
35
42
|
|
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.10
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -11,11 +11,11 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: bin
|
13
13
|
cert_chain: []
|
14
|
-
date: 2012-
|
14
|
+
date: 2012-06-12 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: rspec
|
18
|
-
requirement:
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
19
|
none: false
|
20
20
|
requirements:
|
21
21
|
- - ~>
|
@@ -23,10 +23,15 @@ dependencies:
|
|
23
23
|
version: 2.10.0
|
24
24
|
type: :development
|
25
25
|
prerelease: false
|
26
|
-
version_requirements:
|
26
|
+
version_requirements: !ruby/object:Gem::Requirement
|
27
|
+
none: false
|
28
|
+
requirements:
|
29
|
+
- - ~>
|
30
|
+
- !ruby/object:Gem::Version
|
31
|
+
version: 2.10.0
|
27
32
|
- !ruby/object:Gem::Dependency
|
28
33
|
name: pry
|
29
|
-
requirement:
|
34
|
+
requirement: !ruby/object:Gem::Requirement
|
30
35
|
none: false
|
31
36
|
requirements:
|
32
37
|
- - ~>
|
@@ -34,10 +39,15 @@ dependencies:
|
|
34
39
|
version: 0.9.8
|
35
40
|
type: :development
|
36
41
|
prerelease: false
|
37
|
-
version_requirements:
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
none: false
|
44
|
+
requirements:
|
45
|
+
- - ~>
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 0.9.8
|
38
48
|
- !ruby/object:Gem::Dependency
|
39
49
|
name: mocha
|
40
|
-
requirement:
|
50
|
+
requirement: !ruby/object:Gem::Requirement
|
41
51
|
none: false
|
42
52
|
requirements:
|
43
53
|
- - ! '>='
|
@@ -45,10 +55,15 @@ dependencies:
|
|
45
55
|
version: '0'
|
46
56
|
type: :development
|
47
57
|
prerelease: false
|
48
|
-
version_requirements:
|
58
|
+
version_requirements: !ruby/object:Gem::Requirement
|
59
|
+
none: false
|
60
|
+
requirements:
|
61
|
+
- - ! '>='
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '0'
|
49
64
|
- !ruby/object:Gem::Dependency
|
50
65
|
name: bourne
|
51
|
-
requirement:
|
66
|
+
requirement: !ruby/object:Gem::Requirement
|
52
67
|
none: false
|
53
68
|
requirements:
|
54
69
|
- - ! '>='
|
@@ -56,10 +71,15 @@ dependencies:
|
|
56
71
|
version: '0'
|
57
72
|
type: :development
|
58
73
|
prerelease: false
|
59
|
-
version_requirements:
|
74
|
+
version_requirements: !ruby/object:Gem::Requirement
|
75
|
+
none: false
|
76
|
+
requirements:
|
77
|
+
- - ! '>='
|
78
|
+
- !ruby/object:Gem::Version
|
79
|
+
version: '0'
|
60
80
|
- !ruby/object:Gem::Dependency
|
61
81
|
name: rake
|
62
|
-
requirement:
|
82
|
+
requirement: !ruby/object:Gem::Requirement
|
63
83
|
none: false
|
64
84
|
requirements:
|
65
85
|
- - ! '>='
|
@@ -67,7 +87,12 @@ dependencies:
|
|
67
87
|
version: '0'
|
68
88
|
type: :development
|
69
89
|
prerelease: false
|
70
|
-
version_requirements:
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
none: false
|
92
|
+
requirements:
|
93
|
+
- - ! '>='
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: '0'
|
71
96
|
description: ! " Grocer interfaces with the Apple Push\n
|
72
97
|
\ Notification Service to send push\n notifications
|
73
98
|
to iOS devices and collect\n notification feedback via
|
@@ -140,7 +165,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
140
165
|
version: '0'
|
141
166
|
segments:
|
142
167
|
- 0
|
143
|
-
hash:
|
168
|
+
hash: -3763223415178507043
|
144
169
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
145
170
|
none: false
|
146
171
|
requirements:
|
@@ -149,10 +174,10 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
149
174
|
version: '0'
|
150
175
|
segments:
|
151
176
|
- 0
|
152
|
-
hash:
|
177
|
+
hash: -3763223415178507043
|
153
178
|
requirements: []
|
154
179
|
rubyforge_project:
|
155
|
-
rubygems_version: 1.8.
|
180
|
+
rubygems_version: 1.8.24
|
156
181
|
signing_key:
|
157
182
|
specification_version: 3
|
158
183
|
summary: Pushing Apple notifications since 2012.
|