notifiable-mpns-nverinaud 0.2.0 → 0.3.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: 0f8ed9de33d83bdef31684a88eb5d124447a27db
4
- data.tar.gz: 4fab56b8f4c50a65c9c95a0f110a1cd01eb6b899
3
+ metadata.gz: 1c1e7908ec3517ced66df745e0ed88695a05b5fb
4
+ data.tar.gz: 26950e645cac7a24d83d5b7b9f5838e824c71ad2
5
5
  SHA512:
6
- metadata.gz: 9af490e671a5acc7f8352adc3366afa1f7e847c335bb0c766f42c2771ee4fa29c225daa972d7836270a30f2949451689e5ea4d0acfad459481a12383fcf2dcb7
7
- data.tar.gz: 10babfb594c69f2aea56e419f8b7d38b4af8619078b05c6f3e5fefbc2ae127cb3eee8c07b9714f67c2bff9b880142f5ee2a3627efa34193becf4505117657faf
6
+ metadata.gz: 927a201220490f0ae3f3e29960c8300178fa3e23db91c596d1d829beeddfe7dc81341c1da5b18c88be8e8bf1b3b2ad677d4e347e41a555ef5e2d326616220315
7
+ data.tar.gz: 7e5d8c4caf8e4ca5b1ce475ddd9069499d14ed8d81bed007a8e2b861343ef755a63c2d038e9284ff3da7bbc6eff7378e09659cb88e64c8915b204c7693750667
data/README.md CHANGED
@@ -1,3 +1,12 @@
1
- # Notifiable::Mpns::Nverinaud
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(notification, device_token)
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(notification, device_token)
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)
@@ -1,7 +1,7 @@
1
1
  module Notifiable
2
2
  module Mpns
3
3
  module Nverinaud
4
- VERSION = "0.2.0"
4
+ VERSION = "0.3.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.4.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 an mpns notification with a title" do
10
- n = Notifiable::Notification.create(:payload => {:mpns => {:title => "A title"}})
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(:message => "A message")
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(:payload => {:mpns => {:params => {:an_object_id => 123456}}})
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 :payload
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.2.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-10 00:00:00.000000000 Z
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.4.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.4.0
26
+ version: 0.5.0
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: ruby-mpns
29
29
  requirement: !ruby/object:Gem::Requirement