notifiable-mpns-nverinaud 0.3.0 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/notifiable/mpns/nverinaud/single_notifier.rb +6 -3
- data/lib/notifiable/mpns/nverinaud/version.rb +1 -1
- data/notifiable-mpns-nverinaud.gemspec +1 -1
- data/spec/single_notifier_spec.rb +9 -4
- data/spec/support/db/migrate/20131229104039_create_notifiable_notification_statuses.rb +11 -0
- metadata +6 -6
- data/spec/support/db/migrate/20131229104039_create_notifiable_notification_device_tokens.rb +0 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0603e386bffe7f2ec29874223e43307dc6f17380
|
4
|
+
data.tar.gz: a00a3a89015b8ce06a2d2d5d9bf904455390c996
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5306484e69d8450bcbac18ad82afacb6174ed1277aa1db9b1eb93024681b139902ae0145991761650704cf6cb57e579e04f2336153179c8d19d2cbca1ee7d335
|
7
|
+
data.tar.gz: 47860a6cf6381af0ffa069f9f46f25b15c9ee5c7bfe04c205cc21fd94bf02fe1e538484c77f0cf304206f0d98ceba943246a13d2ff7255691a68feaa0e77c565
|
@@ -12,16 +12,19 @@ module Notifiable
|
|
12
12
|
data = {title: n.title, content: n.message, params: n.params}
|
13
13
|
|
14
14
|
response = MicrosoftPushNotificationService.send_notification device_token.token, :toast, data
|
15
|
+
response_code = response.code.to_i
|
15
16
|
|
16
|
-
case
|
17
|
-
when 200
|
18
|
-
processed(n, device_token)
|
17
|
+
case response_code
|
18
|
+
when 200
|
19
19
|
when 404
|
20
20
|
Rails.logger.info "De-registering device token: #{device_token.id}"
|
21
21
|
device_token.update_attribute('is_valid', false)
|
22
22
|
else
|
23
23
|
Rails.logger.error "Error sending notification: #{response.code}"
|
24
24
|
end
|
25
|
+
|
26
|
+
processed(n, device_token, response_code)
|
27
|
+
|
25
28
|
end
|
26
29
|
end
|
27
30
|
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-rails", ">=0.
|
21
|
+
spec.add_dependency "notifiable-rails", ">=0.6.0"
|
22
22
|
spec.add_dependency "ruby-mpns", "~> 1.2.1"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
@@ -14,7 +14,9 @@ describe Notifiable::Mpns::Nverinaud::SingleNotifier do
|
|
14
14
|
m.send_notification(n, d)
|
15
15
|
m.close
|
16
16
|
|
17
|
-
Notifiable::
|
17
|
+
Notifiable::NotificationStatus.count.should == 1
|
18
|
+
Notifiable::NotificationStatus.first.status.should == 200
|
19
|
+
|
18
20
|
a_request(:post, d.token)
|
19
21
|
.with(:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><wp:Notification xmlns:wp=\"WPNotification\"><wp:Toast><wp:Text1>A title</wp:Text1><wp:Text2></wp:Text2><wp:Param></wp:Param></wp:Toast></wp:Notification>")
|
20
22
|
.should have_been_made.once
|
@@ -27,7 +29,9 @@ describe Notifiable::Mpns::Nverinaud::SingleNotifier do
|
|
27
29
|
m.send_notification(n, d)
|
28
30
|
m.close
|
29
31
|
|
30
|
-
Notifiable::
|
32
|
+
Notifiable::NotificationStatus.count.should == 1
|
33
|
+
Notifiable::NotificationStatus.first.status.should == 200
|
34
|
+
|
31
35
|
a_request(:post, d.token)
|
32
36
|
.with(:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><wp:Notification xmlns:wp=\"WPNotification\"><wp:Toast><wp:Text1></wp:Text1><wp:Text2>A message</wp:Text2><wp:Param></wp:Param></wp:Toast></wp:Notification>")
|
33
37
|
.should have_been_made.once
|
@@ -41,7 +45,7 @@ describe Notifiable::Mpns::Nverinaud::SingleNotifier do
|
|
41
45
|
m.send_notification(n, d)
|
42
46
|
m.close
|
43
47
|
|
44
|
-
Notifiable::
|
48
|
+
Notifiable::NotificationStatus.count.should == 1
|
45
49
|
a_request(:post, d.token)
|
46
50
|
.with(:body => "<?xml version=\"1.0\" encoding=\"UTF-8\"?><wp:Notification xmlns:wp=\"WPNotification\"><wp:Toast><wp:Text1></wp:Text1><wp:Text2></wp:Text2><wp:Param>?an_object_id=123456</wp:Param></wp:Toast></wp:Notification>")
|
47
51
|
.should have_been_made.once
|
@@ -55,7 +59,8 @@ describe Notifiable::Mpns::Nverinaud::SingleNotifier do
|
|
55
59
|
m.send_notification(n, d)
|
56
60
|
m.close
|
57
61
|
|
58
|
-
Notifiable::
|
62
|
+
Notifiable::NotificationStatus.count.should == 1
|
63
|
+
Notifiable::NotificationStatus.first.status.should == 404
|
59
64
|
Notifiable::DeviceToken.first.is_valid.should == false
|
60
65
|
end
|
61
66
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: notifiable-mpns-nverinaud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Matt Brooke-Smith
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-02-
|
11
|
+
date: 2014-02-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: notifiable-rails
|
@@ -16,14 +16,14 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - '>='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 0.
|
19
|
+
version: 0.6.0
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - '>='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version: 0.
|
26
|
+
version: 0.6.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ruby-mpns
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
@@ -172,7 +172,7 @@ files:
|
|
172
172
|
- spec/spec_helper.rb
|
173
173
|
- spec/support/db/migrate/20131228225139_create_notifiable_device_tokens.rb
|
174
174
|
- spec/support/db/migrate/20131228225140_create_notifiable_notifications.rb
|
175
|
-
- spec/support/db/migrate/
|
175
|
+
- spec/support/db/migrate/20131229104039_create_notifiable_notification_statuses.rb
|
176
176
|
homepage: http://www.futureworkshops.com
|
177
177
|
licenses:
|
178
178
|
- Apache 2.0
|
@@ -202,4 +202,4 @@ test_files:
|
|
202
202
|
- spec/spec_helper.rb
|
203
203
|
- spec/support/db/migrate/20131228225139_create_notifiable_device_tokens.rb
|
204
204
|
- spec/support/db/migrate/20131228225140_create_notifiable_notifications.rb
|
205
|
-
- spec/support/db/migrate/
|
205
|
+
- spec/support/db/migrate/20131229104039_create_notifiable_notification_statuses.rb
|