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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1c1e7908ec3517ced66df745e0ed88695a05b5fb
4
- data.tar.gz: 26950e645cac7a24d83d5b7b9f5838e824c71ad2
3
+ metadata.gz: 0603e386bffe7f2ec29874223e43307dc6f17380
4
+ data.tar.gz: a00a3a89015b8ce06a2d2d5d9bf904455390c996
5
5
  SHA512:
6
- metadata.gz: 927a201220490f0ae3f3e29960c8300178fa3e23db91c596d1d829beeddfe7dc81341c1da5b18c88be8e8bf1b3b2ad677d4e347e41a555ef5e2d326616220315
7
- data.tar.gz: 7e5d8c4caf8e4ca5b1ce475ddd9069499d14ed8d81bed007a8e2b861343ef755a63c2d038e9284ff3da7bbc6eff7378e09659cb88e64c8915b204c7693750667
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 response.code.to_i
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
@@ -1,7 +1,7 @@
1
1
  module Notifiable
2
2
  module Mpns
3
3
  module Nverinaud
4
- VERSION = "0.3.0"
4
+ VERSION = "0.4.0"
5
5
  end
6
6
  end
7
7
  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.5.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::NotificationDeviceToken.count.should == 1
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::NotificationDeviceToken.count.should == 1
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::NotificationDeviceToken.count.should == 1
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::NotificationDeviceToken.count.should == 0
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
 
@@ -0,0 +1,11 @@
1
+ class CreateNotifiableNotificationStatuses < ActiveRecord::Migration
2
+
3
+ def change
4
+ create_table :notifiable_notification_statuses do |t|
5
+ t.references :notification
6
+ t.references :device_token
7
+ t.integer :status
8
+ end
9
+ end
10
+
11
+ end
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.3.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 00:00:00.000000000 Z
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.5.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.5.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/20131229104039_create_notifiable_notification_device_tokens.rb
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/20131229104039_create_notifiable_notification_device_tokens.rb
205
+ - spec/support/db/migrate/20131229104039_create_notifiable_notification_statuses.rb
@@ -1,11 +0,0 @@
1
- class CreateNotifiableNotificationDeviceTokens < ActiveRecord::Migration
2
-
3
- def change
4
- create_table :notifiable_notification_device_tokens do |t|
5
- t.references :notification
6
- t.references :device_token
7
- t.timestamps
8
- end
9
- end
10
-
11
- end