notifiable-apns-grocer 0.18.1 → 0.18.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/notifiable/apns/grocer/stream.rb +1 -1
- data/lib/notifiable/apns/grocer/version.rb +1 -1
- metadata +2 -14
- data/.gitignore +0 -20
- data/.rspec +0 -1
- data/Gemfile +0 -13
- data/LICENSE.txt +0 -22
- data/config/database.yml +0 -12
- data/notifiable-apns-grocer.gemspec +0 -35
- data/spec/fixtures/apns-development.pem +0 -61
- data/spec/spec_helper.rb +0 -46
- data/spec/stream_spec.rb +0 -125
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 572d182bac38c11f83c19102093c492a5d3bc9ef
|
4
|
+
data.tar.gz: 062e8ad480204e5c0ebbbace67c763737b57e982
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 48fbaabc72a516ab2c19aafaddc7e2c76d5221ff978ea75e43a9a77c2213b5dc28068ea96934f64288463d0b7695b92f1f86d3e28e1d820079aba9483ef95610
|
7
|
+
data.tar.gz: 860de49da62776244ed3d72e8e5178f777daa6289b68f2975264fb0bc924baaccdf2343801c1ba884a1036c3ab1d73326907164f7479ddd87f3ee2f881d5be1f
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifiable-apns-grocer
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.18.
|
4
|
+
version: 0.18.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brooke-Smith
|
@@ -185,22 +185,13 @@ executables: []
|
|
185
185
|
extensions: []
|
186
186
|
extra_rdoc_files: []
|
187
187
|
files:
|
188
|
-
- ".gitignore"
|
189
|
-
- ".rspec"
|
190
|
-
- Gemfile
|
191
188
|
- LICENSE
|
192
|
-
- LICENSE.txt
|
193
189
|
- README.md
|
194
190
|
- Rakefile
|
195
|
-
- config/database.yml
|
196
191
|
- lib/notifiable/apns/grocer.rb
|
197
192
|
- lib/notifiable/apns/grocer/grocer_ssl_connection.rb
|
198
193
|
- lib/notifiable/apns/grocer/stream.rb
|
199
194
|
- lib/notifiable/apns/grocer/version.rb
|
200
|
-
- notifiable-apns-grocer.gemspec
|
201
|
-
- spec/fixtures/apns-development.pem
|
202
|
-
- spec/spec_helper.rb
|
203
|
-
- spec/stream_spec.rb
|
204
195
|
homepage: http://www.futureworkshops.com
|
205
196
|
licenses:
|
206
197
|
- Apache 2.0
|
@@ -225,7 +216,4 @@ rubygems_version: 2.6.14
|
|
225
216
|
signing_key:
|
226
217
|
specification_version: 4
|
227
218
|
summary: Notifiable APNS plugin for Grocer
|
228
|
-
test_files:
|
229
|
-
- spec/fixtures/apns-development.pem
|
230
|
-
- spec/spec_helper.rb
|
231
|
-
- spec/stream_spec.rb
|
219
|
+
test_files: []
|
data/.gitignore
DELETED
data/.rspec
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
--color
|
data/Gemfile
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
ruby '2.3.1'
|
4
|
-
|
5
|
-
git_source(:github) do |repo_name|
|
6
|
-
repo_name = "#{repo_name}/#{repo_name}" unless repo_name.include?('/')
|
7
|
-
"https://github.com/#{repo_name}.git"
|
8
|
-
end
|
9
|
-
|
10
|
-
# Specify your gem's dependencies in notifiable-apns-grocer.gemspec
|
11
|
-
gemspec
|
12
|
-
|
13
|
-
gem 'grocer', github: 'FutureWorkshops/grocer', ref: 'd574d5adca5d800eee2fac47f4ba64ce9a2d4a93'
|
data/LICENSE.txt
DELETED
@@ -1,22 +0,0 @@
|
|
1
|
-
Copyright (c) 2014 Matt Brooke-Smith
|
2
|
-
|
3
|
-
MIT License
|
4
|
-
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
-
a copy of this software and associated documentation files (the
|
7
|
-
"Software"), to deal in the Software without restriction, including
|
8
|
-
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
-
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
-
permit persons to whom the Software is furnished to do so, subject to
|
11
|
-
the following conditions:
|
12
|
-
|
13
|
-
The above copyright notice and this permission notice shall be
|
14
|
-
included in all copies or substantial portions of the Software.
|
15
|
-
|
16
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
-
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
-
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
-
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
-
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
-
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
-
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/config/database.yml
DELETED
@@ -1,35 +0,0 @@
|
|
1
|
-
# coding: utf-8
|
2
|
-
lib = File.expand_path('../lib', __FILE__)
|
3
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
-
require 'notifiable/apns/grocer/version'
|
5
|
-
|
6
|
-
Gem::Specification.new do |spec|
|
7
|
-
spec.name = "notifiable-apns-grocer"
|
8
|
-
spec.version = Notifiable::Apns::Grocer::VERSION
|
9
|
-
spec.authors = ["Matt Brooke-Smith"]
|
10
|
-
spec.email = ["matt@futureworkshops.com"]
|
11
|
-
spec.homepage = "http://www.futureworkshops.com"
|
12
|
-
spec.description = "Notifiable APNS plugin for Grocer"
|
13
|
-
spec.summary = "Notifiable APNS plugin for Grocer"
|
14
|
-
spec.license = "Apache 2.0"
|
15
|
-
|
16
|
-
spec.files = `git ls-files`.split($/)
|
17
|
-
spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
|
18
|
-
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
|
-
spec.require_paths = ["lib"]
|
20
|
-
|
21
|
-
spec.add_dependency "notifiable-core", ">= 0.1.3"
|
22
|
-
spec.add_dependency "grocer", '~> 0.7.2'
|
23
|
-
spec.add_dependency "connection_pool", '~> 2.0.0'
|
24
|
-
|
25
|
-
spec.add_development_dependency "bundler", "~> 1.3"
|
26
|
-
spec.add_development_dependency "rake"
|
27
|
-
spec.add_development_dependency "rspec"
|
28
|
-
spec.add_development_dependency "simplecov"
|
29
|
-
spec.add_development_dependency "simplecov-rcov"
|
30
|
-
spec.add_development_dependency "sqlite3"
|
31
|
-
spec.add_development_dependency "database_cleaner"
|
32
|
-
spec.add_development_dependency "byebug"
|
33
|
-
spec.add_development_dependency "pg"
|
34
|
-
|
35
|
-
end
|
@@ -1,61 +0,0 @@
|
|
1
|
-
Bag Attributes
|
2
|
-
friendlyName: Fake APNs Provider Certificate
|
3
|
-
localKeyID: C0 9A 0E C0 77 F5 7A A4 71 1B 07 9D 10 0E 2D FB 8C B5 62 BC
|
4
|
-
subject=/CN=Fake APNs Provider Certificate/O=Fake Provider/OU=Fake Notification Sending Division/ST=Fake Washington/C=US/L=Fake Seattle/emailAddress=info@wavii.com
|
5
|
-
issuer=/CN=Fake APNs Certificate Authority/O=Fake Apple/OU=Fake Certificate Signing Division/ST=Fake California/C=US/L=Fake Cupertino/emailAddress=info@wavii.com
|
6
|
-
-----BEGIN CERTIFICATE-----
|
7
|
-
MIIENDCCAxygAwIBAgIBAjALBgkqhkiG9w0BAQswgcoxKDAmBgNVBAMMH0Zha2Ug
|
8
|
-
QVBOcyBDZXJ0aWZpY2F0ZSBBdXRob3JpdHkxEzARBgNVBAoMCkZha2UgQXBwbGUx
|
9
|
-
KjAoBgNVBAsMIUZha2UgQ2VydGlmaWNh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
-
CwUAA4IBAQCfsBLbFlCfMFA1t5o4C1QWMA3tfM+MyGUDSJ4qIWFF1/zBQl8bSTc/
|
25
|
-
XkUaNZ42R/NZ+anwyPlYNK/N7JBC5nJiIDkn+SF/ifXUMZcJ6ryWwEIuM9oPf+yM
|
26
|
-
LABztG23gD6RbFw5n3PhO2IsO8dKa2HS4yxBPWAJuOnn9A+H87G+Vy7f7hc9ZgR+
|
27
|
-
BmUNVj9Wm+NBrZrWU431HbLUyi2udD2vDfXk2LopBUN05iOD7BqHEUbdeQ5bPxe5
|
28
|
-
7smdpmEV3QrbpfCfWtoV28OJ/EA0qB0GwihJ3Pkx3V7SaASOwEwhhiwHQDPN/Ksy
|
29
|
-
lG47dCmL1Q47TN9Rzv7LnCSuKXuEycxo
|
30
|
-
-----END CERTIFICATE-----
|
31
|
-
Bag Attributes
|
32
|
-
friendlyName: Fake APNs Provider Certificate
|
33
|
-
localKeyID: C0 9A 0E C0 77 F5 7A A4 71 1B 07 9D 10 0E 2D FB 8C B5 62 BC
|
34
|
-
Key Attributes: <No Attributes>
|
35
|
-
-----BEGIN RSA PRIVATE KEY-----
|
36
|
-
MIIEowIBAAKCAQEAt55G3KgYKjJNk8uviaNsrydClvBx/r/YaWSoMNpjLXuQWNlc
|
37
|
-
Ddmt0+dxacLWAD73dkC2/L9rU91LIow2tN2SqaIh3gTNGXmgQVUARdhLLkOYvvwq
|
38
|
-
Ixh+aEZe26yr6aPQe+wEdFGxMRKqZGHAePxOHjBgGnrDiOtSYUMg/YW5OpyTVaC2
|
39
|
-
CxVAyBWCuDJRQMLN6Mx8bEGS9q8/1NGZiqVk+pGRp0yhp2xP4lMDwkBruyu1BWZ1
|
40
|
-
8KDQ+8gpnF6AgCIaN2g7RmhZKVLZ9YXMMp+wjJtduqKc7+w6DkL0hMBhHn4D+kFh
|
41
|
-
e/5Hcw69gvFnhKAcU6qzgnSgXbrfbiOi+3UVaQIDAQABAoIBAAKv1zudXhUn/Uif
|
42
|
-
X2c1M/7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k6xy8xyYb/CAOnOecX4ujRxI
|
57
|
-
usLQgP0frVwI6tB+ChebNXLz65HCiPmFxs9utIxQT6kxXzFqQzp3dnZ8ZBXW+UBg
|
58
|
-
5Lqx5wKBgFIi2DP5/cF5nUDqOtiQTzl0MeJWW3w3UBS9jQF7Cx00YyLSqIF1batv
|
59
|
-
Zk0Yq5w/2oh9C5EDrf8eyCYfK3iU2Ij4Jy6N6zITjRhW/kxxZigjmcTb/Tsme2Xh
|
60
|
-
IFo5RoAfOV1dPiXM4oqZFPNmppAxiZH2ohEmo593DHYosQHMjXYG
|
61
|
-
-----END RSA PRIVATE KEY-----
|
data/spec/spec_helper.rb
DELETED
@@ -1,46 +0,0 @@
|
|
1
|
-
require 'simplecov'
|
2
|
-
require 'simplecov-rcov'
|
3
|
-
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
4
|
-
SimpleCov.start do
|
5
|
-
add_filter "/spec/"
|
6
|
-
end
|
7
|
-
|
8
|
-
require 'timeout'
|
9
|
-
require 'database_cleaner'
|
10
|
-
require 'active_record'
|
11
|
-
require 'notifiable'
|
12
|
-
require 'notifiable/apns/grocer'
|
13
|
-
require 'grocer'
|
14
|
-
require 'byebug'
|
15
|
-
|
16
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
17
|
-
|
18
|
-
# Setup ActiveRecord db connection
|
19
|
-
ActiveRecord::Base.establish_connection(YAML.load_file('config/database.yml')['test'])
|
20
|
-
|
21
|
-
RSpec.configure do |config|
|
22
|
-
config.mock_with :rspec
|
23
|
-
config.order = "random"
|
24
|
-
|
25
|
-
config.before(:all) {
|
26
|
-
DatabaseCleaner.strategy = :truncation
|
27
|
-
Notifiable.notifier_classes[:apns] = Notifiable::Apns::Grocer::Stream
|
28
|
-
Notifiable::App.define_configuration_accessors(Notifiable.notifier_classes)
|
29
|
-
|
30
|
-
@grocer = Grocer.server(port: 2195)
|
31
|
-
@grocer.accept
|
32
|
-
}
|
33
|
-
|
34
|
-
config.before(:each) {
|
35
|
-
DatabaseCleaner.start
|
36
|
-
@grocer.notifications.clear
|
37
|
-
}
|
38
|
-
|
39
|
-
config.after(:each) {
|
40
|
-
DatabaseCleaner.clean
|
41
|
-
}
|
42
|
-
|
43
|
-
config.after(:all) {
|
44
|
-
@grocer.close
|
45
|
-
}
|
46
|
-
end
|
data/spec/stream_spec.rb
DELETED
@@ -1,125 +0,0 @@
|
|
1
|
-
require 'spec_helper'
|
2
|
-
|
3
|
-
describe Notifiable::Apns::Grocer::Stream do
|
4
|
-
|
5
|
-
subject { Notifiable::Apns::Grocer::Stream.new(n1) }
|
6
|
-
let(:a1) { Notifiable::App.create! name: "Drum Cussac" }
|
7
|
-
let(:n1) { Notifiable::Notification.create! app: a1 }
|
8
|
-
|
9
|
-
describe "#sandbox?" do
|
10
|
-
before(:each) { subject.instance_variable_set("@sandbox", "1") }
|
11
|
-
it { expect(subject.send(:sandbox?)).to eql true }
|
12
|
-
end
|
13
|
-
|
14
|
-
describe "#grocer_payload?" do
|
15
|
-
let(:d1) { Notifiable::DeviceToken.create! app: a1, token: "abc123", provider: 'apns' }
|
16
|
-
before(:each) { @grocer_payload = subject.send("grocer_payload", d1, n1) }
|
17
|
-
|
18
|
-
context "message" do
|
19
|
-
let(:n1) { Notifiable::Notification.create! app: a1, message: "New deals!" }
|
20
|
-
it { expect(@grocer_payload).to include(device_token: "abc123") }
|
21
|
-
it { expect(@grocer_payload[:alert]).to include({body: "New deals!"}) }
|
22
|
-
it { expect(@grocer_payload).to include({sound: 'default'}) }
|
23
|
-
it { expect(@grocer_payload[:custom]).to include(n_id: n1.id) }
|
24
|
-
end
|
25
|
-
|
26
|
-
context "title and message" do
|
27
|
-
let(:n1) { Notifiable::Notification.create! app: a1, title: 'Shopping', message: "New deals!" }
|
28
|
-
it { expect(@grocer_payload[:alert]).to include({title: 'Shopping'}) }
|
29
|
-
it { expect(@grocer_payload[:alert]).to include({body: 'New deals!'}) }
|
30
|
-
it { expect(@grocer_payload).to include({sound: 'default'}) }
|
31
|
-
it { expect(@grocer_payload).to include(device_token: "abc123") }
|
32
|
-
it { expect(@grocer_payload[:custom]).to include(n_id: n1.id) }
|
33
|
-
end
|
34
|
-
|
35
|
-
context "sound" do
|
36
|
-
let(:n1) { Notifiable::Notification.create! app: a1, sound: "buzzer" }
|
37
|
-
it { expect(@grocer_payload).to include(sound: "buzzer") }
|
38
|
-
it { expect(@grocer_payload).to include(device_token: "abc123") }
|
39
|
-
it { expect(@grocer_payload[:custom]).to include(n_id: n1.id) }
|
40
|
-
end
|
41
|
-
|
42
|
-
context "badge count" do
|
43
|
-
let(:n1) { Notifiable::Notification.create! app: a1, badge_count: 1 }
|
44
|
-
it { expect(@grocer_payload).to include(badge: 1) }
|
45
|
-
it { expect(@grocer_payload).to include(device_token: "abc123") }
|
46
|
-
it { expect(@grocer_payload[:custom]).to include(n_id: n1.id) }
|
47
|
-
end
|
48
|
-
|
49
|
-
context "parameters" do
|
50
|
-
let(:n1) { Notifiable::Notification.create! app: a1, parameters: {screen: "leaderboard"}}
|
51
|
-
it { expect(@grocer_payload).to include(device_token: "abc123") }
|
52
|
-
it { expect(@grocer_payload[:custom]).to include(n_id: n1.id) }
|
53
|
-
it { expect(@grocer_payload[:custom]).to include(screen: "leaderboard") }
|
54
|
-
end
|
55
|
-
|
56
|
-
context "identifier" do
|
57
|
-
let(:n1) { Notifiable::Notification.create! app: a1, identifier: "23508241"}
|
58
|
-
it { expect(@grocer_payload).to include(device_token: "abc123") }
|
59
|
-
it { expect(@grocer_payload[:custom]).to include(n_id: n1.id) }
|
60
|
-
it { expect(@grocer_payload).to include(identifier: "23508241") }
|
61
|
-
end
|
62
|
-
|
63
|
-
context "content_available" do
|
64
|
-
let(:n1) { Notifiable::Notification.create! app: a1, content_available: true}
|
65
|
-
it { expect(@grocer_payload).to include(device_token: "abc123") }
|
66
|
-
it { expect(@grocer_payload[:custom]).to include(n_id: n1.id) }
|
67
|
-
it { expect(@grocer_payload).to include(content_available: true) }
|
68
|
-
end
|
69
|
-
|
70
|
-
context "mutable_content" do
|
71
|
-
let(:n1) { Notifiable::Notification.create! app: a1, mutable_content: true}
|
72
|
-
it { expect(@grocer_payload).to include(device_token: "abc123") }
|
73
|
-
it { expect(@grocer_payload[:custom]).to include(n_id: n1.id) }
|
74
|
-
it { expect(@grocer_payload).to include(mutable_content: true) }
|
75
|
-
end
|
76
|
-
|
77
|
-
context "expiry" do
|
78
|
-
let(:expiry) { Time.now + 60*60 }
|
79
|
-
let(:n1) { Notifiable::Notification.create! app: a1, expiry: expiry}
|
80
|
-
it { expect(@grocer_payload).to include(device_token: "abc123") }
|
81
|
-
it { expect(@grocer_payload[:custom]).to include(n_id: n1.id) }
|
82
|
-
it { expect(@grocer_payload).to include(expiry: expiry) }
|
83
|
-
end
|
84
|
-
|
85
|
-
context "thread id" do
|
86
|
-
let(:thread_id) { "threadabc123" }
|
87
|
-
let(:n1) { Notifiable::Notification.create! app: a1, thread_id: thread_id}
|
88
|
-
it { expect(@grocer_payload).to include(device_token: "abc123") }
|
89
|
-
it { expect(@grocer_payload).to include(thread_id: "threadabc123") }
|
90
|
-
it { expect(@grocer_payload[:custom]).to include(n_id: n1.id) }
|
91
|
-
end
|
92
|
-
|
93
|
-
context "category" do
|
94
|
-
let(:category) { "INVITATION" }
|
95
|
-
let(:n1) { Notifiable::Notification.create! app: a1, category: category}
|
96
|
-
it { expect(@grocer_payload).to include(device_token: "abc123") }
|
97
|
-
it { expect(@grocer_payload).to include(category: "INVITATION") }
|
98
|
-
it { expect(@grocer_payload[:custom]).to include(n_id: n1.id) }
|
99
|
-
end
|
100
|
-
end
|
101
|
-
|
102
|
-
describe "#gateway_host" do
|
103
|
-
context "sandbox" do
|
104
|
-
before(:each) { allow(subject).to receive(:sandbox?) { true } }
|
105
|
-
it { expect(subject.send(:gateway_host)).to eql "gateway.sandbox.push.apple.com" }
|
106
|
-
end
|
107
|
-
|
108
|
-
context "production" do
|
109
|
-
before(:each) { allow(subject).to receive(:sandbox?) { false } }
|
110
|
-
it { expect(subject.send(:gateway_host)).to eql "gateway.push.apple.com" }
|
111
|
-
end
|
112
|
-
end
|
113
|
-
|
114
|
-
describe "#feedback" do
|
115
|
-
let!(:d1) { Notifiable::DeviceToken.create! app: a1, token: 'abc123', provider: 'apns' }
|
116
|
-
before(:each) do
|
117
|
-
feedback_double = double('Grocer::Feedback')
|
118
|
-
attempt_double = double('Grocer::FailedDeliveryAttempt', device_token: 'abc123', timestamp: DateTime.now)
|
119
|
-
allow(subject).to receive(:grocer_feedback) { [attempt_double].each }
|
120
|
-
subject.send(:process_feedback)
|
121
|
-
end
|
122
|
-
it { expect(Notifiable::DeviceToken.count).to eq 0 }
|
123
|
-
end
|
124
|
-
|
125
|
-
end
|