grocer 0.6.0 → 0.6.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +2 -2
- data/CHANGELOG.md +5 -0
- data/Gemfile +0 -3
- data/README.md +11 -4
- data/grocer.gemspec +2 -2
- data/lib/grocer/notification_reader.rb +9 -1
- data/lib/grocer/version.rb +1 -1
- data/spec/grocer/server_spec.rb +13 -0
- metadata +8 -7
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 6e424c4a3e8c5ff0fdce9bb8f16fca576382e254
|
4
|
+
data.tar.gz: 8e99095c9208eb9e11378c32d68413d73cbf3869
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 7451c8895a50c7366f095f3484852f5144db26e0f8efb1aa881bd5b86247639278db9767d9ac182b55975db321255ee409a2fc05da2628b17c597e82e6b109cd
|
7
|
+
data.tar.gz: c156b71a10de32edd60e5cf224c240cf1d97637c441cd67f15ae316918bc23b59bdf049e42da914ea9fddbe2f6ac7c0b070215fd16ef10d51067b802c80d8f03
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
data/Gemfile
CHANGED
@@ -12,6 +12,3 @@ gemspec
|
|
12
12
|
# Code coverage
|
13
13
|
gem 'codeclimate-test-reporter', :group => :test, :require => nil
|
14
14
|
|
15
|
-
# Require Simplecov explicitly. Remove this explicit dependency when
|
16
|
-
# the following is fixed: https://github.com/colszowka/simplecov/issues/281
|
17
|
-
gem 'simplecov', '~> 0.7.1'
|
data/README.md
CHANGED
@@ -80,7 +80,7 @@ notification = Grocer::Notification.new(
|
|
80
80
|
content_available: true # optional; any truthy value will set 'content-available' to 1
|
81
81
|
)
|
82
82
|
|
83
|
-
pusher.push(notification)
|
83
|
+
pusher.push(notification) # return value is the number of bytes sent successfully
|
84
84
|
```
|
85
85
|
|
86
86
|
It is desirable to reuse the same connection to send multiple notifications, as
|
@@ -151,7 +151,6 @@ notification = Grocer::SafariNotification.new(
|
|
151
151
|
body: 'Hi', # required
|
152
152
|
action: 'Read', # optional; the label of the action button
|
153
153
|
url_args: ['arg1'] # required (array); values that are paired with the placeholders inside the urlFormatString.
|
154
|
-
# Apple's documention lists url-args as optional, but in testing it was found to be required
|
155
154
|
)
|
156
155
|
```
|
157
156
|
|
@@ -201,7 +200,8 @@ end
|
|
201
200
|
### Acceptance Testing
|
202
201
|
|
203
202
|
Grocer ships with framework to setup a real looking APNS server. It listens on
|
204
|
-
a real SSL-capable socket bound to localhost.
|
203
|
+
a real SSL-capable socket bound to localhost. See the [Connecting
|
204
|
+
Notes](#notes) above for details.
|
205
205
|
|
206
206
|
You can setup an APNS client to talk to it, then inspect the notifications the
|
207
207
|
server received.
|
@@ -284,9 +284,15 @@ Save the items as a `.p12` file. Open a terminal window and run the following
|
|
284
284
|
command:
|
285
285
|
|
286
286
|
```bash
|
287
|
-
openssl pkcs12 -in exported_certificate.p12 -out certificate.pem -nodes -clcerts
|
287
|
+
openssl pkcs12 -in exported_certificate.p12 -out certificate.pem -nodes -clcerts -des3
|
288
288
|
```
|
289
289
|
|
290
|
+
You will be prompted for two password. The first one is the password
|
291
|
+
that you used when you exported the private key and certificate from
|
292
|
+
Keychain Access. The second password will be used to encrypt and lock
|
293
|
+
the private key. This will be the passphrase used when configuring
|
294
|
+
**grocer** to connect to APNs.
|
295
|
+
|
290
296
|
The `certificate.pem` file that is generated can be used with **grocer**.
|
291
297
|
|
292
298
|
## Support Channels
|
@@ -296,3 +302,4 @@ Requests](https://github.com/grocer/grocer/pulls) are the primary venues for
|
|
296
302
|
communicating issues and discussing possible features. Several of us also
|
297
303
|
regularly hang out in the `#grocer` channel on Freenode; feel free to pop in
|
298
304
|
and ask questions there as well. Thanks! :heart:
|
305
|
+
|
data/grocer.gemspec
CHANGED
@@ -25,8 +25,8 @@ 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', '~> 3.
|
29
|
-
gem.add_development_dependency 'pry', '~> 0.
|
28
|
+
gem.add_development_dependency 'rspec', '~> 3.1'
|
29
|
+
gem.add_development_dependency 'pry', '~> 0.10.1'
|
30
30
|
gem.add_development_dependency 'mocha'
|
31
31
|
gem.add_development_dependency 'bourne'
|
32
32
|
gem.add_development_dependency 'rake'
|
@@ -17,6 +17,14 @@ module Grocer
|
|
17
17
|
|
18
18
|
private
|
19
19
|
|
20
|
+
def build_notification(payload)
|
21
|
+
if payload[:url_args]
|
22
|
+
Grocer::SafariNotification.new(payload)
|
23
|
+
else
|
24
|
+
Grocer::Notification.new(payload)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
20
28
|
def read_notification
|
21
29
|
@io.read(1) # version (not used for now)
|
22
30
|
|
@@ -35,7 +43,7 @@ module Grocer
|
|
35
43
|
|
36
44
|
payload[:custom] = payload_hash
|
37
45
|
|
38
|
-
|
46
|
+
build_notification(payload)
|
39
47
|
end
|
40
48
|
|
41
49
|
def sanitize_keys(hash)
|
data/lib/grocer/version.rb
CHANGED
data/spec/grocer/server_spec.rb
CHANGED
@@ -29,6 +29,19 @@ describe Grocer::Server do
|
|
29
29
|
}
|
30
30
|
end
|
31
31
|
|
32
|
+
it "accepts a client connection and reads safari notifications into a queue" do
|
33
|
+
n = Grocer::SafariNotification.new(title: "title", body: "body")
|
34
|
+
expect( n ).to be_valid
|
35
|
+
mock_client.write(n.to_bytes)
|
36
|
+
mock_client.rewind
|
37
|
+
|
38
|
+
subject.accept
|
39
|
+
Timeout.timeout(5) {
|
40
|
+
notification = subject.notifications.pop
|
41
|
+
expect(notification.alert).to eq({:title=>"title", :body=>"body"})
|
42
|
+
}
|
43
|
+
end
|
44
|
+
|
32
45
|
it "closes the socket" do
|
33
46
|
ssl_server.expects(:close).at_least(1)
|
34
47
|
|
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.6.
|
4
|
+
version: 0.6.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Andy Lindeman
|
@@ -10,7 +10,7 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2015-03-19 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: rspec
|
@@ -18,28 +18,28 @@ dependencies:
|
|
18
18
|
requirements:
|
19
19
|
- - "~>"
|
20
20
|
- !ruby/object:Gem::Version
|
21
|
-
version: 3.
|
21
|
+
version: '3.1'
|
22
22
|
type: :development
|
23
23
|
prerelease: false
|
24
24
|
version_requirements: !ruby/object:Gem::Requirement
|
25
25
|
requirements:
|
26
26
|
- - "~>"
|
27
27
|
- !ruby/object:Gem::Version
|
28
|
-
version: 3.
|
28
|
+
version: '3.1'
|
29
29
|
- !ruby/object:Gem::Dependency
|
30
30
|
name: pry
|
31
31
|
requirement: !ruby/object:Gem::Requirement
|
32
32
|
requirements:
|
33
33
|
- - "~>"
|
34
34
|
- !ruby/object:Gem::Version
|
35
|
-
version: 0.
|
35
|
+
version: 0.10.1
|
36
36
|
type: :development
|
37
37
|
prerelease: false
|
38
38
|
version_requirements: !ruby/object:Gem::Requirement
|
39
39
|
requirements:
|
40
40
|
- - "~>"
|
41
41
|
- !ruby/object:Gem::Version
|
42
|
-
version: 0.
|
42
|
+
version: 0.10.1
|
43
43
|
- !ruby/object:Gem::Dependency
|
44
44
|
name: mocha
|
45
45
|
requirement: !ruby/object:Gem::Requirement
|
@@ -175,7 +175,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
175
175
|
version: '0'
|
176
176
|
requirements: []
|
177
177
|
rubyforge_project:
|
178
|
-
rubygems_version: 2.4.
|
178
|
+
rubygems_version: 2.4.2
|
179
179
|
signing_key:
|
180
180
|
specification_version: 4
|
181
181
|
summary: Pushing Apple notifications since 2012.
|
@@ -204,3 +204,4 @@ test_files:
|
|
204
204
|
- spec/grocer_spec.rb
|
205
205
|
- spec/spec_helper.rb
|
206
206
|
- spec/support/notification_helpers.rb
|
207
|
+
has_rdoc:
|