meta_notification 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (146) hide show
  1. checksums.yaml +7 -0
  2. data/MIT-LICENSE +20 -0
  3. data/README.rdoc +3 -0
  4. data/Rakefile +35 -0
  5. data/app/assets/javascripts/meta_notification/application.js +13 -0
  6. data/app/assets/stylesheets/meta_notification/application.css +15 -0
  7. data/app/controllers/meta_notification/api/v1/notification_settings_controller.rb +24 -0
  8. data/app/controllers/meta_notification/api/v1/notification_templates_controller.rb +61 -0
  9. data/app/controllers/meta_notification/api/v1/notification_types_controller.rb +64 -0
  10. data/app/controllers/meta_notification/api/v1/notifications_controller.rb +22 -0
  11. data/app/controllers/meta_notification/api/v1/user_notification_settings_controller.rb +20 -0
  12. data/app/controllers/meta_notification/api/v1/user_notifications_controller.rb +75 -0
  13. data/app/controllers/meta_notification/application_controller.rb +4 -0
  14. data/app/helpers/meta_notification/application_helper.rb +4 -0
  15. data/app/models/meta_notification/notification.rb +12 -0
  16. data/app/models/meta_notification/notification_setting.rb +9 -0
  17. data/app/models/meta_notification/notification_template.rb +17 -0
  18. data/app/models/meta_notification/notification_type.rb +22 -0
  19. data/app/models/meta_notification/user_notification.rb +6 -0
  20. data/app/models/meta_notification/user_notification_setting.rb +10 -0
  21. data/app/views/layouts/meta_notification/application.html.erb +14 -0
  22. data/app/views/meta_notification/api/v1/notification_settings/create.html.erb +2 -0
  23. data/app/views/meta_notification/api/v1/notification_settings/destroy.html.erb +2 -0
  24. data/app/views/meta_notification/api/v1/notification_settings/index.html.erb +2 -0
  25. data/app/views/meta_notification/api/v1/notification_settings/show.html.erb +2 -0
  26. data/app/views/meta_notification/api/v1/notification_settings/update.html.erb +2 -0
  27. data/app/views/meta_notification/api/v1/notification_templates/create.html.erb +2 -0
  28. data/app/views/meta_notification/api/v1/notification_templates/destroy.html.erb +2 -0
  29. data/app/views/meta_notification/api/v1/notification_templates/index.html.erb +2 -0
  30. data/app/views/meta_notification/api/v1/notification_templates/show.html.erb +2 -0
  31. data/app/views/meta_notification/api/v1/notification_templates/update.html.erb +2 -0
  32. data/app/views/meta_notification/api/v1/notification_types/create.html.erb +2 -0
  33. data/app/views/meta_notification/api/v1/notification_types/destroy.html.erb +2 -0
  34. data/app/views/meta_notification/api/v1/notification_types/index.html.erb +2 -0
  35. data/app/views/meta_notification/api/v1/notification_types/show.html.erb +2 -0
  36. data/app/views/meta_notification/api/v1/notification_types/update.html.erb +2 -0
  37. data/app/views/meta_notification/api/v1/notifications/resource_notification.rabl +14 -0
  38. data/app/views/meta_notification/api/v1/user_notification_settings/create.html.erb +2 -0
  39. data/app/views/meta_notification/api/v1/user_notification_settings/destroy.html.erb +2 -0
  40. data/app/views/meta_notification/api/v1/user_notification_settings/index.html.erb +2 -0
  41. data/app/views/meta_notification/api/v1/user_notification_settings/show.html.erb +2 -0
  42. data/app/views/meta_notification/api/v1/user_notification_settings/update.html.erb +2 -0
  43. data/app/views/meta_notification/api/v1/user_notifications/message_notifications.rabl +0 -0
  44. data/app/views/meta_notification/api/v1/user_notifications/notifications.rabl +21 -0
  45. data/config/routes.rb +45 -0
  46. data/db/migrate/20160615074820_create_meta_notification_notification_types.rb +15 -0
  47. data/db/migrate/20160618094218_create_meta_notification_notification_templates.rb +19 -0
  48. data/db/migrate/20160619133533_create_meta_notification_notifications.rb +14 -0
  49. data/db/migrate/20160620015754_create_meta_notification_user_notifications.rb +12 -0
  50. data/db/migrate/20160620020944_create_meta_notification_notification_settings.rb +10 -0
  51. data/db/migrate/20160620052742_create_meta_notification_user_notification_settings.rb +12 -0
  52. data/db/migrate/20160727124414_add_attachment_attachment_to_mn_notifications.rb +11 -0
  53. data/lib/api_constraints.rb +10 -0
  54. data/lib/meta_notification/engine.rb +15 -0
  55. data/lib/meta_notification/version.rb +3 -0
  56. data/lib/meta_notification.rb +7 -0
  57. data/lib/meta_notification_authority.rb +39 -0
  58. data/lib/mn_authorizers/notification_setting_authorizer.rb +28 -0
  59. data/lib/mn_authorizers/notification_template_authorizer.rb +28 -0
  60. data/lib/mn_authorizers/notification_type_authorizer.rb +28 -0
  61. data/lib/mn_authorizers/test_authorizer.rb +11 -0
  62. data/lib/mn_authorizers/user_notification_authorizer.rb +28 -0
  63. data/lib/tasks/meta_notification_tasks.rake +4 -0
  64. data/spec/controllers/meta_notification/api/v1/notification_settings_controller_spec.rb +42 -0
  65. data/spec/controllers/meta_notification/api/v1/notification_templates_controller_spec.rb +42 -0
  66. data/spec/controllers/meta_notification/api/v1/notification_types_controller_spec.rb +42 -0
  67. data/spec/controllers/meta_notification/api/v1/notifications_controller_spec.rb +7 -0
  68. data/spec/controllers/meta_notification/api/v1/user_notification_settings_controller_spec.rb +42 -0
  69. data/spec/controllers/meta_notification/api/v1/user_notifications_controller_spec.rb +42 -0
  70. data/spec/dummy/README.rdoc +28 -0
  71. data/spec/dummy/Rakefile +6 -0
  72. data/spec/dummy/app/assets/javascripts/application.js +13 -0
  73. data/spec/dummy/app/assets/stylesheets/application.css +15 -0
  74. data/spec/dummy/app/controllers/application_controller.rb +5 -0
  75. data/spec/dummy/app/helpers/application_helper.rb +2 -0
  76. data/spec/dummy/app/views/layouts/application.html.erb +14 -0
  77. data/spec/dummy/bin/bundle +3 -0
  78. data/spec/dummy/bin/rails +4 -0
  79. data/spec/dummy/bin/rake +4 -0
  80. data/spec/dummy/bin/setup +29 -0
  81. data/spec/dummy/config/application.rb +33 -0
  82. data/spec/dummy/config/boot.rb +5 -0
  83. data/spec/dummy/config/database.yml +54 -0
  84. data/spec/dummy/config/environment.rb +5 -0
  85. data/spec/dummy/config/environments/development.rb +41 -0
  86. data/spec/dummy/config/environments/production.rb +79 -0
  87. data/spec/dummy/config/environments/test.rb +42 -0
  88. data/spec/dummy/config/initializers/assets.rb +11 -0
  89. data/spec/dummy/config/initializers/backtrace_silencers.rb +7 -0
  90. data/spec/dummy/config/initializers/cookies_serializer.rb +3 -0
  91. data/spec/dummy/config/initializers/filter_parameter_logging.rb +4 -0
  92. data/spec/dummy/config/initializers/inflections.rb +16 -0
  93. data/spec/dummy/config/initializers/mime_types.rb +4 -0
  94. data/spec/dummy/config/initializers/session_store.rb +3 -0
  95. data/spec/dummy/config/initializers/wrap_parameters.rb +14 -0
  96. data/spec/dummy/config/locales/en.yml +23 -0
  97. data/spec/dummy/config/routes.rb +4 -0
  98. data/spec/dummy/config/secrets.yml +22 -0
  99. data/spec/dummy/config.ru +4 -0
  100. data/spec/dummy/db/schema.rb +91 -0
  101. data/spec/dummy/log/development.log +264 -0
  102. data/spec/dummy/log/test.log +1192 -0
  103. data/spec/dummy/public/404.html +67 -0
  104. data/spec/dummy/public/422.html +67 -0
  105. data/spec/dummy/public/500.html +66 -0
  106. data/spec/dummy/public/favicon.ico +0 -0
  107. data/spec/factories/meta_notification/notification_settings.rb +28 -0
  108. data/spec/factories/meta_notification/notification_templates.rb +59 -0
  109. data/spec/factories/meta_notification/notification_types.rb +35 -0
  110. data/spec/factories/meta_notification/notifications.rb +80 -0
  111. data/spec/factories/meta_notification/user_notification_settings.rb +34 -0
  112. data/spec/factories/meta_notification/user_notifications.rb +35 -0
  113. data/spec/models/meta_notification/notification_setting_spec.rb +31 -0
  114. data/spec/models/meta_notification/notification_spec.rb +39 -0
  115. data/spec/models/meta_notification/notification_template_spec.rb +37 -0
  116. data/spec/models/meta_notification/notification_type_spec.rb +36 -0
  117. data/spec/models/meta_notification/user_notification_setting_spec.rb +31 -0
  118. data/spec/models/meta_notification/user_notification_spec.rb +28 -0
  119. data/spec/rails_helper.rb +60 -0
  120. data/spec/spec_helper.rb +92 -0
  121. data/spec/views/meta_notification/api/v1/notification_settings/create.html.erb_spec.rb +5 -0
  122. data/spec/views/meta_notification/api/v1/notification_settings/destroy.html.erb_spec.rb +5 -0
  123. data/spec/views/meta_notification/api/v1/notification_settings/index.html.erb_spec.rb +5 -0
  124. data/spec/views/meta_notification/api/v1/notification_settings/show.html.erb_spec.rb +5 -0
  125. data/spec/views/meta_notification/api/v1/notification_settings/update.html.erb_spec.rb +5 -0
  126. data/spec/views/meta_notification/api/v1/notification_templates/create.html.erb_spec.rb +5 -0
  127. data/spec/views/meta_notification/api/v1/notification_templates/destroy.html.erb_spec.rb +5 -0
  128. data/spec/views/meta_notification/api/v1/notification_templates/index.html.erb_spec.rb +5 -0
  129. data/spec/views/meta_notification/api/v1/notification_templates/show.html.erb_spec.rb +5 -0
  130. data/spec/views/meta_notification/api/v1/notification_templates/update.html.erb_spec.rb +5 -0
  131. data/spec/views/meta_notification/api/v1/notification_types/create.html.erb_spec.rb +5 -0
  132. data/spec/views/meta_notification/api/v1/notification_types/destroy.html.erb_spec.rb +5 -0
  133. data/spec/views/meta_notification/api/v1/notification_types/index.html.erb_spec.rb +5 -0
  134. data/spec/views/meta_notification/api/v1/notification_types/show.html.erb_spec.rb +5 -0
  135. data/spec/views/meta_notification/api/v1/notification_types/update.html.erb_spec.rb +5 -0
  136. data/spec/views/meta_notification/api/v1/user_notification_settings/create.html.erb_spec.rb +5 -0
  137. data/spec/views/meta_notification/api/v1/user_notification_settings/destroy.html.erb_spec.rb +5 -0
  138. data/spec/views/meta_notification/api/v1/user_notification_settings/index.html.erb_spec.rb +5 -0
  139. data/spec/views/meta_notification/api/v1/user_notification_settings/show.html.erb_spec.rb +5 -0
  140. data/spec/views/meta_notification/api/v1/user_notification_settings/update.html.erb_spec.rb +5 -0
  141. data/spec/views/meta_notification/api/v1/user_notifications/create.html.erb_spec.rb +5 -0
  142. data/spec/views/meta_notification/api/v1/user_notifications/destroy.html.erb_spec.rb +5 -0
  143. data/spec/views/meta_notification/api/v1/user_notifications/index.html.erb_spec.rb +5 -0
  144. data/spec/views/meta_notification/api/v1/user_notifications/show.html.erb_spec.rb +5 -0
  145. data/spec/views/meta_notification/api/v1/user_notifications/update.html.erb_spec.rb +5 -0
  146. 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,11 @@
1
+ class AddAttachmentAttachmentToMnNotifications < ActiveRecord::Migration
2
+ def self.up
3
+ change_table :mn_notifications do |t|
4
+ t.attachment :attachment
5
+ end
6
+ end
7
+
8
+ def self.down
9
+ remove_attachment :mn_notifications, :attachment
10
+ end
11
+ end
@@ -0,0 +1,10 @@
1
+ class ApiConstraints
2
+ def initialize(options)
3
+ @version = options[:version]
4
+ @default = options[:default]
5
+ end
6
+
7
+ def matches?(req)
8
+ @default || req.headers['Accept'].include?("application/meta_notification.v#{@version}")
9
+ end
10
+ 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,3 @@
1
+ module MetaNotification
2
+ VERSION = "0.0.2"
3
+ end
@@ -0,0 +1,7 @@
1
+ require "meta_notification/engine"
2
+
3
+ module MetaNotification
4
+ def self.table_name_prefix
5
+ "mn_"
6
+ end
7
+ 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,11 @@
1
+ module MnAuthorizers
2
+ class TestAuthorizer
3
+ def self.for_create
4
+ 'Create Authorizer in Engine. '
5
+ end
6
+
7
+ def test_method
8
+ 'instance method in engine. '
9
+ end
10
+ end
11
+ 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,4 @@
1
+ # desc "Explaining what the task does"
2
+ # task :meta_notification do
3
+ # # Task goes here
4
+ # 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,7 @@
1
+ require 'rails_helper'
2
+
3
+ module MetaNotification
4
+ RSpec.describe MetaNotification::Api::V1::NotificationsController, type: :controller do
5
+
6
+ end
7
+ 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>.
@@ -0,0 +1,6 @@
1
+ # Add your own tasks in files placed in lib/tasks ending in .rake,
2
+ # for example lib/tasks/capistrano.rake, and they will automatically be available to Rake.
3
+
4
+ require File.expand_path('../config/application', __FILE__)
5
+
6
+ Rails.application.load_tasks
@@ -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
+ */
@@ -0,0 +1,5 @@
1
+ class ApplicationController < ActionController::Base
2
+ # Prevent CSRF attacks by raising an exception.
3
+ # For APIs, you may want to use :null_session instead.
4
+ protect_from_forgery with: :exception
5
+ end
@@ -0,0 +1,2 @@
1
+ module ApplicationHelper
2
+ end