grocer 0.6.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 907e31ec8991cc7e09d08d4eebf0a3e59e46df03
4
- data.tar.gz: 7615fdc0dd345d9714cdb036f3feaafa94ae1d35
3
+ metadata.gz: 6e424c4a3e8c5ff0fdce9bb8f16fca576382e254
4
+ data.tar.gz: 8e99095c9208eb9e11378c32d68413d73cbf3869
5
5
  SHA512:
6
- metadata.gz: 799ca81894f2c703eb4997fe6d9ffaaaa41a5c3ff1105a90d27c2acb0b01f6104ecedf2730a8db0de6fed5cccc4f2e752f58e329f0cc196336be9a451249c501
7
- data.tar.gz: fa7b760b7c12fc8992c7c2ebf6b1695403466a8128242b86ce0df365ef16ec79825c816fe2426dead79dbe51ab1d610f53f7ad10dc1f8bc7400336397c568418
6
+ metadata.gz: 7451c8895a50c7366f095f3484852f5144db26e0f8efb1aa881bd5b86247639278db9767d9ac182b55975db321255ee409a2fc05da2628b17c597e82e6b109cd
7
+ data.tar.gz: c156b71a10de32edd60e5cf224c240cf1d97637c441cd67f15ae316918bc23b59bdf049e42da914ea9fddbe2f6ac7c0b070215fd16ef10d51067b802c80d8f03
@@ -1,13 +1,13 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.1.1
4
- - 2.1.0
3
+ - 2.1.4
5
4
  - 2.0.0
6
5
  - 1.9.3
7
6
  - 1.9.2
8
7
  - jruby-19mode
9
8
  - rbx
10
9
  - rbx-2
10
+ - rbx-2.3
11
11
  addons:
12
12
  code_climate:
13
13
  repo_token: d414084f17a07a6b2d7da72eaa35d92281554a4266ab8d6246fee1f6c0c161b6
@@ -2,6 +2,11 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.6.1
6
+
7
+ * Support SafariNotifications in the test server. ([Will
8
+ Schenk](https://github.com/wschenk))
9
+
5
10
  ## 0.6.0
6
11
 
7
12
  * Add `category` option for custom notification actions. ([Michel
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
+
@@ -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.0.0.rc1'
29
- gem.add_development_dependency 'pry', '~> 0.9.8'
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
- Grocer::Notification.new(payload)
46
+ build_notification(payload)
39
47
  end
40
48
 
41
49
  def sanitize_keys(hash)
@@ -1,3 +1,3 @@
1
1
  module Grocer
2
- VERSION = '0.6.0'
2
+ VERSION = '0.6.1'
3
3
  end
@@ -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.0
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: 2014-09-13 00:00:00.000000000 Z
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.0.0.rc1
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.0.0.rc1
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.9.8
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.9.8
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.1
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: