activity_notification 2.0.0 → 2.1.4
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 +4 -4
- data/.github/ISSUE_TEMPLATE/bug_report.md +22 -0
- data/.github/ISSUE_TEMPLATE/feature_request.md +17 -0
- data/.github/pull_request_template.md +13 -0
- data/.gitignore +10 -3
- data/.travis.yml +6 -5
- data/CHANGELOG.md +60 -0
- data/Gemfile +8 -3
- data/Procfile +1 -1
- data/README.md +153 -1510
- data/activity_notification.gemspec +4 -1
- data/app/channels/activity_notification/notification_api_channel.rb +12 -0
- data/app/channels/activity_notification/notification_api_with_devise_channel.rb +46 -0
- data/app/channels/activity_notification/notification_channel.rb +2 -2
- data/app/channels/activity_notification/notification_with_devise_channel.rb +2 -2
- data/app/controllers/activity_notification/apidocs_controller.rb +75 -0
- data/app/controllers/activity_notification/notifications_api_controller.rb +143 -0
- data/app/controllers/activity_notification/notifications_api_with_devise_controller.rb +7 -0
- data/app/controllers/activity_notification/notifications_controller.rb +79 -53
- data/app/controllers/activity_notification/subscriptions_api_controller.rb +197 -0
- data/app/controllers/activity_notification/subscriptions_api_with_devise_controller.rb +7 -0
- data/app/controllers/activity_notification/subscriptions_controller.rb +78 -69
- data/app/views/activity_notification/notifications/default/_default.html.erb +18 -18
- data/app/views/activity_notification/notifications/default/_default_without_grouping.html.erb +14 -14
- data/app/views/activity_notification/notifications/default/index.html.erb +6 -6
- data/app/views/activity_notification/optional_targets/default/action_cable_channel/_default.html.erb +176 -0
- data/app/views/activity_notification/subscriptions/default/_form.html.erb +1 -1
- data/app/views/activity_notification/subscriptions/default/_notification_keys.html.erb +3 -31
- data/app/views/activity_notification/subscriptions/default/_subscription.html.erb +7 -7
- data/app/views/activity_notification/subscriptions/default/index.html.erb +11 -7
- data/bin/deploy_on_heroku.sh +3 -1
- data/docs/CODE_OF_CONDUCT.md +76 -0
- data/docs/CONTRIBUTING.md +36 -0
- data/docs/Functions.md +1130 -0
- data/docs/Setup.md +801 -0
- data/docs/Testing.md +148 -0
- data/gemfiles/Gemfile.rails-4.2 +5 -1
- data/gemfiles/Gemfile.rails-5.0 +6 -1
- data/gemfiles/Gemfile.rails-5.1 +6 -1
- data/gemfiles/Gemfile.rails-5.2 +6 -1
- data/gemfiles/{Gemfile.rails-6.0.rc → Gemfile.rails-6.0} +6 -5
- data/lib/activity_notification.rb +13 -0
- data/lib/activity_notification/apis/notification_api.rb +37 -93
- data/lib/activity_notification/apis/subscription_api.rb +20 -8
- data/lib/activity_notification/apis/swagger.rb +6 -0
- data/lib/activity_notification/common.rb +4 -1
- data/lib/activity_notification/config.rb +41 -21
- data/lib/activity_notification/controllers/common_api_controller.rb +30 -0
- data/lib/activity_notification/controllers/common_controller.rb +45 -21
- data/lib/activity_notification/controllers/concerns/swagger/error_responses.rb +55 -0
- data/lib/activity_notification/controllers/concerns/swagger/notifications_api.rb +273 -0
- data/lib/activity_notification/controllers/concerns/swagger/notifications_parameters.rb +92 -0
- data/lib/activity_notification/controllers/concerns/swagger/subscriptions_api.rb +405 -0
- data/lib/activity_notification/controllers/concerns/swagger/subscriptions_parameters.rb +50 -0
- data/lib/activity_notification/controllers/devise_authentication_controller.rb +7 -6
- data/lib/activity_notification/gem_version.rb +14 -0
- data/lib/activity_notification/helpers/errors.rb +2 -0
- data/lib/activity_notification/helpers/view_helpers.rb +4 -0
- data/lib/activity_notification/mailers/helpers.rb +17 -10
- data/lib/activity_notification/models/concerns/notifiable.rb +31 -15
- data/lib/activity_notification/models/concerns/subscriber.rb +12 -1
- data/lib/activity_notification/models/concerns/swagger/error_schema.rb +36 -0
- data/lib/activity_notification/models/concerns/swagger/notification_schema.rb +209 -0
- data/lib/activity_notification/models/concerns/swagger/subscription_schema.rb +162 -0
- data/lib/activity_notification/models/concerns/target.rb +36 -10
- data/lib/activity_notification/models/notification.rb +1 -0
- data/lib/activity_notification/models/subscription.rb +1 -0
- data/lib/activity_notification/optional_targets/action_cable_api_channel.rb +69 -0
- data/lib/activity_notification/optional_targets/action_cable_channel.rb +68 -0
- data/lib/activity_notification/optional_targets/base.rb +7 -13
- data/lib/activity_notification/orm/active_record/notification.rb +17 -1
- data/lib/activity_notification/orm/active_record/subscription.rb +1 -1
- data/lib/activity_notification/orm/dynamoid.rb +38 -3
- data/lib/activity_notification/orm/dynamoid/extension.rb +79 -1
- data/lib/activity_notification/orm/dynamoid/notification.rb +49 -14
- data/lib/activity_notification/orm/dynamoid/subscription.rb +2 -2
- data/lib/activity_notification/orm/mongoid.rb +32 -3
- data/lib/activity_notification/orm/mongoid/notification.rb +24 -6
- data/lib/activity_notification/orm/mongoid/subscription.rb +1 -1
- data/lib/activity_notification/rails/routes.rb +132 -48
- data/lib/activity_notification/renderable.rb +13 -2
- data/lib/activity_notification/roles/acts_as_notifiable.rb +39 -20
- data/lib/activity_notification/version.rb +1 -1
- data/lib/generators/activity_notification/controllers_generator.rb +2 -1
- data/lib/generators/templates/activity_notification.rb +8 -0
- data/lib/generators/templates/controllers/notifications_api_controller.rb +31 -0
- data/lib/generators/templates/controllers/notifications_api_with_devise_controller.rb +31 -0
- data/lib/generators/templates/controllers/notifications_controller.rb +1 -37
- data/lib/generators/templates/controllers/notifications_with_devise_controller.rb +1 -45
- data/lib/generators/templates/controllers/subscriptions_api_controller.rb +61 -0
- data/lib/generators/templates/controllers/subscriptions_api_with_devise_controller.rb +61 -0
- data/lib/generators/templates/controllers/subscriptions_controller.rb +14 -37
- data/lib/generators/templates/controllers/subscriptions_with_devise_controller.rb +14 -45
- data/lib/generators/templates/models/README +8 -4
- data/lib/generators/templates/models/notification.rb +1 -1
- data/lib/generators/templates/models/subscription.rb +1 -1
- data/package.json +8 -0
- data/spec/channels/notification_api_channel_shared_examples.rb +59 -0
- data/spec/channels/notification_api_channel_spec.rb +51 -0
- data/spec/channels/notification_api_with_devise_channel_spec.rb +78 -0
- data/spec/concerns/apis/notification_api_spec.rb +38 -3
- data/spec/concerns/models/notifiable_spec.rb +82 -18
- data/spec/concerns/models/subscriber_spec.rb +13 -16
- data/spec/concerns/models/target_spec.rb +32 -0
- data/spec/concerns/renderable_spec.rb +2 -2
- data/spec/config_spec.rb +26 -15
- data/spec/controllers/controller_spec_utility.rb +136 -0
- data/spec/controllers/notifications_api_controller_shared_examples.rb +506 -0
- data/spec/controllers/notifications_api_controller_spec.rb +19 -0
- data/spec/controllers/notifications_api_with_devise_controller_spec.rb +60 -0
- data/spec/controllers/notifications_controller_shared_examples.rb +54 -79
- data/spec/controllers/notifications_controller_spec.rb +1 -2
- data/spec/controllers/notifications_with_devise_controller_spec.rb +3 -12
- data/spec/controllers/subscriptions_api_controller_shared_examples.rb +750 -0
- data/spec/controllers/subscriptions_api_controller_spec.rb +19 -0
- data/spec/controllers/subscriptions_api_with_devise_controller_spec.rb +60 -0
- data/spec/controllers/subscriptions_controller_shared_examples.rb +94 -121
- data/spec/controllers/subscriptions_controller_spec.rb +1 -2
- data/spec/controllers/subscriptions_with_devise_controller_spec.rb +3 -12
- data/spec/helpers/view_helpers_spec.rb +4 -11
- data/spec/mailers/mailer_spec.rb +41 -0
- data/spec/models/notification_spec.rb +17 -0
- data/spec/models/subscription_spec.rb +8 -13
- data/spec/optional_targets/action_cable_api_channel_spec.rb +37 -0
- data/spec/optional_targets/action_cable_channel_spec.rb +44 -0
- data/spec/optional_targets/amazon_sns_spec.rb +0 -2
- data/spec/optional_targets/slack_spec.rb +0 -2
- data/spec/rails_app/Rakefile +9 -0
- data/spec/rails_app/app/assets/config/manifest.js +3 -0
- data/spec/rails_app/app/assets/images/.keep +0 -0
- data/spec/rails_app/app/controllers/admins_controller.rb +21 -0
- data/spec/rails_app/app/controllers/application_controller.rb +1 -1
- data/spec/rails_app/app/controllers/articles_controller.rb +6 -3
- data/spec/rails_app/app/controllers/spa_controller.rb +7 -0
- data/spec/rails_app/app/controllers/users/notifications_controller.rb +0 -65
- data/spec/rails_app/app/controllers/users/notifications_with_devise_controller.rb +0 -73
- data/spec/rails_app/app/controllers/users/subscriptions_controller.rb +0 -77
- data/spec/rails_app/app/controllers/users/subscriptions_with_devise_controller.rb +0 -85
- data/spec/rails_app/app/controllers/users_controller.rb +26 -0
- data/spec/rails_app/app/javascript/App.vue +40 -0
- data/spec/rails_app/app/javascript/components/DeviseTokenAuth.vue +82 -0
- data/spec/rails_app/app/javascript/components/Top.vue +98 -0
- data/spec/rails_app/app/javascript/components/notifications/Index.vue +200 -0
- data/spec/rails_app/app/javascript/components/notifications/Notification.vue +133 -0
- data/spec/rails_app/app/javascript/components/notifications/NotificationContent.vue +122 -0
- data/spec/rails_app/app/javascript/components/subscriptions/Index.vue +279 -0
- data/spec/rails_app/app/javascript/components/subscriptions/NewSubscription.vue +112 -0
- data/spec/rails_app/app/javascript/components/subscriptions/NotificationKey.vue +141 -0
- data/spec/rails_app/app/javascript/components/subscriptions/Subscription.vue +226 -0
- data/spec/rails_app/app/javascript/config/development.js +5 -0
- data/spec/rails_app/app/javascript/config/environment.js +7 -0
- data/spec/rails_app/app/javascript/config/production.js +5 -0
- data/spec/rails_app/app/javascript/config/test.js +5 -0
- data/spec/rails_app/app/javascript/packs/application.js +18 -0
- data/spec/rails_app/app/javascript/packs/spa.js +14 -0
- data/spec/rails_app/app/javascript/router/index.js +73 -0
- data/spec/rails_app/app/javascript/store/index.js +37 -0
- data/spec/rails_app/app/models/admin.rb +16 -15
- data/spec/rails_app/app/models/article.rb +26 -21
- data/spec/rails_app/app/models/comment.rb +24 -71
- data/spec/rails_app/app/models/dummy/dummy_group.rb +8 -0
- data/spec/rails_app/app/models/dummy/dummy_notifiable_target.rb +8 -0
- data/spec/rails_app/app/models/user.rb +44 -20
- data/spec/rails_app/app/views/activity_notification/notifications/default/article/_update.html.erb +146 -0
- data/spec/rails_app/app/views/articles/index.html.erb +51 -7
- data/spec/rails_app/app/views/articles/show.html.erb +1 -1
- data/spec/rails_app/app/views/layouts/_header.html.erb +8 -10
- data/spec/rails_app/app/views/spa/index.html.erb +2 -0
- data/spec/rails_app/babel.config.js +72 -0
- data/spec/rails_app/bin/webpack +18 -0
- data/spec/rails_app/bin/webpack-dev-server +18 -0
- data/spec/rails_app/config/application.rb +18 -2
- data/spec/rails_app/config/dynamoid.rb +11 -3
- data/spec/rails_app/config/environment.rb +2 -1
- data/spec/rails_app/config/environments/development.rb +5 -0
- data/spec/rails_app/config/environments/production.rb +6 -0
- data/spec/rails_app/config/environments/test.rb +5 -0
- data/spec/rails_app/config/initializers/activity_notification.rb +11 -3
- data/spec/rails_app/config/initializers/copy_it.aws.rb.template +6 -0
- data/spec/rails_app/config/initializers/devise_token_auth.rb +55 -0
- data/spec/rails_app/config/initializers/mysql.rb +9 -0
- data/spec/rails_app/config/locales/activity_notification.en.yml +2 -2
- data/spec/rails_app/config/routes.rb +37 -1
- data/spec/rails_app/config/webpack/development.js +5 -0
- data/spec/rails_app/config/webpack/environment.js +7 -0
- data/spec/rails_app/config/webpack/loaders/vue.js +6 -0
- data/spec/rails_app/config/webpack/production.js +5 -0
- data/spec/rails_app/config/webpack/test.js +5 -0
- data/spec/rails_app/config/webpacker.yml +97 -0
- data/spec/rails_app/db/migrate/20191201000000_add_tokens_to_users.rb +10 -0
- data/spec/rails_app/db/schema.rb +4 -1
- data/spec/rails_app/db/seeds.rb +10 -2
- data/spec/rails_app/lib/custom_optional_targets/raise_error.rb +14 -0
- data/spec/rails_app/package.json +23 -0
- data/spec/rails_app/postcss.config.js +12 -0
- data/spec/roles/acts_as_group_spec.rb +0 -2
- data/spec/roles/acts_as_notifiable_spec.rb +6 -8
- data/spec/roles/acts_as_notifier_spec.rb +0 -2
- data/spec/roles/acts_as_target_spec.rb +0 -4
- data/spec/spec_helper.rb +7 -15
- data/spec/version_spec.rb +31 -0
- metadata +191 -13
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
module ActivityNotification
|
|
2
|
+
module Swagger::NotificationsParameters #:nodoc:
|
|
3
|
+
module TargetParameters #:nodoc:
|
|
4
|
+
def self.extended(base)
|
|
5
|
+
base.parameter do
|
|
6
|
+
key :name, :target_type
|
|
7
|
+
key :in, :path
|
|
8
|
+
key :description, "Target type of notifications: e.g. 'users'"
|
|
9
|
+
key :required, true
|
|
10
|
+
key :type, :string
|
|
11
|
+
key :example, "users"
|
|
12
|
+
end
|
|
13
|
+
base.parameter do
|
|
14
|
+
key :name, :target_id
|
|
15
|
+
key :in, :path
|
|
16
|
+
key :description, "Target ID of notifications. This parameter type is integer with ActiveRecord, but will be string with Mongoid or Dynamoid ORMs."
|
|
17
|
+
key :required, true
|
|
18
|
+
key :type, :string
|
|
19
|
+
key :example, 1
|
|
20
|
+
end
|
|
21
|
+
end
|
|
22
|
+
end
|
|
23
|
+
|
|
24
|
+
module IdParameter #:nodoc:
|
|
25
|
+
def self.extended(base)
|
|
26
|
+
base.parameter do
|
|
27
|
+
key :name, :id
|
|
28
|
+
key :in, :path
|
|
29
|
+
key :description, 'ID of notification record. This parameter type is integer with ActiveRecord, but will be string with Mongoid or Dynamoid ORMs.'
|
|
30
|
+
key :required, true
|
|
31
|
+
key :type, :string
|
|
32
|
+
key :example, 123
|
|
33
|
+
end
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
|
|
37
|
+
module FilterByParameters #:nodoc:
|
|
38
|
+
def self.extended(base)
|
|
39
|
+
base.parameter do
|
|
40
|
+
key :name, :filtered_by_type
|
|
41
|
+
key :in, :query
|
|
42
|
+
key :description, "Notifiable type to filter notification index: e.g. 'Comment'"
|
|
43
|
+
key :required, false
|
|
44
|
+
key :type, :string
|
|
45
|
+
key :example, "Comment"
|
|
46
|
+
end
|
|
47
|
+
base.parameter do
|
|
48
|
+
key :name, :filtered_by_group_type
|
|
49
|
+
key :in, :query
|
|
50
|
+
key :description, "Group type to filter notification index, valid with 'filtered_by_group_id': e.g. 'Article'"
|
|
51
|
+
key :required, false
|
|
52
|
+
key :type, :string
|
|
53
|
+
key :example, "Article"
|
|
54
|
+
end
|
|
55
|
+
base.parameter do
|
|
56
|
+
key :name, :filtered_by_group_id
|
|
57
|
+
key :in, :query
|
|
58
|
+
key :description, "Group instance ID to filter notification index, valid with 'filtered_by_group_type'"
|
|
59
|
+
key :required, false
|
|
60
|
+
key :type, :string
|
|
61
|
+
key :example, 2
|
|
62
|
+
end
|
|
63
|
+
base.parameter do
|
|
64
|
+
key :name, :filtered_by_key
|
|
65
|
+
key :in, :query
|
|
66
|
+
key :description, "Key of notifications to filter notification index: e.g. 'comment.default'"
|
|
67
|
+
key :required, false
|
|
68
|
+
key :type, :string
|
|
69
|
+
key :example, "comment.default"
|
|
70
|
+
end
|
|
71
|
+
base.parameter do
|
|
72
|
+
key :name, :later_than
|
|
73
|
+
key :in, :query
|
|
74
|
+
key :description, "ISO 8601 format time to filter notification index later than specified time"
|
|
75
|
+
key :required, false
|
|
76
|
+
key :type, :string
|
|
77
|
+
key :format, :'date-time'
|
|
78
|
+
key :example, Time.current.ago(10.years).iso8601(3)
|
|
79
|
+
end
|
|
80
|
+
base.parameter do
|
|
81
|
+
key :name, :earlier_than
|
|
82
|
+
key :in, :query
|
|
83
|
+
key :description, "ISO 8601 format time to filter notification index earlier than specified time"
|
|
84
|
+
key :required, false
|
|
85
|
+
key :type, :string
|
|
86
|
+
key :format, :'date-time'
|
|
87
|
+
key :example, Time.current.since(10.years).iso8601(3)
|
|
88
|
+
end
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
end
|
|
@@ -0,0 +1,405 @@
|
|
|
1
|
+
module ActivityNotification
|
|
2
|
+
module Swagger::SubscriptionsApi #:nodoc:
|
|
3
|
+
extend ActiveSupport::Concern
|
|
4
|
+
include ::Swagger::Blocks
|
|
5
|
+
|
|
6
|
+
included do
|
|
7
|
+
include Swagger::ErrorSchema
|
|
8
|
+
|
|
9
|
+
swagger_path '/{target_type}/{target_id}/subscriptions' do
|
|
10
|
+
operation :get do
|
|
11
|
+
key :summary, 'Get subscriptions'
|
|
12
|
+
key :description, 'Returns subscription index of the target.'
|
|
13
|
+
key :operationId, 'getSubscriptions'
|
|
14
|
+
key :tags, ['subscriptions']
|
|
15
|
+
|
|
16
|
+
extend Swagger::SubscriptionsParameters::TargetParameters
|
|
17
|
+
parameter do
|
|
18
|
+
key :name, :filter
|
|
19
|
+
key :in, :query
|
|
20
|
+
key :description, "Filter option to load subscription index by their configuration status"
|
|
21
|
+
key :required, false
|
|
22
|
+
key :type, :string
|
|
23
|
+
key :enum, ['all', 'configured', 'unconfigured']
|
|
24
|
+
key :default, 'all'
|
|
25
|
+
end
|
|
26
|
+
parameter do
|
|
27
|
+
key :name, :limit
|
|
28
|
+
key :in, :query
|
|
29
|
+
key :description, "Maximum number of subscriptions to return"
|
|
30
|
+
key :required, false
|
|
31
|
+
key :type, :integer
|
|
32
|
+
end
|
|
33
|
+
parameter do
|
|
34
|
+
key :name, :reverse
|
|
35
|
+
key :in, :query
|
|
36
|
+
key :description, "Whether subscription index and unconfigured notification keys will be ordered as earliest first"
|
|
37
|
+
key :required, false
|
|
38
|
+
key :type, :boolean
|
|
39
|
+
key :default, false
|
|
40
|
+
end
|
|
41
|
+
extend Swagger::SubscriptionsParameters::FilterByParameters
|
|
42
|
+
|
|
43
|
+
response 200 do
|
|
44
|
+
key :description, "Subscription index of the target"
|
|
45
|
+
content 'application/json' do
|
|
46
|
+
schema do
|
|
47
|
+
key :type, :object
|
|
48
|
+
property :configured_count do
|
|
49
|
+
key :type, :integer
|
|
50
|
+
key :description, "Number of configured subscription records"
|
|
51
|
+
key :example, 1
|
|
52
|
+
end
|
|
53
|
+
property :subscriptions do
|
|
54
|
+
key :type, :array
|
|
55
|
+
items do
|
|
56
|
+
key :'$ref', :Subscription
|
|
57
|
+
end
|
|
58
|
+
key :description, "Subscription index, which means array of configured subscriptions of the target"
|
|
59
|
+
end
|
|
60
|
+
property :unconfigured_count do
|
|
61
|
+
key :type, :integer
|
|
62
|
+
key :description, "Number of unconfigured notification keys"
|
|
63
|
+
key :example, 1
|
|
64
|
+
end
|
|
65
|
+
property :unconfigured_notification_keys do
|
|
66
|
+
key :type, :array
|
|
67
|
+
items do
|
|
68
|
+
key :type, :string
|
|
69
|
+
key :example, "article.default"
|
|
70
|
+
end
|
|
71
|
+
key :description, "Unconfigured notification keys, which means array of configured notification keys of the target to configure subscriptions"
|
|
72
|
+
end
|
|
73
|
+
end
|
|
74
|
+
end
|
|
75
|
+
end
|
|
76
|
+
extend Swagger::ErrorResponses::InvalidParameterError
|
|
77
|
+
end
|
|
78
|
+
|
|
79
|
+
operation :post do
|
|
80
|
+
key :summary, 'Create subscription'
|
|
81
|
+
key :description, 'Creates new subscription.'
|
|
82
|
+
key :operationId, 'createSubscription'
|
|
83
|
+
key :tags, ['subscriptions']
|
|
84
|
+
|
|
85
|
+
extend Swagger::SubscriptionsParameters::TargetParameters
|
|
86
|
+
parameter do
|
|
87
|
+
key :name, :subscription
|
|
88
|
+
key :in, :body
|
|
89
|
+
key :description, 'Subscription parameters'
|
|
90
|
+
key :required, true
|
|
91
|
+
schema do
|
|
92
|
+
key :'$ref', :SubscriptionInput
|
|
93
|
+
end
|
|
94
|
+
end
|
|
95
|
+
|
|
96
|
+
response 201 do
|
|
97
|
+
key :description, "Created subscription"
|
|
98
|
+
content 'application/json' do
|
|
99
|
+
schema do
|
|
100
|
+
key :'$ref', :Subscription
|
|
101
|
+
end
|
|
102
|
+
end
|
|
103
|
+
end
|
|
104
|
+
extend Swagger::ErrorResponses::InvalidParameterError
|
|
105
|
+
extend Swagger::ErrorResponses::ResourceNotFoundError
|
|
106
|
+
extend Swagger::ErrorResponses::UnprocessableEntityError
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
swagger_path '/{target_type}/{target_id}/subscriptions/find' do
|
|
111
|
+
operation :get do
|
|
112
|
+
key :summary, 'Find subscription'
|
|
113
|
+
key :description, 'Find and returns a single subscription.'
|
|
114
|
+
key :operationId, 'findSubscription'
|
|
115
|
+
key :tags, ['subscriptions']
|
|
116
|
+
|
|
117
|
+
extend Swagger::SubscriptionsParameters::TargetParameters
|
|
118
|
+
parameter do
|
|
119
|
+
key :name, :key
|
|
120
|
+
key :in, :query
|
|
121
|
+
key :description, "Key of the subscription to find"
|
|
122
|
+
key :required, true
|
|
123
|
+
key :type, :string
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
response 200 do
|
|
127
|
+
key :description, "Found single subscription"
|
|
128
|
+
content 'application/json' do
|
|
129
|
+
schema do
|
|
130
|
+
key :'$ref', :Subscription
|
|
131
|
+
end
|
|
132
|
+
end
|
|
133
|
+
end
|
|
134
|
+
extend Swagger::ErrorResponses::InvalidParameterError
|
|
135
|
+
extend Swagger::ErrorResponses::ResourceNotFoundError
|
|
136
|
+
end
|
|
137
|
+
end
|
|
138
|
+
|
|
139
|
+
swagger_path '/{target_type}/{target_id}/subscriptions/optional_target_names' do
|
|
140
|
+
operation :get do
|
|
141
|
+
key :summary, 'Find configured optional_target names'
|
|
142
|
+
key :description, 'Finds and returns configured optional_target names from specified key.'
|
|
143
|
+
key :operationId, 'findOptionalTargetNames'
|
|
144
|
+
key :tags, ['subscriptions']
|
|
145
|
+
|
|
146
|
+
extend Swagger::SubscriptionsParameters::TargetParameters
|
|
147
|
+
parameter do
|
|
148
|
+
key :name, :key
|
|
149
|
+
key :in, :query
|
|
150
|
+
key :description, "Key of the notification and subscription to find"
|
|
151
|
+
key :required, true
|
|
152
|
+
key :type, :string
|
|
153
|
+
end
|
|
154
|
+
|
|
155
|
+
response 200 do
|
|
156
|
+
key :description, "Found configured optional_target names"
|
|
157
|
+
content 'application/json' do
|
|
158
|
+
schema do
|
|
159
|
+
key :type, :object
|
|
160
|
+
property :configured_count do
|
|
161
|
+
key :type, :integer
|
|
162
|
+
key :description, "Number of configured optional_target names"
|
|
163
|
+
key :example, 1
|
|
164
|
+
end
|
|
165
|
+
property :optional_target_names do
|
|
166
|
+
key :type, :array
|
|
167
|
+
items do
|
|
168
|
+
key :type, :string
|
|
169
|
+
key :example, "action_cable_channel"
|
|
170
|
+
end
|
|
171
|
+
key :description, "Configured optional_target names"
|
|
172
|
+
end
|
|
173
|
+
end
|
|
174
|
+
end
|
|
175
|
+
end
|
|
176
|
+
extend Swagger::ErrorResponses::InvalidParameterError
|
|
177
|
+
extend Swagger::ErrorResponses::ResourceNotFoundError
|
|
178
|
+
end
|
|
179
|
+
end
|
|
180
|
+
|
|
181
|
+
swagger_path '/{target_type}/{target_id}/subscriptions/{id}' do
|
|
182
|
+
operation :get do
|
|
183
|
+
key :summary, 'Get subscription'
|
|
184
|
+
key :description, 'Returns a single subscription.'
|
|
185
|
+
key :operationId, 'getSubscription'
|
|
186
|
+
key :tags, ['subscriptions']
|
|
187
|
+
|
|
188
|
+
extend Swagger::SubscriptionsParameters::TargetParameters
|
|
189
|
+
extend Swagger::SubscriptionsParameters::IdParameter
|
|
190
|
+
|
|
191
|
+
response 200 do
|
|
192
|
+
key :description, "Found single subscription"
|
|
193
|
+
content 'application/json' do
|
|
194
|
+
schema do
|
|
195
|
+
key :'$ref', :Subscription
|
|
196
|
+
end
|
|
197
|
+
end
|
|
198
|
+
end
|
|
199
|
+
extend Swagger::ErrorResponses::InvalidParameterError
|
|
200
|
+
extend Swagger::ErrorResponses::ForbiddenError
|
|
201
|
+
extend Swagger::ErrorResponses::ResourceNotFoundError
|
|
202
|
+
end
|
|
203
|
+
|
|
204
|
+
operation :delete do
|
|
205
|
+
key :summary, 'Delete subscription'
|
|
206
|
+
key :description, 'Deletes a subscription.'
|
|
207
|
+
key :operationId, 'deleteSubscription'
|
|
208
|
+
key :tags, ['subscriptions']
|
|
209
|
+
|
|
210
|
+
extend Swagger::SubscriptionsParameters::TargetParameters
|
|
211
|
+
extend Swagger::SubscriptionsParameters::IdParameter
|
|
212
|
+
|
|
213
|
+
response 204 do
|
|
214
|
+
key :description, "No content as successfully deleted"
|
|
215
|
+
end
|
|
216
|
+
extend Swagger::ErrorResponses::InvalidParameterError
|
|
217
|
+
extend Swagger::ErrorResponses::ForbiddenError
|
|
218
|
+
extend Swagger::ErrorResponses::ResourceNotFoundError
|
|
219
|
+
end
|
|
220
|
+
end
|
|
221
|
+
|
|
222
|
+
swagger_path '/{target_type}/{target_id}/subscriptions/{id}/subscribe' do
|
|
223
|
+
operation :put do
|
|
224
|
+
key :summary, 'Subscribe to notifications'
|
|
225
|
+
key :description, 'Updates a subscription to subscribe to the notifications.'
|
|
226
|
+
key :operationId, 'subscribeNotifications'
|
|
227
|
+
key :tags, ['subscriptions']
|
|
228
|
+
|
|
229
|
+
extend Swagger::SubscriptionsParameters::TargetParameters
|
|
230
|
+
extend Swagger::SubscriptionsParameters::IdParameter
|
|
231
|
+
parameter do
|
|
232
|
+
key :name, :with_email_subscription
|
|
233
|
+
key :in, :query
|
|
234
|
+
key :description, "Whether the subscriber (target) also subscribes notification email"
|
|
235
|
+
key :required, false
|
|
236
|
+
key :type, :boolean
|
|
237
|
+
key :default, true
|
|
238
|
+
end
|
|
239
|
+
parameter do
|
|
240
|
+
key :name, :with_optional_targets
|
|
241
|
+
key :in, :query
|
|
242
|
+
key :description, "Whether the subscriber (target) also subscribes optional targets"
|
|
243
|
+
key :required, false
|
|
244
|
+
key :type, :boolean
|
|
245
|
+
key :default, true
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
response 200 do
|
|
249
|
+
key :description, "Updated subscription"
|
|
250
|
+
content 'application/json' do
|
|
251
|
+
schema do
|
|
252
|
+
key :'$ref', :Subscription
|
|
253
|
+
end
|
|
254
|
+
end
|
|
255
|
+
end
|
|
256
|
+
extend Swagger::ErrorResponses::InvalidParameterError
|
|
257
|
+
extend Swagger::ErrorResponses::ForbiddenError
|
|
258
|
+
extend Swagger::ErrorResponses::ResourceNotFoundError
|
|
259
|
+
extend Swagger::ErrorResponses::UnprocessableEntityError
|
|
260
|
+
end
|
|
261
|
+
end
|
|
262
|
+
|
|
263
|
+
swagger_path '/{target_type}/{target_id}/subscriptions/{id}/unsubscribe' do
|
|
264
|
+
operation :put do
|
|
265
|
+
key :summary, 'Unsubscribe to notifications'
|
|
266
|
+
key :description, 'Updates a subscription to unsubscribe to the notifications.'
|
|
267
|
+
key :operationId, 'unsubscribeNotifications'
|
|
268
|
+
key :tags, ['subscriptions']
|
|
269
|
+
|
|
270
|
+
extend Swagger::SubscriptionsParameters::TargetParameters
|
|
271
|
+
extend Swagger::SubscriptionsParameters::IdParameter
|
|
272
|
+
|
|
273
|
+
response 200 do
|
|
274
|
+
key :description, "Updated subscription"
|
|
275
|
+
content 'application/json' do
|
|
276
|
+
schema do
|
|
277
|
+
key :'$ref', :Subscription
|
|
278
|
+
end
|
|
279
|
+
end
|
|
280
|
+
end
|
|
281
|
+
extend Swagger::ErrorResponses::InvalidParameterError
|
|
282
|
+
extend Swagger::ErrorResponses::ForbiddenError
|
|
283
|
+
extend Swagger::ErrorResponses::ResourceNotFoundError
|
|
284
|
+
extend Swagger::ErrorResponses::UnprocessableEntityError
|
|
285
|
+
end
|
|
286
|
+
end
|
|
287
|
+
|
|
288
|
+
swagger_path '/{target_type}/{target_id}/subscriptions/{id}/subscribe_to_email' do
|
|
289
|
+
operation :put do
|
|
290
|
+
key :summary, 'Subscribe to notification email'
|
|
291
|
+
key :description, 'Updates a subscription to subscribe to the notification email.'
|
|
292
|
+
key :operationId, 'subscribeNotificationEmail'
|
|
293
|
+
key :tags, ['subscriptions']
|
|
294
|
+
|
|
295
|
+
extend Swagger::SubscriptionsParameters::TargetParameters
|
|
296
|
+
extend Swagger::SubscriptionsParameters::IdParameter
|
|
297
|
+
|
|
298
|
+
response 200 do
|
|
299
|
+
key :description, "Updated subscription"
|
|
300
|
+
content 'application/json' do
|
|
301
|
+
schema do
|
|
302
|
+
key :'$ref', :Subscription
|
|
303
|
+
end
|
|
304
|
+
end
|
|
305
|
+
end
|
|
306
|
+
extend Swagger::ErrorResponses::InvalidParameterError
|
|
307
|
+
extend Swagger::ErrorResponses::ForbiddenError
|
|
308
|
+
extend Swagger::ErrorResponses::ResourceNotFoundError
|
|
309
|
+
extend Swagger::ErrorResponses::UnprocessableEntityError
|
|
310
|
+
end
|
|
311
|
+
end
|
|
312
|
+
|
|
313
|
+
swagger_path '/{target_type}/{target_id}/subscriptions/{id}/unsubscribe_to_email' do
|
|
314
|
+
operation :put do
|
|
315
|
+
key :summary, 'Unsubscribe to notification email'
|
|
316
|
+
key :description, 'Updates a subscription to unsubscribe to the notification email.'
|
|
317
|
+
key :operationId, 'unsubscribeNotificationEmail'
|
|
318
|
+
key :tags, ['subscriptions']
|
|
319
|
+
|
|
320
|
+
extend Swagger::SubscriptionsParameters::TargetParameters
|
|
321
|
+
extend Swagger::SubscriptionsParameters::IdParameter
|
|
322
|
+
|
|
323
|
+
response 200 do
|
|
324
|
+
key :description, "Updated subscription"
|
|
325
|
+
content 'application/json' do
|
|
326
|
+
schema do
|
|
327
|
+
key :'$ref', :Subscription
|
|
328
|
+
end
|
|
329
|
+
end
|
|
330
|
+
end
|
|
331
|
+
extend Swagger::ErrorResponses::InvalidParameterError
|
|
332
|
+
extend Swagger::ErrorResponses::ForbiddenError
|
|
333
|
+
extend Swagger::ErrorResponses::ResourceNotFoundError
|
|
334
|
+
extend Swagger::ErrorResponses::UnprocessableEntityError
|
|
335
|
+
end
|
|
336
|
+
end
|
|
337
|
+
|
|
338
|
+
swagger_path '/{target_type}/{target_id}/subscriptions/{id}/subscribe_to_optional_target' do
|
|
339
|
+
operation :put do
|
|
340
|
+
key :summary, 'Subscribe to optional target'
|
|
341
|
+
key :description, 'Updates a subscription to subscribe to the specified optional target.'
|
|
342
|
+
key :operationId, 'subscribeOptionalTarget'
|
|
343
|
+
key :tags, ['subscriptions']
|
|
344
|
+
|
|
345
|
+
extend Swagger::SubscriptionsParameters::TargetParameters
|
|
346
|
+
extend Swagger::SubscriptionsParameters::IdParameter
|
|
347
|
+
parameter do
|
|
348
|
+
key :name, :optional_target_name
|
|
349
|
+
key :in, :query
|
|
350
|
+
key :description, "Class name of the optional target implementation: e.g. 'amazon_sns', 'slack' and so on"
|
|
351
|
+
key :required, true
|
|
352
|
+
key :type, :string
|
|
353
|
+
key :example, "slack"
|
|
354
|
+
end
|
|
355
|
+
|
|
356
|
+
response 200 do
|
|
357
|
+
key :description, "Updated subscription"
|
|
358
|
+
content 'application/json' do
|
|
359
|
+
schema do
|
|
360
|
+
key :'$ref', :Subscription
|
|
361
|
+
end
|
|
362
|
+
end
|
|
363
|
+
end
|
|
364
|
+
extend Swagger::ErrorResponses::InvalidParameterError
|
|
365
|
+
extend Swagger::ErrorResponses::ForbiddenError
|
|
366
|
+
extend Swagger::ErrorResponses::ResourceNotFoundError
|
|
367
|
+
extend Swagger::ErrorResponses::UnprocessableEntityError
|
|
368
|
+
end
|
|
369
|
+
end
|
|
370
|
+
|
|
371
|
+
swagger_path '/{target_type}/{target_id}/subscriptions/{id}/unsubscribe_to_optional_target' do
|
|
372
|
+
operation :put do
|
|
373
|
+
key :summary, 'Unsubscribe to optional target'
|
|
374
|
+
key :description, 'Updates a subscription to unsubscribe to the specified optional target.'
|
|
375
|
+
key :operationId, 'unsubscribeOptionalTarget'
|
|
376
|
+
key :tags, ['subscriptions']
|
|
377
|
+
|
|
378
|
+
extend Swagger::SubscriptionsParameters::TargetParameters
|
|
379
|
+
extend Swagger::SubscriptionsParameters::IdParameter
|
|
380
|
+
parameter do
|
|
381
|
+
key :name, :optional_target_name
|
|
382
|
+
key :in, :query
|
|
383
|
+
key :description, "Class name of the optional target implementation: e.g. 'amazon_sns', 'slack' and so on"
|
|
384
|
+
key :required, true
|
|
385
|
+
key :type, :string
|
|
386
|
+
key :example, "slack"
|
|
387
|
+
end
|
|
388
|
+
|
|
389
|
+
response 200 do
|
|
390
|
+
key :description, "Updated subscription"
|
|
391
|
+
content 'application/json' do
|
|
392
|
+
schema do
|
|
393
|
+
key :'$ref', :Subscription
|
|
394
|
+
end
|
|
395
|
+
end
|
|
396
|
+
end
|
|
397
|
+
extend Swagger::ErrorResponses::InvalidParameterError
|
|
398
|
+
extend Swagger::ErrorResponses::ForbiddenError
|
|
399
|
+
extend Swagger::ErrorResponses::ResourceNotFoundError
|
|
400
|
+
extend Swagger::ErrorResponses::UnprocessableEntityError
|
|
401
|
+
end
|
|
402
|
+
end
|
|
403
|
+
end
|
|
404
|
+
end
|
|
405
|
+
end
|