meta_notification 0.0.2
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 +7 -0
- data/MIT-LICENSE +20 -0
- data/README.rdoc +3 -0
- data/Rakefile +35 -0
- data/app/assets/javascripts/meta_notification/application.js +13 -0
- data/app/assets/stylesheets/meta_notification/application.css +15 -0
- data/app/controllers/meta_notification/api/v1/notification_settings_controller.rb +24 -0
- data/app/controllers/meta_notification/api/v1/notification_templates_controller.rb +61 -0
- data/app/controllers/meta_notification/api/v1/notification_types_controller.rb +64 -0
- data/app/controllers/meta_notification/api/v1/notifications_controller.rb +22 -0
- data/app/controllers/meta_notification/api/v1/user_notification_settings_controller.rb +20 -0
- data/app/controllers/meta_notification/api/v1/user_notifications_controller.rb +75 -0
- data/app/controllers/meta_notification/application_controller.rb +4 -0
- data/app/helpers/meta_notification/application_helper.rb +4 -0
- data/app/models/meta_notification/notification.rb +12 -0
- data/app/models/meta_notification/notification_setting.rb +9 -0
- data/app/models/meta_notification/notification_template.rb +17 -0
- data/app/models/meta_notification/notification_type.rb +22 -0
- data/app/models/meta_notification/user_notification.rb +6 -0
- data/app/models/meta_notification/user_notification_setting.rb +10 -0
- data/app/views/layouts/meta_notification/application.html.erb +14 -0
- data/app/views/meta_notification/api/v1/notification_settings/create.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_settings/destroy.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_settings/index.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_settings/show.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_settings/update.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_templates/create.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_templates/destroy.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_templates/index.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_templates/show.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_templates/update.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_types/create.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_types/destroy.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_types/index.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_types/show.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notification_types/update.html.erb +2 -0
- data/app/views/meta_notification/api/v1/notifications/resource_notification.rabl +14 -0
- data/app/views/meta_notification/api/v1/user_notification_settings/create.html.erb +2 -0
- data/app/views/meta_notification/api/v1/user_notification_settings/destroy.html.erb +2 -0
- data/app/views/meta_notification/api/v1/user_notification_settings/index.html.erb +2 -0
- data/app/views/meta_notification/api/v1/user_notification_settings/show.html.erb +2 -0
- data/app/views/meta_notification/api/v1/user_notification_settings/update.html.erb +2 -0
- data/app/views/meta_notification/api/v1/user_notifications/message_notifications.rabl +0 -0
- data/app/views/meta_notification/api/v1/user_notifications/notifications.rabl +21 -0
- data/config/routes.rb +45 -0
- data/db/migrate/20160615074820_create_meta_notification_notification_types.rb +15 -0
- data/db/migrate/20160618094218_create_meta_notification_notification_templates.rb +19 -0
- data/db/migrate/20160619133533_create_meta_notification_notifications.rb +14 -0
- data/db/migrate/20160620015754_create_meta_notification_user_notifications.rb +12 -0
- data/db/migrate/20160620020944_create_meta_notification_notification_settings.rb +10 -0
- data/db/migrate/20160620052742_create_meta_notification_user_notification_settings.rb +12 -0
- data/db/migrate/20160727124414_add_attachment_attachment_to_mn_notifications.rb +11 -0
- data/lib/api_constraints.rb +10 -0
- data/lib/meta_notification/engine.rb +15 -0
- data/lib/meta_notification/version.rb +3 -0
- data/lib/meta_notification.rb +7 -0
- data/lib/meta_notification_authority.rb +39 -0
- data/lib/mn_authorizers/notification_setting_authorizer.rb +28 -0
- data/lib/mn_authorizers/notification_template_authorizer.rb +28 -0
- data/lib/mn_authorizers/notification_type_authorizer.rb +28 -0
- data/lib/mn_authorizers/test_authorizer.rb +11 -0
- data/lib/mn_authorizers/user_notification_authorizer.rb +28 -0
- data/lib/tasks/meta_notification_tasks.rake +4 -0
- data/spec/controllers/meta_notification/api/v1/notification_settings_controller_spec.rb +42 -0
- data/spec/controllers/meta_notification/api/v1/notification_templates_controller_spec.rb +42 -0
- data/spec/controllers/meta_notification/api/v1/notification_types_controller_spec.rb +42 -0
- data/spec/controllers/meta_notification/api/v1/notifications_controller_spec.rb +7 -0
- data/spec/controllers/meta_notification/api/v1/user_notification_settings_controller_spec.rb +42 -0
- data/spec/controllers/meta_notification/api/v1/user_notifications_controller_spec.rb +42 -0
- data/spec/dummy/README.rdoc +28 -0
- data/spec/dummy/Rakefile +6 -0
- data/spec/dummy/app/assets/javascripts/application.js +13 -0
- data/spec/dummy/app/assets/stylesheets/application.css +15 -0
- data/spec/dummy/app/controllers/application_controller.rb +5 -0
- data/spec/dummy/app/helpers/application_helper.rb +2 -0
- data/spec/dummy/app/views/layouts/application.html.erb +14 -0
- data/spec/dummy/bin/bundle +3 -0
- data/spec/dummy/bin/rails +4 -0
- data/spec/dummy/bin/rake +4 -0
- data/spec/dummy/bin/setup +29 -0
- data/spec/dummy/config/application.rb +33 -0
- data/spec/dummy/config/boot.rb +5 -0
- data/spec/dummy/config/database.yml +54 -0
- data/spec/dummy/config/environment.rb +5 -0
- data/spec/dummy/config/environments/development.rb +41 -0
- data/spec/dummy/config/environments/production.rb +79 -0
- data/spec/dummy/config/environments/test.rb +42 -0
- data/spec/dummy/config/initializers/assets.rb +11 -0
- data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
- data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
- data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
- data/spec/dummy/config/initializers/inflections.rb +16 -0
- data/spec/dummy/config/initializers/mime_types.rb +4 -0
- data/spec/dummy/config/initializers/session_store.rb +3 -0
- data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
- data/spec/dummy/config/locales/en.yml +23 -0
- data/spec/dummy/config/routes.rb +4 -0
- data/spec/dummy/config/secrets.yml +22 -0
- data/spec/dummy/config.ru +4 -0
- data/spec/dummy/db/schema.rb +91 -0
- data/spec/dummy/log/development.log +264 -0
- data/spec/dummy/log/test.log +1192 -0
- data/spec/dummy/public/404.html +67 -0
- data/spec/dummy/public/422.html +67 -0
- data/spec/dummy/public/500.html +66 -0
- data/spec/dummy/public/favicon.ico +0 -0
- data/spec/factories/meta_notification/notification_settings.rb +28 -0
- data/spec/factories/meta_notification/notification_templates.rb +59 -0
- data/spec/factories/meta_notification/notification_types.rb +35 -0
- data/spec/factories/meta_notification/notifications.rb +80 -0
- data/spec/factories/meta_notification/user_notification_settings.rb +34 -0
- data/spec/factories/meta_notification/user_notifications.rb +35 -0
- data/spec/models/meta_notification/notification_setting_spec.rb +31 -0
- data/spec/models/meta_notification/notification_spec.rb +39 -0
- data/spec/models/meta_notification/notification_template_spec.rb +37 -0
- data/spec/models/meta_notification/notification_type_spec.rb +36 -0
- data/spec/models/meta_notification/user_notification_setting_spec.rb +31 -0
- data/spec/models/meta_notification/user_notification_spec.rb +28 -0
- data/spec/rails_helper.rb +60 -0
- data/spec/spec_helper.rb +92 -0
- data/spec/views/meta_notification/api/v1/notification_settings/create.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_settings/destroy.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_settings/index.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_settings/show.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_settings/update.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_templates/create.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_templates/destroy.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_templates/index.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_templates/show.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_templates/update.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_types/create.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_types/destroy.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_types/index.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_types/show.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/notification_types/update.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/user_notification_settings/create.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/user_notification_settings/destroy.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/user_notification_settings/index.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/user_notification_settings/show.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/user_notification_settings/update.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/user_notifications/create.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/user_notifications/destroy.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/user_notifications/index.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/user_notifications/show.html.erb_spec.rb +5 -0
- data/spec/views/meta_notification/api/v1/user_notifications/update.html.erb_spec.rb +5 -0
- metadata +355 -0
data/config/routes.rb
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
require 'api_constraints'
|
|
2
|
+
|
|
3
|
+
MetaNotification::Engine.routes.draw do
|
|
4
|
+
namespace :api do
|
|
5
|
+
scope module: :v1, constraints: ApiConstraints.new(version: 1, default: true) do
|
|
6
|
+
resources :notification_types, path: 'types', except: [:new, :edit] do
|
|
7
|
+
resources :notification_templates, path: 'templates', except: [:new, :edit]
|
|
8
|
+
resources :notification_settings, path: 'settings', except: [:new, :edit, :create]
|
|
9
|
+
end
|
|
10
|
+
|
|
11
|
+
resources :users, except: [:new, :edit, :index, :show, :create, :update, :destroy] do
|
|
12
|
+
resources :user_notifications, only: [:index, :show, :update] do
|
|
13
|
+
member do
|
|
14
|
+
end
|
|
15
|
+
collection do
|
|
16
|
+
get 'notifications'
|
|
17
|
+
get 'mark_all_read'
|
|
18
|
+
end
|
|
19
|
+
end
|
|
20
|
+
end
|
|
21
|
+
|
|
22
|
+
resources :notifications, except: [:new, :edit, :index, :show, :create, :update, :destroy] do
|
|
23
|
+
collection do
|
|
24
|
+
get 'resource_notification'
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
|
|
28
|
+
# resources :user_notifications, only: [:index, :show, :update]
|
|
29
|
+
# get 'users/:user_id/notifications' => 'user_notitfications#show'
|
|
30
|
+
# put 'user_notifications/:id' => 'user_notitfications#update'
|
|
31
|
+
# get 'user_notifications' => 'user_notitfications#index'
|
|
32
|
+
# get 'user_notifications/:id' => 'user_notitfications#show'
|
|
33
|
+
|
|
34
|
+
# get 'user/:user_id/types/:notification_type_id/settings' => 'user_notitfications_settings#show'
|
|
35
|
+
|
|
36
|
+
# get 'notification_types/update'
|
|
37
|
+
# get 'notification_types/destroy'
|
|
38
|
+
# get 'types/index' => 'notification_types#index', :defaults => { :format => 'json' }
|
|
39
|
+
# get 'notification_types/show'
|
|
40
|
+
end
|
|
41
|
+
# scope module: :v2, constraints: ApiConstraints.new(version: 2, default: true) do
|
|
42
|
+
# resources :notification_types
|
|
43
|
+
# end
|
|
44
|
+
end
|
|
45
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
class CreateMetaNotificationNotificationTypes < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :mn_notification_types do |t|
|
|
4
|
+
t.string :name, null: false, unique: true, limit: 255
|
|
5
|
+
t.string :display_name, limit: 255
|
|
6
|
+
t.string :label, limit: 255
|
|
7
|
+
t.string :icon, limit: 255
|
|
8
|
+
t.text :description
|
|
9
|
+
t.references :created_by, null: false
|
|
10
|
+
t.references :updated_by, null: false
|
|
11
|
+
|
|
12
|
+
t.timestamps null: false
|
|
13
|
+
end
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
class CreateMetaNotificationNotificationTemplates < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :mn_notification_templates do |t|
|
|
4
|
+
t.references :notification_type, null: false
|
|
5
|
+
t.text :in_app
|
|
6
|
+
t.text :mobile
|
|
7
|
+
t.text :push
|
|
8
|
+
t.text :email
|
|
9
|
+
t.text :sms
|
|
10
|
+
t.text :email_subject
|
|
11
|
+
t.integer :resource_id
|
|
12
|
+
t.string :resource_type
|
|
13
|
+
|
|
14
|
+
t.timestamps null: false
|
|
15
|
+
end
|
|
16
|
+
add_index :mn_notification_templates, [:notification_type_id, :resource_type, :resource_id], unique: true, name: "unique_type_resource_index"
|
|
17
|
+
add_index :mn_notification_templates, [:resource_type, :resource_id], name: "resource_index"
|
|
18
|
+
end
|
|
19
|
+
end
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
class CreateMetaNotificationNotifications < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :mn_notifications do |t|
|
|
4
|
+
t.integer :notification_template_id, null: false, index: true
|
|
5
|
+
t.text :in_app, null: false
|
|
6
|
+
t.text :mobile, null: false
|
|
7
|
+
t.string :resource_type
|
|
8
|
+
t.integer :resource_id
|
|
9
|
+
t.references :created_by, index: true, null: false
|
|
10
|
+
|
|
11
|
+
t.timestamps null: false
|
|
12
|
+
end
|
|
13
|
+
end
|
|
14
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class CreateMetaNotificationUserNotifications < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :mn_user_notifications do |t|
|
|
4
|
+
t.integer :user_id, index: true, null: false
|
|
5
|
+
t.integer :notification_id, index: true, null: false
|
|
6
|
+
t.integer :notification_type_id, index: true, null: false
|
|
7
|
+
t.boolean :is_read, null: false
|
|
8
|
+
|
|
9
|
+
t.timestamps null: false
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
class CreateMetaNotificationNotificationSettings < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :mn_notification_settings do |t|
|
|
4
|
+
t.integer :notification_type_id, unique: true, foreign_key: true, null: false
|
|
5
|
+
t.boolean :is_mute, null: false, default: false
|
|
6
|
+
|
|
7
|
+
t.timestamps null: false
|
|
8
|
+
end
|
|
9
|
+
end
|
|
10
|
+
end
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
class CreateMetaNotificationUserNotificationSettings < ActiveRecord::Migration
|
|
2
|
+
def change
|
|
3
|
+
create_table :mn_user_notification_settings do |t|
|
|
4
|
+
t.integer :user_id, null: false
|
|
5
|
+
t.integer :notification_type_id, index: true, foreign_key: true, null: false
|
|
6
|
+
t.boolean :is_mute, null: false, default: false
|
|
7
|
+
|
|
8
|
+
t.timestamps null: false
|
|
9
|
+
end
|
|
10
|
+
add_index :mn_user_notification_settings, [:user_id, :notification_type_id], unique: true, name: "unique_user_notification_type_index"
|
|
11
|
+
end
|
|
12
|
+
end
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
module MetaNotification
|
|
2
|
+
class Engine < ::Rails::Engine
|
|
3
|
+
isolate_namespace MetaNotification
|
|
4
|
+
|
|
5
|
+
config.generators do |g|
|
|
6
|
+
g.test_framework :rspec, :fixture => false
|
|
7
|
+
g.fixture_replacement :factory_girl, :dir => 'spec/factories/meta_notification'
|
|
8
|
+
g.assets false
|
|
9
|
+
g.helper false
|
|
10
|
+
end
|
|
11
|
+
# config.autoload_paths << File.expand_path("../../lib/meta_notificaiton/authorizers", __FILE__)
|
|
12
|
+
config.autoload_paths += Dir["#{config.root}/lib/"]
|
|
13
|
+
config.autoload_paths += Dir["#{config.root}/lib/mn_authorizers/*"]
|
|
14
|
+
end
|
|
15
|
+
end
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
module MetaNotificationAuthority
|
|
2
|
+
def self.included(base)
|
|
3
|
+
base.before_filter :authorize
|
|
4
|
+
end
|
|
5
|
+
|
|
6
|
+
def authorize
|
|
7
|
+
# byebug
|
|
8
|
+
case @_action_name
|
|
9
|
+
when 'index', 'show'
|
|
10
|
+
# puts "R E A D"
|
|
11
|
+
# return if authorization success
|
|
12
|
+
return if true
|
|
13
|
+
# else render error
|
|
14
|
+
render_error
|
|
15
|
+
when 'create'
|
|
16
|
+
# puts "C R E A T E"
|
|
17
|
+
# return if authorization success
|
|
18
|
+
return if true
|
|
19
|
+
# else render error
|
|
20
|
+
render_error
|
|
21
|
+
when 'update'
|
|
22
|
+
# puts "U P D A T E"
|
|
23
|
+
# return if authorization success
|
|
24
|
+
return if true
|
|
25
|
+
# else render error
|
|
26
|
+
render_error
|
|
27
|
+
when 'delete'
|
|
28
|
+
# puts "D E L E T E"
|
|
29
|
+
# return if authorization success
|
|
30
|
+
return if true
|
|
31
|
+
# else render error
|
|
32
|
+
render_error
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
|
|
36
|
+
def render_error
|
|
37
|
+
render :json => {error: "You are not authorize."}, status: 422
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module MnAuthorizers
|
|
2
|
+
class NotificationSettingAuthorizer
|
|
3
|
+
def self.creatable?
|
|
4
|
+
true
|
|
5
|
+
end
|
|
6
|
+
def creatable?
|
|
7
|
+
true
|
|
8
|
+
end
|
|
9
|
+
def self.updatable?
|
|
10
|
+
true
|
|
11
|
+
end
|
|
12
|
+
def updatable?
|
|
13
|
+
true
|
|
14
|
+
end
|
|
15
|
+
def self.readable?
|
|
16
|
+
true
|
|
17
|
+
end
|
|
18
|
+
def readable?
|
|
19
|
+
true
|
|
20
|
+
end
|
|
21
|
+
def self.deletable?
|
|
22
|
+
true
|
|
23
|
+
end
|
|
24
|
+
def deletable?
|
|
25
|
+
true
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module MnAuthorizers
|
|
2
|
+
class NotificationTemplateAuthorizer
|
|
3
|
+
def self.creatable_by?(current_user)
|
|
4
|
+
true
|
|
5
|
+
end
|
|
6
|
+
def creatable_by?(current_user, resource=nil)
|
|
7
|
+
true
|
|
8
|
+
end
|
|
9
|
+
def self.updatable_by?(current_user)
|
|
10
|
+
true
|
|
11
|
+
end
|
|
12
|
+
def updatable_by?(current_user, resource=nil)
|
|
13
|
+
true
|
|
14
|
+
end
|
|
15
|
+
def self.readable_by?(current_user)
|
|
16
|
+
true
|
|
17
|
+
end
|
|
18
|
+
def readable_by?(current_user, resource=nil)
|
|
19
|
+
true
|
|
20
|
+
end
|
|
21
|
+
def self.deletable_by?(current_user)
|
|
22
|
+
true
|
|
23
|
+
end
|
|
24
|
+
def deletable_by?(current_user, resource=nil)
|
|
25
|
+
true
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module MnAuthorizers
|
|
2
|
+
class NotificationTypeAuthorizer
|
|
3
|
+
def self.creatable_by?(current_user)
|
|
4
|
+
"Class creatable"
|
|
5
|
+
end
|
|
6
|
+
def creatable_by?(current_user, resource=nil)
|
|
7
|
+
"instance creatable"
|
|
8
|
+
end
|
|
9
|
+
def self.updatable_by?(current_user)
|
|
10
|
+
true
|
|
11
|
+
end
|
|
12
|
+
def updatable_by?(current_user, resource=nil)
|
|
13
|
+
true
|
|
14
|
+
end
|
|
15
|
+
def self.readable_by?(current_user)
|
|
16
|
+
true
|
|
17
|
+
end
|
|
18
|
+
def readable_by?(current_user, resource=nil)
|
|
19
|
+
true
|
|
20
|
+
end
|
|
21
|
+
def self.deletable_by?(current_user)
|
|
22
|
+
true
|
|
23
|
+
end
|
|
24
|
+
def deletable_by?(current_user, resource=nil)
|
|
25
|
+
true
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
module MnAuthorizers
|
|
2
|
+
class UserNotificationAuthorizer
|
|
3
|
+
def self.creatable_by?(current_user)
|
|
4
|
+
true
|
|
5
|
+
end
|
|
6
|
+
def creatable_by?(current_user, resource=nil)
|
|
7
|
+
true
|
|
8
|
+
end
|
|
9
|
+
def self.updatable_by?(current_user)
|
|
10
|
+
true
|
|
11
|
+
end
|
|
12
|
+
def updatable_by?(current_user, resource=nil, user_id=nil)
|
|
13
|
+
true
|
|
14
|
+
end
|
|
15
|
+
def self.readable_by?(current_user, user_id=nil)
|
|
16
|
+
true
|
|
17
|
+
end
|
|
18
|
+
def readable_by?(current_user, resource=nil, user_id=nil)
|
|
19
|
+
true
|
|
20
|
+
end
|
|
21
|
+
def self.deletable_by?(current_user)
|
|
22
|
+
true
|
|
23
|
+
end
|
|
24
|
+
def deletable_by?(current_user, resource=nil)
|
|
25
|
+
true
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
module MetaNotification
|
|
4
|
+
RSpec.describe Api::V1::NotificationSettingsController, type: :controller do
|
|
5
|
+
|
|
6
|
+
describe "GET #index" do
|
|
7
|
+
it "returns http success" do
|
|
8
|
+
get :index
|
|
9
|
+
expect(response).to have_http_status(:success)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe "GET #show" do
|
|
14
|
+
it "returns http success" do
|
|
15
|
+
get :show
|
|
16
|
+
expect(response).to have_http_status(:success)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe "GET #create" do
|
|
21
|
+
it "returns http success" do
|
|
22
|
+
get :create
|
|
23
|
+
expect(response).to have_http_status(:success)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe "GET #update" do
|
|
28
|
+
it "returns http success" do
|
|
29
|
+
get :update
|
|
30
|
+
expect(response).to have_http_status(:success)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe "GET #destroy" do
|
|
35
|
+
it "returns http success" do
|
|
36
|
+
get :destroy
|
|
37
|
+
expect(response).to have_http_status(:success)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
module MetaNotification
|
|
4
|
+
RSpec.describe Api::V1::NotificationTemplatesController, type: :controller do
|
|
5
|
+
|
|
6
|
+
describe "GET #index" do
|
|
7
|
+
it "returns http success" do
|
|
8
|
+
get :index
|
|
9
|
+
expect(response).to have_http_status(:success)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe "GET #show" do
|
|
14
|
+
it "returns http success" do
|
|
15
|
+
get :show
|
|
16
|
+
expect(response).to have_http_status(:success)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe "GET #create" do
|
|
21
|
+
it "returns http success" do
|
|
22
|
+
get :create
|
|
23
|
+
expect(response).to have_http_status(:success)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe "GET #update" do
|
|
28
|
+
it "returns http success" do
|
|
29
|
+
get :update
|
|
30
|
+
expect(response).to have_http_status(:success)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe "GET #destroy" do
|
|
35
|
+
it "returns http success" do
|
|
36
|
+
get :destroy
|
|
37
|
+
expect(response).to have_http_status(:success)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
module MetaNotification
|
|
4
|
+
RSpec.describe Api::V1::NotificationTypesController, type: :controller do
|
|
5
|
+
|
|
6
|
+
describe "GET #create" do
|
|
7
|
+
it "returns http success" do
|
|
8
|
+
get :create
|
|
9
|
+
expect(response).to have_http_status(:success)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe "GET #update" do
|
|
14
|
+
it "returns http success" do
|
|
15
|
+
get :update
|
|
16
|
+
expect(response).to have_http_status(:success)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe "GET #destroy" do
|
|
21
|
+
it "returns http success" do
|
|
22
|
+
get :destroy
|
|
23
|
+
expect(response).to have_http_status(:success)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe "GET #index" do
|
|
28
|
+
it "returns http success" do
|
|
29
|
+
get :index
|
|
30
|
+
expect(response).to have_http_status(:success)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe "GET #show" do
|
|
35
|
+
it "returns http success" do
|
|
36
|
+
get :show
|
|
37
|
+
expect(response).to have_http_status(:success)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
module MetaNotification
|
|
4
|
+
RSpec.describe Api::V1::UserNotificationSettingsController, type: :controller do
|
|
5
|
+
|
|
6
|
+
describe "GET #index" do
|
|
7
|
+
it "returns http success" do
|
|
8
|
+
get :index
|
|
9
|
+
expect(response).to have_http_status(:success)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe "GET #show" do
|
|
14
|
+
it "returns http success" do
|
|
15
|
+
get :show
|
|
16
|
+
expect(response).to have_http_status(:success)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe "GET #create" do
|
|
21
|
+
it "returns http success" do
|
|
22
|
+
get :create
|
|
23
|
+
expect(response).to have_http_status(:success)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe "GET #update" do
|
|
28
|
+
it "returns http success" do
|
|
29
|
+
get :update
|
|
30
|
+
expect(response).to have_http_status(:success)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe "GET #destroy" do
|
|
35
|
+
it "returns http success" do
|
|
36
|
+
get :destroy
|
|
37
|
+
expect(response).to have_http_status(:success)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
require 'rails_helper'
|
|
2
|
+
|
|
3
|
+
module MetaNotification
|
|
4
|
+
RSpec.describe Api::V1::UserNotificationsController, type: :controller do
|
|
5
|
+
|
|
6
|
+
describe "GET #index" do
|
|
7
|
+
it "returns http success" do
|
|
8
|
+
get :index
|
|
9
|
+
expect(response).to have_http_status(:success)
|
|
10
|
+
end
|
|
11
|
+
end
|
|
12
|
+
|
|
13
|
+
describe "GET #show" do
|
|
14
|
+
it "returns http success" do
|
|
15
|
+
get :show
|
|
16
|
+
expect(response).to have_http_status(:success)
|
|
17
|
+
end
|
|
18
|
+
end
|
|
19
|
+
|
|
20
|
+
describe "GET #create" do
|
|
21
|
+
it "returns http success" do
|
|
22
|
+
get :create
|
|
23
|
+
expect(response).to have_http_status(:success)
|
|
24
|
+
end
|
|
25
|
+
end
|
|
26
|
+
|
|
27
|
+
describe "GET #update" do
|
|
28
|
+
it "returns http success" do
|
|
29
|
+
get :update
|
|
30
|
+
expect(response).to have_http_status(:success)
|
|
31
|
+
end
|
|
32
|
+
end
|
|
33
|
+
|
|
34
|
+
describe "GET #destroy" do
|
|
35
|
+
it "returns http success" do
|
|
36
|
+
get :destroy
|
|
37
|
+
expect(response).to have_http_status(:success)
|
|
38
|
+
end
|
|
39
|
+
end
|
|
40
|
+
|
|
41
|
+
end
|
|
42
|
+
end
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
== README
|
|
2
|
+
|
|
3
|
+
This README would normally document whatever steps are necessary to get the
|
|
4
|
+
application up and running.
|
|
5
|
+
|
|
6
|
+
Things you may want to cover:
|
|
7
|
+
|
|
8
|
+
* Ruby version
|
|
9
|
+
|
|
10
|
+
* System dependencies
|
|
11
|
+
|
|
12
|
+
* Configuration
|
|
13
|
+
|
|
14
|
+
* Database creation
|
|
15
|
+
|
|
16
|
+
* Database initialization
|
|
17
|
+
|
|
18
|
+
* How to run the test suite
|
|
19
|
+
|
|
20
|
+
* Services (job queues, cache servers, search engines, etc.)
|
|
21
|
+
|
|
22
|
+
* Deployment instructions
|
|
23
|
+
|
|
24
|
+
* ...
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
Please feel free to use a different markup language if you do not plan to run
|
|
28
|
+
<tt>rake doc:app</tt>.
|
data/spec/dummy/Rakefile
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
// This is a manifest file that'll be compiled into application.js, which will include all the files
|
|
2
|
+
// listed below.
|
|
3
|
+
//
|
|
4
|
+
// Any JavaScript/Coffee file within this directory, lib/assets/javascripts, vendor/assets/javascripts,
|
|
5
|
+
// or any plugin's vendor/assets/javascripts directory can be referenced here using a relative path.
|
|
6
|
+
//
|
|
7
|
+
// It's not advisable to add code directly here, but if you do, it'll appear at the bottom of the
|
|
8
|
+
// compiled file.
|
|
9
|
+
//
|
|
10
|
+
// Read Sprockets README (https://github.com/rails/sprockets#sprockets-directives) for details
|
|
11
|
+
// about supported directives.
|
|
12
|
+
//
|
|
13
|
+
//= require_tree .
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This is a manifest file that'll be compiled into application.css, which will include all the files
|
|
3
|
+
* listed below.
|
|
4
|
+
*
|
|
5
|
+
* Any CSS and SCSS file within this directory, lib/assets/stylesheets, vendor/assets/stylesheets,
|
|
6
|
+
* or any plugin's vendor/assets/stylesheets directory can be referenced here using a relative path.
|
|
7
|
+
*
|
|
8
|
+
* You're free to add application-wide styles to this file and they'll appear at the bottom of the
|
|
9
|
+
* compiled file so the styles you add here take precedence over styles defined in any styles
|
|
10
|
+
* defined in the other CSS/SCSS files in this directory. It is generally better to create a new
|
|
11
|
+
* file per style scope.
|
|
12
|
+
*
|
|
13
|
+
*= require_tree .
|
|
14
|
+
*= require_self
|
|
15
|
+
*/
|