notifiable-gcm-spacialdb 0.10.1 → 0.11.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +19 -103
- data/Rakefile +3 -0
- data/config/database.yml +12 -0
- data/lib/notifiable/gcm/spacialdb/batch.rb +1 -1
- data/lib/notifiable/gcm/spacialdb/version.rb +1 -1
- data/notifiable-gcm-spacialdb.gemspec +2 -1
- data/spec/batch_spec.rb +5 -5
- data/spec/spec_helper.rb +4 -33
- metadata +20 -5
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 901c96a483454886353b80465b75c00c25924e8e
|
4
|
+
data.tar.gz: c56f5305ba962aed839b344208ed8ea875f04b54
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ee5bd1c85b4873462b4bfb7e5497db6cd2839d6cbf128674c0629814ceb5d56e864c02d2a079707acb6eb2f9abf9a6c663eeabd16a80cb8dfc34b4ba5b4da9df
|
7
|
+
data.tar.gz: '0954911ab2d633ba24d134b98d9f94e4fb2881ed90e5ddf01b16d12c75e8c21920b4848cc2ea85fedc23a92fbf5bf469ede06beea1ccdc46736bafc4c2fae313'
|
data/Gemfile.lock
CHANGED
@@ -1,127 +1,53 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
notifiable-gcm-spacialdb (0.
|
4
|
+
notifiable-gcm-spacialdb (0.11.0)
|
5
5
|
gcm (~> 0.1.1)
|
6
|
-
notifiable-
|
6
|
+
notifiable-core (>= 0.1.3)
|
7
7
|
|
8
8
|
GEM
|
9
9
|
remote: https://rubygems.org/
|
10
10
|
specs:
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
rails-dom-testing (~> 2.0)
|
21
|
-
actionpack (5.1.5)
|
22
|
-
actionview (= 5.1.5)
|
23
|
-
activesupport (= 5.1.5)
|
24
|
-
rack (~> 2.0)
|
25
|
-
rack-test (>= 0.6.3)
|
26
|
-
rails-dom-testing (~> 2.0)
|
27
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.2)
|
28
|
-
actionview (5.1.5)
|
29
|
-
activesupport (= 5.1.5)
|
30
|
-
builder (~> 3.1)
|
31
|
-
erubi (~> 1.4)
|
32
|
-
rails-dom-testing (~> 2.0)
|
33
|
-
rails-html-sanitizer (~> 1.0, >= 1.0.3)
|
34
|
-
activejob (5.1.5)
|
35
|
-
activesupport (= 5.1.5)
|
36
|
-
globalid (>= 0.3.6)
|
37
|
-
activemodel (5.1.5)
|
38
|
-
activesupport (= 5.1.5)
|
39
|
-
activerecord (5.1.5)
|
40
|
-
activemodel (= 5.1.5)
|
41
|
-
activesupport (= 5.1.5)
|
42
|
-
arel (~> 8.0)
|
43
|
-
activerecord-postgis-adapter (5.2.1)
|
44
|
-
activerecord (~> 5.1)
|
45
|
-
rgeo-activerecord (~> 6.0)
|
46
|
-
activesupport (5.1.5)
|
11
|
+
activemodel (5.2.1)
|
12
|
+
activesupport (= 5.2.1)
|
13
|
+
activerecord (5.2.1)
|
14
|
+
activemodel (= 5.2.1)
|
15
|
+
activesupport (= 5.2.1)
|
16
|
+
arel (>= 9.0)
|
17
|
+
activerecord-import (0.25.0)
|
18
|
+
activerecord (>= 3.2)
|
19
|
+
activesupport (5.2.1)
|
47
20
|
concurrent-ruby (~> 1.0, >= 1.0.2)
|
48
|
-
i18n (
|
21
|
+
i18n (>= 0.7, < 2)
|
49
22
|
minitest (~> 5.1)
|
50
23
|
tzinfo (~> 1.1)
|
51
24
|
addressable (2.5.2)
|
52
25
|
public_suffix (>= 2.0.2, < 4.0)
|
53
|
-
arel (
|
54
|
-
builder (3.2.3)
|
26
|
+
arel (9.0.0)
|
55
27
|
byebug (10.0.1)
|
56
28
|
concurrent-ruby (1.0.5)
|
57
29
|
crack (0.4.3)
|
58
30
|
safe_yaml (~> 1.0.0)
|
59
|
-
crass (1.0.3)
|
60
31
|
database_cleaner (1.2.0)
|
61
32
|
diff-lcs (1.3)
|
62
33
|
docile (1.1.5)
|
63
|
-
erubi (1.7.1)
|
64
34
|
gcm (0.1.1)
|
65
35
|
httparty
|
66
36
|
json
|
67
|
-
|
68
|
-
activesupport (>= 4.2.0)
|
69
|
-
httparty (0.16.1)
|
37
|
+
httparty (0.16.2)
|
70
38
|
multi_xml (>= 0.5.2)
|
71
|
-
i18n (
|
39
|
+
i18n (1.1.0)
|
72
40
|
concurrent-ruby (~> 1.0)
|
73
41
|
json (2.1.0)
|
74
|
-
loofah (2.2.1)
|
75
|
-
crass (~> 1.0.2)
|
76
|
-
nokogiri (>= 1.5.9)
|
77
|
-
mail (2.7.0)
|
78
|
-
mini_mime (>= 0.1.1)
|
79
|
-
method_source (0.9.0)
|
80
|
-
mini_mime (1.0.0)
|
81
|
-
mini_portile2 (2.3.0)
|
82
42
|
minitest (5.11.3)
|
83
43
|
multi_json (1.13.1)
|
84
44
|
multi_xml (0.6.0)
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
notifiable-rails (0.26.3)
|
89
|
-
activerecord-postgis-adapter
|
90
|
-
pg
|
91
|
-
rails
|
45
|
+
notifiable-core (0.1.3)
|
46
|
+
activerecord
|
47
|
+
activerecord-import
|
92
48
|
pg (1.0.0)
|
93
49
|
public_suffix (3.0.2)
|
94
|
-
rack (2.0.4)
|
95
|
-
rack-test (0.8.3)
|
96
|
-
rack (>= 1.0, < 3)
|
97
|
-
rails (5.1.5)
|
98
|
-
actioncable (= 5.1.5)
|
99
|
-
actionmailer (= 5.1.5)
|
100
|
-
actionpack (= 5.1.5)
|
101
|
-
actionview (= 5.1.5)
|
102
|
-
activejob (= 5.1.5)
|
103
|
-
activemodel (= 5.1.5)
|
104
|
-
activerecord (= 5.1.5)
|
105
|
-
activesupport (= 5.1.5)
|
106
|
-
bundler (>= 1.3.0)
|
107
|
-
railties (= 5.1.5)
|
108
|
-
sprockets-rails (>= 2.0.0)
|
109
|
-
rails-dom-testing (2.0.3)
|
110
|
-
activesupport (>= 4.2.0)
|
111
|
-
nokogiri (>= 1.6)
|
112
|
-
rails-html-sanitizer (1.0.3)
|
113
|
-
loofah (~> 2.0)
|
114
|
-
railties (5.1.5)
|
115
|
-
actionpack (= 5.1.5)
|
116
|
-
activesupport (= 5.1.5)
|
117
|
-
method_source
|
118
|
-
rake (>= 0.8.7)
|
119
|
-
thor (>= 0.18.1, < 2.0)
|
120
50
|
rake (10.1.1)
|
121
|
-
rgeo (1.0.0)
|
122
|
-
rgeo-activerecord (6.0.0)
|
123
|
-
activerecord (~> 5.0)
|
124
|
-
rgeo (~> 1.0)
|
125
51
|
rspec (3.7.0)
|
126
52
|
rspec-core (~> 3.7.0)
|
127
53
|
rspec-expectations (~> 3.7.0)
|
@@ -143,24 +69,13 @@ GEM
|
|
143
69
|
simplecov-html (0.8.0)
|
144
70
|
simplecov-rcov (0.2.3)
|
145
71
|
simplecov (>= 0.4.1)
|
146
|
-
sprockets (3.7.1)
|
147
|
-
concurrent-ruby (~> 1.0)
|
148
|
-
rack (> 1, < 3)
|
149
|
-
sprockets-rails (3.2.1)
|
150
|
-
actionpack (>= 4.0)
|
151
|
-
activesupport (>= 4.0)
|
152
|
-
sprockets (>= 3.0.0)
|
153
72
|
sqlite3 (1.3.13)
|
154
|
-
thor (0.20.0)
|
155
73
|
thread_safe (0.3.6)
|
156
74
|
tzinfo (1.2.5)
|
157
75
|
thread_safe (~> 0.1)
|
158
76
|
webmock (1.17.4)
|
159
77
|
addressable (>= 2.2.7)
|
160
78
|
crack (>= 0.3.2)
|
161
|
-
websocket-driver (0.6.5)
|
162
|
-
websocket-extensions (>= 0.1.0)
|
163
|
-
websocket-extensions (0.1.3)
|
164
79
|
|
165
80
|
PLATFORMS
|
166
81
|
ruby
|
@@ -170,6 +85,7 @@ DEPENDENCIES
|
|
170
85
|
byebug
|
171
86
|
database_cleaner (~> 1.2.0)
|
172
87
|
notifiable-gcm-spacialdb!
|
88
|
+
pg
|
173
89
|
rake (~> 10.1.1)
|
174
90
|
rspec (~> 3.7)
|
175
91
|
simplecov (~> 0.8.2)
|
data/Rakefile
CHANGED
data/config/database.yml
ADDED
@@ -44,7 +44,7 @@ module Notifiable
|
|
44
44
|
if response[:status_code] == 200
|
45
45
|
process_success_response(response)
|
46
46
|
else
|
47
|
-
|
47
|
+
logger.error "Sending notification id: #{notification.id} code: #{response[:status_code]} response: #{response[:response]}"
|
48
48
|
end
|
49
49
|
@batch = []
|
50
50
|
end
|
@@ -18,7 +18,7 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.test_files = spec.files.grep(%r{^(test|spec|features)/})
|
19
19
|
spec.require_paths = ["lib"]
|
20
20
|
|
21
|
-
spec.add_dependency "notifiable-
|
21
|
+
spec.add_dependency "notifiable-core", ">= 0.1.3"
|
22
22
|
spec.add_dependency "gcm", '~> 0.1.1'
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
@@ -30,5 +30,6 @@ Gem::Specification.new do |spec|
|
|
30
30
|
spec.add_development_dependency "database_cleaner", "~> 1.2.0"
|
31
31
|
spec.add_development_dependency "webmock", "~> 1.17.1"
|
32
32
|
spec.add_development_dependency "byebug"
|
33
|
+
spec.add_development_dependency "pg"
|
33
34
|
|
34
35
|
end
|
data/spec/batch_spec.rb
CHANGED
@@ -15,28 +15,28 @@ describe Notifiable::Gcm::Spacialdb::Batch do
|
|
15
15
|
|
16
16
|
context 'single' do
|
17
17
|
let(:n1) { Notifiable::Notification.create(app: a, title: 'Test title', message: 'Test message', parameters: {flag: true} ) }
|
18
|
-
let(:request_body) { "{\"registration_ids\":[\"ABC123\"],\"data\":{\"message\":\"Test message\",\"title\":\"Test title\",\"flag\":true,\"n_id\"
|
18
|
+
let(:request_body) { "{\"registration_ids\":[\"ABC123\"],\"data\":{\"message\":\"Test message\",\"title\":\"Test title\",\"flag\":true,\"n_id\":#{n1.id}}}" }
|
19
19
|
let(:response_body) { '{ "multicast_id": 108, "success": 1, "failure": 0, "canonical_ids": 0, "results": [{ "message_id": "1:08" }]}' }
|
20
20
|
it { expect(Notifiable::NotificationStatus.count).to eq 1 }
|
21
21
|
it { expect(Notifiable::NotificationStatus.first.status).to eq 0 }
|
22
22
|
end
|
23
23
|
|
24
24
|
context 'custom attributes' do
|
25
|
-
let(:request_body) { "{\"registration_ids\":[\"ABC123\"],\"data\":{\"message\":\"Test message\",\"flag\":true,\"n_id\"
|
25
|
+
let(:request_body) { "{\"registration_ids\":[\"ABC123\"],\"data\":{\"message\":\"Test message\",\"flag\":true,\"n_id\":#{n1.id}}}" }
|
26
26
|
let(:response_body) { '{ "multicast_id": 108, "success": 1, "failure": 0, "canonical_ids": 0, "results": [{ "message_id": "1:08" }]}' }
|
27
27
|
it { expect(Notifiable::NotificationStatus.count).to eq 1 }
|
28
28
|
it { expect(Notifiable::NotificationStatus.first.status).to eq 0 }
|
29
29
|
end
|
30
30
|
|
31
31
|
context 'deletes an unregistered token' do
|
32
|
-
let(:request_body) { "{\"registration_ids\":[\"ABC123\"],\"data\":{\"message\":\"Test message\",\"flag\":true,\"n_id\"
|
32
|
+
let(:request_body) { "{\"registration_ids\":[\"ABC123\"],\"data\":{\"message\":\"Test message\",\"flag\":true,\"n_id\":#{n1.id}}}" }
|
33
33
|
let(:response_body) { '{ "multicast_id": 108, "success": 0, "failure": 1, "canonical_ids": 0, "results": [{ "error": "NotRegistered" }]}' }
|
34
|
-
it { expect(Notifiable::NotificationStatus.count).to eq
|
34
|
+
it { expect(Notifiable::NotificationStatus.count).to eq 1 }
|
35
35
|
it { expect(Notifiable::DeviceToken.count).to eq 0 }
|
36
36
|
end
|
37
37
|
|
38
38
|
context 'id change' do
|
39
|
-
let(:request_body) { "{\"registration_ids\":[\"ABC123\"],\"data\":{\"message\":\"Test message\",\"flag\":true,\"n_id\"
|
39
|
+
let(:request_body) { "{\"registration_ids\":[\"ABC123\"],\"data\":{\"message\":\"Test message\",\"flag\":true,\"n_id\":#{n1.id}}}" }
|
40
40
|
let(:response_body) { '{ "multicast_id": 108, "success": 1, "failure": 0, "canonical_ids": 1, "results": [{ "message_id": "1:08", "registration_id": "GHJ12345" }]}' }
|
41
41
|
it { expect(Notifiable::NotificationStatus.count).to eq 1 }
|
42
42
|
it { expect(Notifiable::DeviceToken.count).to eq 1 }
|
data/spec/spec_helper.rb
CHANGED
@@ -1,5 +1,3 @@
|
|
1
|
-
ENV['RAILS_ENV'] ||= 'test'
|
2
|
-
|
3
1
|
require 'simplecov'
|
4
2
|
require 'simplecov-rcov'
|
5
3
|
SimpleCov.formatter = SimpleCov::Formatter::RcovFormatter
|
@@ -9,56 +7,29 @@ end
|
|
9
7
|
|
10
8
|
require 'active_record'
|
11
9
|
require 'database_cleaner'
|
12
|
-
require '
|
13
|
-
require 'notifiable'
|
14
|
-
require 'gcm'
|
10
|
+
require 'notifiable/gcm/spacialdb'
|
15
11
|
require 'webmock/rspec'
|
16
12
|
require 'byebug'
|
17
|
-
require File.expand_path("../../lib/notifiable/gcm/spacialdb", __FILE__)
|
18
|
-
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
19
13
|
|
20
|
-
|
21
|
-
DatabaseCleaner.strategy = :truncation
|
14
|
+
Dir["#{File.dirname(__FILE__)}/support/**/*.rb"].each { |f| require f }
|
22
15
|
|
23
|
-
|
16
|
+
# Setup ActiveRecord db connection
|
17
|
+
ActiveRecord::Base.establish_connection(YAML.load_file('config/database.yml')['test'])
|
24
18
|
|
25
19
|
RSpec.configure do |config|
|
26
20
|
config.mock_with :rspec
|
27
21
|
config.order = "random"
|
28
22
|
|
29
23
|
config.before(:all) {
|
30
|
-
|
31
24
|
Notifiable.notifier_classes[:gcm] = Notifiable::Gcm::Spacialdb::Batch
|
32
25
|
Notifiable::App.define_configuration_accessors(Notifiable.notifier_classes)
|
33
|
-
|
34
|
-
# DB setup
|
35
|
-
ActiveRecord::Base.establish_connection(
|
36
|
-
{ :adapter => 'sqlite3',
|
37
|
-
:database => db_path,
|
38
|
-
:pool => 5,
|
39
|
-
:timeout => 5000}
|
40
|
-
)
|
41
|
-
|
42
|
-
ActiveRecord::Migration.verbose = false
|
43
|
-
notifiable_rails_path = Gem.loaded_specs['notifiable-rails'].full_gem_path
|
44
|
-
ActiveRecord::Migrator.migrate File.join(notifiable_rails_path, 'db', 'migrate')
|
45
|
-
|
46
|
-
# todo start stub
|
47
26
|
}
|
48
27
|
|
49
28
|
config.before(:each) {
|
50
29
|
DatabaseCleaner.start
|
51
|
-
# todo clear stub state
|
52
30
|
}
|
53
31
|
|
54
32
|
config.after(:each) {
|
55
33
|
DatabaseCleaner.clean
|
56
34
|
}
|
57
|
-
|
58
|
-
config.after(:all) {
|
59
|
-
# todo close stub
|
60
|
-
|
61
|
-
# drop the database
|
62
|
-
File.delete(db_path)
|
63
|
-
}
|
64
35
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifiable-gcm-spacialdb
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.11.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Kamil Kocemba
|
@@ -9,22 +9,22 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2018-
|
12
|
+
date: 2018-08-26 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
|
-
name: notifiable-
|
15
|
+
name: notifiable-core
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
18
|
- - ">="
|
19
19
|
- !ruby/object:Gem::Version
|
20
|
-
version: 0.
|
20
|
+
version: 0.1.3
|
21
21
|
type: :runtime
|
22
22
|
prerelease: false
|
23
23
|
version_requirements: !ruby/object:Gem::Requirement
|
24
24
|
requirements:
|
25
25
|
- - ">="
|
26
26
|
- !ruby/object:Gem::Version
|
27
|
-
version: 0.
|
27
|
+
version: 0.1.3
|
28
28
|
- !ruby/object:Gem::Dependency
|
29
29
|
name: gcm
|
30
30
|
requirement: !ruby/object:Gem::Requirement
|
@@ -165,6 +165,20 @@ dependencies:
|
|
165
165
|
- - ">="
|
166
166
|
- !ruby/object:Gem::Version
|
167
167
|
version: '0'
|
168
|
+
- !ruby/object:Gem::Dependency
|
169
|
+
name: pg
|
170
|
+
requirement: !ruby/object:Gem::Requirement
|
171
|
+
requirements:
|
172
|
+
- - ">="
|
173
|
+
- !ruby/object:Gem::Version
|
174
|
+
version: '0'
|
175
|
+
type: :development
|
176
|
+
prerelease: false
|
177
|
+
version_requirements: !ruby/object:Gem::Requirement
|
178
|
+
requirements:
|
179
|
+
- - ">="
|
180
|
+
- !ruby/object:Gem::Version
|
181
|
+
version: '0'
|
168
182
|
description: Plugin to use GCM with Notifiable
|
169
183
|
email:
|
170
184
|
- kamil@futureworkshops.com
|
@@ -180,6 +194,7 @@ files:
|
|
180
194
|
- LICENSE
|
181
195
|
- README.md
|
182
196
|
- Rakefile
|
197
|
+
- config/database.yml
|
183
198
|
- lib/notifiable/gcm/spacialdb.rb
|
184
199
|
- lib/notifiable/gcm/spacialdb/batch.rb
|
185
200
|
- lib/notifiable/gcm/spacialdb/version.rb
|