notifiable-core 0.2.3 → 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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 9056aaabe8cf5a4320058e83b7653887d248d7bbe16d6e27615d448d11c0096e
4
- data.tar.gz: cb16692c30b41e7ca0be966167b9d6dee075418d410b647ea1efc60392df9f65
3
+ metadata.gz: dc264a823b7db2c6695c7305f3e08d624e8322af0068eb51e99b644d338f4c03
4
+ data.tar.gz: 533da0880836e645ce9aa271c4f14655b613a4a0c87276d4f2953cc0a57f5804
5
5
  SHA512:
6
- metadata.gz: 883ec9596867c2b14479a49bf35770252364d924477ecedb90215df434c856b2ff4f393feb648d5d65198cc2555f30749cb707986da0df602c5ea72e9bd3322b
7
- data.tar.gz: 8f73f02e2e78e8bb769c7ce17e6d899f7c305d62775124a8e49b72e924fb5412c025f4d1e6b7aafa212ddcbc94f045bb2ee88ae4f88148f4c54da812e14ce635
6
+ metadata.gz: 4835e97b843fbca60ca893fac781b1e918106ee45599ddb91b819161cffaba76bb2e9814c9ebfe7a4f02b9aaae8baa28235f8c428484783f98cb4fa15afe714c
7
+ data.tar.gz: d0483a18867092ac8f4c0f70767684c3cbec4cf1e37160946a94e7f80a792de14962cd435b9706a6e27cf0abe2f3326c8e878ee145462439bf88a8fde6f7b8e8
@@ -0,0 +1,8 @@
1
+ class CreateNotifiableUsers < ActiveRecord::Migration[4.2]
2
+ def change
3
+ create_table :notifiable_users do |t|
4
+ t.string :alias
5
+ t.timestamps
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,5 @@
1
+ class AddUserIdToNotifiableDeviceTokens < ActiveRecord::Migration[4.2]
2
+ def change
3
+ add_column :notifiable_device_tokens, :user_id, :integer
4
+ end
5
+ end
data/lib/notifiable.rb CHANGED
@@ -8,6 +8,7 @@ require 'notifiable/notification'
8
8
  require 'notifiable/notification_status'
9
9
  require 'notifiable/device_token'
10
10
  require 'notifiable/notifier_base'
11
+ require 'notifiable/user'
11
12
 
12
13
  module Notifiable
13
14
  mattr_accessor :delivery_method
@@ -1,10 +1,9 @@
1
- # frozen_string_literal: true
2
-
3
1
  module Notifiable
4
2
  class DeviceToken < ActiveRecord::Base
5
3
  self.table_name_prefix = 'notifiable_'
6
4
 
7
5
  belongs_to :app, class_name: 'Notifiable::App'
6
+ belongs_to :user, class_name: 'Notifiable::User', optional: true
8
7
  has_many :notification_statuses, class_name: 'Notifiable::NotificationStatus'
9
8
 
10
9
  validates :token, presence: true, uniqueness: { scope: :app }
@@ -0,0 +1,7 @@
1
+ module Notifiable
2
+ class User < ActiveRecord::Base
3
+ self.table_name_prefix = 'notifiable_'
4
+
5
+ has_many :device_tokens, class_name: 'Notifiable::DeviceToken'
6
+ end
7
+ end
@@ -1,3 +1,3 @@
1
1
  module Notifiable
2
- VERSION = '0.2.3'.freeze
2
+ VERSION = '0.3.0'.freeze
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: notifiable-core
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matt Brooke-Smith
@@ -218,6 +218,8 @@ files:
218
218
  - db/migrate/201808272135000_add_status_to_notifications.rb
219
219
  - db/migrate/201809032135000_add_error_code_to_notification_statuses.rb
220
220
  - db/migrate/201809032235000_add_delivered_count_to_notifications.rb
221
+ - db/migrate/201810082235000_create_notifiable_users.rb
222
+ - db/migrate/201810082235001_add_user_id_to_notifiable_device_tokens.rb
221
223
  - lib/notifiable.rb
222
224
  - lib/notifiable/app.rb
223
225
  - lib/notifiable/device_token.rb
@@ -225,6 +227,7 @@ files:
225
227
  - lib/notifiable/notification.rb
226
228
  - lib/notifiable/notification_status.rb
227
229
  - lib/notifiable/notifier_base.rb
230
+ - lib/notifiable/user.rb
228
231
  - lib/notifiable/version.rb
229
232
  - lib/tasks/db.rake
230
233
  homepage: https://github.com/FutureWorkshops/notifiable