notifiable-rails 0.4.0 → 0.5.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6b4955923e80912ffec3e18234d87fb942380a8b
4
- data.tar.gz: c4b3b65c9c917b88f35705118a65988eca07327a
3
+ metadata.gz: 39b16fa6a22178fc28e5ce367b72f065ebaba804
4
+ data.tar.gz: 67bd6e6fbe7c05b79b5af04bb810abe78c9f9f54
5
5
  SHA512:
6
- metadata.gz: 72aab818f6684b44bb6f3a32745f09746391a357209495e34744f44dbaf8051586583134ecbbb08ea62ef23278ca648020d6c1c845b129dfb0bb1e4c43779ece
7
- data.tar.gz: cf21d9790ee894059d9cf6dc384864e491bed33ffee9a39347ad93c04dd5ca2aa061500998b9363b8caca32d51a17281ca3d64aa06b25a1700c576e1aabcc2fd
6
+ metadata.gz: f7e405b314ead10453aae774684a9fef411adcc9736e57198135cc4f84b0a5e6db66aa5b1e38fdc1d8694ef9a0b1af70045ba0707e9e8a44e629e6871f78f79d
7
+ data.tar.gz: 1df7aa3df2289fa1f58624c6d5bfcc9e1919de6a99b92a32927eb048bcf4c10fc3b7a8e9b61758fbea85dfc6b167a3e73eac341a8d669eacdb013c719843cce6
@@ -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
@@ -1,16 +1,8 @@
1
1
  module Notifiable
2
2
  class Notification < ActiveRecord::Base
3
3
 
4
- serialize :payload
4
+ serialize :params
5
5
 
6
6
  has_many :notification_device_tokens, :class_name => 'Notifiable::NotificationDeviceToken'
7
-
8
- def provider_value(provider, key)
9
- if self.payload && self.payload[provider] && self.payload[provider][key]
10
- self.payload[provider][key]
11
- elsif self.respond_to? key
12
- self.send(key)
13
- end
14
- end
15
7
  end
16
8
  end
@@ -1,3 +1,3 @@
1
1
  module Notifiable
2
- VERSION = "0.4.0"
2
+ VERSION = "0.5.0"
3
3
  end
@@ -16,11 +16,11 @@ describe Notifiable do
16
16
 
17
17
  all_notifications = Notifiable::NotificationDeviceToken.all
18
18
  first_notification_token = all_notifications[0]
19
- first_notification_token.notification.provider_value(:mock, :message).should eql "First test message"
19
+ first_notification_token.notification.message.should eql "First test message"
20
20
  first_notification_token.device_token.should eql user1.device_tokens[0]
21
21
 
22
22
  second_notification_token = all_notifications[1]
23
- second_notification_token.notification.provider_value(:mock, :message).should eql "First test message"
23
+ second_notification_token.notification.message.should eql "First test message"
24
24
  second_notification_token.device_token.should eql user2.device_tokens[0]
25
25
  end
26
26
 
@@ -34,11 +34,11 @@ describe Notifiable do
34
34
 
35
35
  all_notifications = Notifiable::NotificationDeviceToken.all
36
36
  first_notification_token = all_notifications[0]
37
- first_notification_token.notification.provider_value(:mock, :message).should eql "First test message"
37
+ first_notification_token.notification.message.should eql "First test message"
38
38
  first_notification_token.device_token.should eql user1.device_tokens[0]
39
39
 
40
40
  second_notification_token = all_notifications[1]
41
- second_notification_token.notification.provider_value(:mock, :message).should eql "Second test message"
41
+ second_notification_token.notification.message.should eql "Second test message"
42
42
  second_notification_token.device_token.should eql user2.device_tokens[0]
43
43
  end
44
44
 
@@ -3,21 +3,15 @@ require 'spec_helper'
3
3
  describe Notifiable::Notification do
4
4
 
5
5
  it "stores a message" do
6
- Notifiable::Notification.create :message => "Test message"
6
+ Notifiable::Notification.create(:message => "Test message")
7
7
 
8
- Notifiable::Notification.first.provider_value(:mock, :message).should eql "Test message"
8
+ Notifiable::Notification.first.message.should eql "Test message"
9
9
  end
10
10
 
11
- it "overrides a message" do
12
- Notifiable::Notification.create :message => "Test message", :payload => {:mock => {:message => "A different message"}}
11
+ it "stores params" do
12
+ Notifiable::Notification.create :params => {:custom_property => "A different message"}
13
13
 
14
- Notifiable::Notification.first.provider_value(:mock, :message).should eql "A different message"
15
- end
16
-
17
- it "returns nil for a property that doesnt exist" do
18
- Notifiable::Notification.create :message => "Test message"
19
-
20
- Notifiable::Notification.first.provider_value(:mock, :sound).should be_nil
14
+ Notifiable::Notification.first.params.should == {:custom_property => "A different message"}
21
15
  end
22
16
 
23
17
  end
@@ -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
@@ -35,8 +35,12 @@ ActiveRecord::Schema.define(version: 20131229104039) do
35
35
  end
36
36
 
37
37
  create_table "notifiable_notifications", force: true do |t|
38
+ t.text "title"
38
39
  t.text "message"
39
- t.text "payload"
40
+ t.text "params"
41
+ t.integer "badge"
42
+ t.text "sound"
43
+ t.datetime "expiry"
40
44
  t.datetime "created_at"
41
45
  t.datetime "updated_at"
42
46
  end
Binary file