notifiable-mpns-nverinaud 0.2.0 → 0.3.0
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 +4 -4
- data/README.md +10 -1
- data/lib/notifiable/mpns/nverinaud/single_notifier.rb +3 -15
- data/lib/notifiable/mpns/nverinaud/version.rb +1 -1
- data/notifiable-mpns-nverinaud.gemspec +1 -1
- data/spec/single_notifier_spec.rb +4 -4
- data/spec/support/db/migrate/20131228225140_create_notifiable_notifications.rb +5 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1c1e7908ec3517ced66df745e0ed88695a05b5fb
|
4
|
+
data.tar.gz: 26950e645cac7a24d83d5b7b9f5838e824c71ad2
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 927a201220490f0ae3f3e29960c8300178fa3e23db91c596d1d829beeddfe7dc81341c1da5b18c88be8e8bf1b3b2ad677d4e347e41a555ef5e2d326616220315
|
7
|
+
data.tar.gz: 7e5d8c4caf8e4ca5b1ce475ddd9069499d14ed8d81bed007a8e2b861343ef755a63c2d038e9284ff3da7bbc6eff7378e09659cb88e64c8915b204c7693750667
|
data/README.md
CHANGED
@@ -1,3 +1,12 @@
|
|
1
|
-
#
|
1
|
+
# notifiable::mpns::nverinaud
|
2
|
+
|
3
|
+
This notifier sends one MPNS notification per connection.
|
4
|
+
|
5
|
+
It currently supports the following options:-
|
6
|
+
|
7
|
+
* toast notifications
|
8
|
+
* title
|
9
|
+
* content
|
10
|
+
* params
|
2
11
|
|
3
12
|
Please refer to the [notifiable-rails](https://github.com/FutureWorkshops/notifiable-rails) Readme for further information.
|
@@ -7,27 +7,15 @@ module Notifiable
|
|
7
7
|
class SingleNotifier < Notifiable::NotifierBase
|
8
8
|
|
9
9
|
protected
|
10
|
-
def enqueue(
|
10
|
+
def enqueue(n, device_token)
|
11
11
|
|
12
|
-
data = {}
|
13
|
-
|
14
|
-
# title
|
15
|
-
title = notification.provider_value(device_token.provider, :title)
|
16
|
-
data[:title] = title if title
|
17
|
-
|
18
|
-
# content
|
19
|
-
content = notification.provider_value(device_token.provider, :message)
|
20
|
-
data[:content] = content if content
|
21
|
-
|
22
|
-
# custom attributes
|
23
|
-
custom_attributes = notification.provider_value(device_token.provider, :params)
|
24
|
-
data.merge!({:params => custom_attributes}) if custom_attributes
|
12
|
+
data = {title: n.title, content: n.message, params: n.params}
|
25
13
|
|
26
14
|
response = MicrosoftPushNotificationService.send_notification device_token.token, :toast, data
|
27
15
|
|
28
16
|
case response.code.to_i
|
29
17
|
when 200
|
30
|
-
processed(
|
18
|
+
processed(n, device_token)
|
31
19
|
when 404
|
32
20
|
Rails.logger.info "De-registering device token: #{device_token.id}"
|
33
21
|
device_token.update_attribute('is_valid', false)
|
@@ -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.5.0"
|
22
22
|
spec.add_dependency "ruby-mpns", "~> 1.2.1"
|
23
23
|
|
24
24
|
spec.add_development_dependency "bundler", "~> 1.3"
|
@@ -6,8 +6,8 @@ describe Notifiable::Mpns::Nverinaud::SingleNotifier do
|
|
6
6
|
let(:d) { Notifiable::DeviceToken.create(:token => "http://db3.notify.live.net/throttledthirdparty/01.00/123456789123456798", :provider => :mpns) }
|
7
7
|
let(:u) { User.new(d) }
|
8
8
|
|
9
|
-
it "sends
|
10
|
-
n = Notifiable::Notification.create(:
|
9
|
+
it "sends a notification with a title" do
|
10
|
+
n = Notifiable::Notification.create(title: "A title")
|
11
11
|
|
12
12
|
stub_request(:post, d.token)
|
13
13
|
|
@@ -21,7 +21,7 @@ describe Notifiable::Mpns::Nverinaud::SingleNotifier do
|
|
21
21
|
end
|
22
22
|
|
23
23
|
it "sends a single mpns notification with content" do
|
24
|
-
n = Notifiable::Notification.create(:
|
24
|
+
n = Notifiable::Notification.create(message: "A message")
|
25
25
|
stub_request(:post, d.token)
|
26
26
|
|
27
27
|
m.send_notification(n, d)
|
@@ -34,7 +34,7 @@ describe Notifiable::Mpns::Nverinaud::SingleNotifier do
|
|
34
34
|
end
|
35
35
|
|
36
36
|
it "sends custom attributes" do
|
37
|
-
n = Notifiable::Notification.create(:
|
37
|
+
n = Notifiable::Notification.create(:params => {:an_object_id => 123456})
|
38
38
|
|
39
39
|
stub_request(:post, d.token)
|
40
40
|
|
@@ -2,8 +2,12 @@ class CreateNotifiableNotifications < ActiveRecord::Migration
|
|
2
2
|
|
3
3
|
def change
|
4
4
|
create_table :notifiable_notifications do |t|
|
5
|
+
t.text :title
|
5
6
|
t.text :message
|
6
|
-
t.text :
|
7
|
+
t.text :params
|
8
|
+
t.integer :badge
|
9
|
+
t.text :sound
|
10
|
+
t.datetime :expiry
|
7
11
|
t.timestamps
|
8
12
|
end
|
9
13
|
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.
|
4
|
+
version: 0.3.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-11 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.5.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.5.0
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: ruby-mpns
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|