Class: ActivityNotification::Config

Inherits:
Object
  • Object
show all
Defined in:
lib/activity_notification/config.rb

Overview

Class used to initialize configuration object.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfig

Initialize configuration for ActivityNotification. These configuration can be overridden in initializer.



207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
# File 'lib/activity_notification/config.rb', line 207

def initialize
  @enabled                         = true
  @orm                             = :active_record
  @notification_table_name         = 'notifications'
  @subscription_table_name         = 'subscriptions'
  @email_enabled                   = false
  @subscription_enabled            = false
  @subscribe_as_default            = true
  @mailer_sender                   = nil
  @mailer                          = 'ActivityNotification::Mailer'
  @parent_mailer                   = 'ActionMailer::Base'
  @parent_job                      = 'ActiveJob::Base'
  @parent_controller               = 'ApplicationController'
  @parent_channel                  = 'ActionCable::Channel::Base'
  @mailer_templates_dir            = 'activity_notification/mailer'
  @opened_index_limit              = 10
  @active_job_queue                = :activity_notification
  @composite_key_delimiter         = '#'
  @store_with_associated_records   = false
  @action_cable_enabled            = false
  @action_cable_api_enabled        = false
  @action_cable_with_devise        = false
  @notification_channel_prefix     = 'activity_notification_channel'
  @notification_api_channel_prefix = 'activity_notification_api_channel'
end

Instance Attribute Details

#action_cable_api_enabledBoolean #action_cable_api_enabled=(value) ⇒ Boolean

Overloads:

  • #action_cable_api_enabledBoolean

    Returns whether WebSocket API subscription using ActionCable is enabled

    Returns:

    • (Boolean)

      Whether WebSocket API subscription using ActionCable is enabled.

  • #action_cable_api_enabled=(value) ⇒ Boolean

    Sets whether WebSocket API subscription using ActionCable is enabled

    Parameters:

    • action_cable_enabled (Boolean)

      The new action_cable_api_enabled

    Returns:

    • (Boolean)

      Whether WebSocket API subscription using ActionCable is enabled.



175
176
177
# File 'lib/activity_notification/config.rb', line 175

def action_cable_api_enabled
  @action_cable_api_enabled
end

#action_cable_enabledBoolean #action_cable_enabled=(value) ⇒ Boolean

Overloads:

  • #action_cable_enabledBoolean

    Returns whether WebSocket subscription using ActionCable is enabled

    Returns:

    • (Boolean)

      Whether WebSocket subscription using ActionCable is enabled.

  • #action_cable_enabled=(value) ⇒ Boolean

    Sets whether WebSocket subscription using ActionCable is enabled

    Parameters:

    • action_cable_enabled (Boolean)

      The new action_cable_enabled

    Returns:

    • (Boolean)

      Whether WebSocket subscription using ActionCable is enabled.



166
167
168
# File 'lib/activity_notification/config.rb', line 166

def action_cable_enabled
  @action_cable_enabled
end

#action_cable_with_deviseBoolean #action_cable_with_devise=(value) ⇒ Boolean

Overloads:

  • #action_cable_with_deviseBoolean

    Returns whether activity_notification publishes WebSocket notifications using ActionCable only to authenticated target with Devise

    Returns:

    • (Boolean)

      Whether activity_notification publishes WebSocket notifications using ActionCable only to authenticated target with Devise.

  • #action_cable_with_devise=(value) ⇒ Boolean

    Sets whether activity_notification publishes WebSocket notifications using ActionCable only to authenticated target with Devise

    Parameters:

    • action_cable_with_devise (Boolean)

      The new action_cable_with_devise

    Returns:

    • (Boolean)

      Whether activity_notification publishes WebSocket notifications using ActionCable only to authenticated target with Devise.



184
185
186
# File 'lib/activity_notification/config.rb', line 184

def action_cable_with_devise
  @action_cable_with_devise
end

#active_job_queueSymbol #active_job_queue=(value) ⇒ Symbol

Overloads:

  • #active_job_queueSymbol

    Returns ActiveJob queue name for delayed notifications

    Returns:

    • (Symbol)

      ActiveJob queue name for delayed notifications.

  • #active_job_queue=(value) ⇒ Symbol

    Sets ActiveJob queue name for delayed notifications

    Parameters:

    • active_job_queue (Symbol)

      The new active_job_queue

    Returns:

    • (Symbol)

      ActiveJob queue name for delayed notifications.



143
144
145
# File 'lib/activity_notification/config.rb', line 143

def active_job_queue
  @active_job_queue
end

#composite_key_delimiterString #composite_key_delimiter=(value) ⇒ Symbol

Overloads:

  • #composite_key_delimiterString

    Returns Delimiter of composite key for DynamoDB

    Returns:

    • (String)

      Delimiter of composite key for DynamoDB.

  • #composite_key_delimiter=(value) ⇒ Symbol

    Sets delimiter of composite key for DynamoDB

    Parameters:

    • composite_key_delimiter (Symbol)

      The new delimiter of composite key for DynamoDB

    Returns:

    • (Symbol)

      Delimiter of composite key for DynamoDB.



152
153
154
# File 'lib/activity_notification/config.rb', line 152

def composite_key_delimiter
  @composite_key_delimiter
end

#email_enabledBoolean #email_enabled=(value) ⇒ Boolean

Overloads:

  • #email_enabledBoolean

    Returns whether activity_notification sends notification email

    Returns:

    • (Boolean)

      Whether activity_notification sends notification email.

  • #email_enabled=(value) ⇒ Boolean

    Sets whether activity_notification sends notification email

    Parameters:

    • email_enabled (Boolean)

      The new email_enabled

    Returns:

    • (Boolean)

      Whether activity_notification sends notification email.



44
45
46
# File 'lib/activity_notification/config.rb', line 44

def email_enabled
  @email_enabled
end

#enabledBoolean #enabled=(value) ⇒ Boolean

Overloads:

  • #enabledBoolean

    Returns whether ActivityNotification is enabled

    Returns:

    • (Boolean)

      Whether ActivityNotification is enabled.

  • #enabled=(value) ⇒ Boolean

    Sets whether ActivityNotification is enabled

    Parameters:

    • enabled (Boolean)

      The new enabled

    Returns:

    • (Boolean)

      Whether ActivityNotification is enabled.



17
18
19
# File 'lib/activity_notification/config.rb', line 17

def enabled
  @enabled
end

#mailerString #mailer=(value) ⇒ String

Overloads:

  • #mailerString

    Returns mailer class for email notification

    Returns:

    • (String)

      Mailer class for email notification.

  • #mailer=(value) ⇒ String

    Sets mailer class for email notification

    Parameters:

    • mailer (String)

      The new mailer

    Returns:

    • (String)

      Mailer class for email notification.



80
81
82
# File 'lib/activity_notification/config.rb', line 80

def mailer
  @mailer
end

#mailer_senderString #mailer_sender=(value) ⇒ String

Overloads:

  • #mailer_senderString

    Returns email address as sender of notification email

    Returns:

    • (String)

      Email address as sender of notification email.

  • #mailer_sender=(value) ⇒ String

    Sets email address as sender of notification email

    Parameters:

    • mailer_sender (String)

      The new mailer_sender

    Returns:

    • (String)

      Email address as sender of notification email.



71
72
73
# File 'lib/activity_notification/config.rb', line 71

def mailer_sender
  @mailer_sender
end

#mailer_templates_dirString #mailer_templates_dir=(value) ⇒ String

Overloads:

  • #mailer_templates_dirString

    Returns custom mailer templates directory

    Returns:

    • (String)

      Custom mailer templates directory.

  • #mailer_templates_dir=(value) ⇒ String

    Sets custom mailer templates directory

    Parameters:

    • mailer_templates_dir (String)

      The new custom mailer templates directory

    Returns:

    • (String)

      Custom mailer templates directory.



125
126
127
# File 'lib/activity_notification/config.rb', line 125

def mailer_templates_dir
  @mailer_templates_dir
end

#notification_api_channel_prefixString #notification_api_channel_prefix=(value) ⇒ String

Overloads:

  • #notification_api_channel_prefixString

    Returns notification API channel prefix for ActionCable

    Returns:

    • (String)

      Notification API channel prefix for ActionCable.

  • #notification_api_channel_prefix=(value) ⇒ String

    Sets notification API channel prefix for ActionCable

    Parameters:

    • notification_api_channel_prefix (String)

      The new notification_api_channel_prefix

    Returns:

    • (String)

      Notification API channel prefix for ActionCable.



202
203
204
# File 'lib/activity_notification/config.rb', line 202

def notification_api_channel_prefix
  @notification_api_channel_prefix
end

#notification_channel_prefixString #notification_channel_prefix=(value) ⇒ String

Overloads:

  • #notification_channel_prefixString

    Returns notification channel prefix for ActionCable

    Returns:

    • (String)

      Notification channel prefix for ActionCable.

  • #notification_channel_prefix=(value) ⇒ String

    Sets notification channel prefix for ActionCable

    Parameters:

    • notification_channel_prefix (String)

      The new notification_channel_prefix

    Returns:

    • (String)

      Notification channel prefix for ActionCable.



193
194
195
# File 'lib/activity_notification/config.rb', line 193

def notification_channel_prefix
  @notification_channel_prefix
end

#notification_table_nameString #notification_table_name=(value) ⇒ String

Overloads:

  • #notification_table_nameString

    Returns table name to store notifications

    Returns:

    • (String)

      Table name to store notifications.

  • #notification_table_name=(value) ⇒ String

    Sets table name to store notifications

    Parameters:

    • notification_table_name (String)

      The new notification_table_name

    Returns:

    • (String)

      Table name to store notifications.



26
27
28
# File 'lib/activity_notification/config.rb', line 26

def notification_table_name
  @notification_table_name
end

#opened_index_limitInteger #opened_index_limit=(value) ⇒ Integer

Overloads:

  • #opened_index_limitInteger

    Returns default limit to query for opened notifications

    Returns:

    • (Integer)

      Default limit to query for opened notifications.

  • #opened_index_limit=(value) ⇒ Integer

    Sets default limit to query for opened notifications

    Parameters:

    • opened_index_limit (Integer)

      The new opened_index_limit

    Returns:

    • (Integer)

      Default limit to query for opened notifications.



134
135
136
# File 'lib/activity_notification/config.rb', line 134

def opened_index_limit
  @opened_index_limit
end

#Boolean

Returns ORM name for ActivityNotification (:active_record, :mongoid or :dynamodb)

Returns:

  • (Boolean)

    ORM name for ActivityNotification (:active_record, :mongoid or :dynamodb).



8
9
10
# File 'lib/activity_notification/config.rb', line 8

def orm
  @orm
end

#parent_channelString #parent_channel=(value) ⇒ String

Overloads:

  • #parent_channelString

    Returns base channel class for notification_channel

    Returns:

    • (String)

      Base channel class for notification_channel.

  • #parent_channel=(value) ⇒ String

    Sets base channel class for notification_channel

    Parameters:

    • parent_channel (String)

      The new parent_channel

    Returns:

    • (String)

      Base channel class for notification_channel.



116
117
118
# File 'lib/activity_notification/config.rb', line 116

def parent_channel
  @parent_channel
end

#parent_controllerString #parent_controller=(value) ⇒ String

Overloads:

  • #parent_controllerString

    Returns base controller class for notifications_controller

    Returns:

    • (String)

      Base controller class for notifications_controller.

  • #parent_controller=(value) ⇒ String

    Sets base controller class for notifications_controller

    Parameters:

    • parent_controller (String)

      The new parent_controller

    Returns:

    • (String)

      Base controller class for notifications_controller.



107
108
109
# File 'lib/activity_notification/config.rb', line 107

def parent_controller
  @parent_controller
end

#parent_jobString #parent_job=(value) ⇒ String

Overloads:

  • #parent_jobString

    Returns base job class for delayed notifications

    Returns:

    • (String)

      Base job class for delayed notifications.

  • #parent_job=(value) ⇒ String

    Sets base job class for delayed notifications

    Parameters:

    • parent_job (String)

      The new parent_job

    Returns:

    • (String)

      Base job class for delayed notifications.



98
99
100
# File 'lib/activity_notification/config.rb', line 98

def parent_job
  @parent_job
end

#parent_mailerString #parent_mailer=(value) ⇒ String

Overloads:

  • #parent_mailerString

    Returns base mailer class for email notification

    Returns:

    • (String)

      Base mailer class for email notification.

  • #parent_mailer=(value) ⇒ String

    Sets base mailer class for email notification

    Parameters:

    • parent_mailer (String)

      The new parent_mailer

    Returns:

    • (String)

      Base mailer class for email notification.



89
90
91
# File 'lib/activity_notification/config.rb', line 89

def parent_mailer
  @parent_mailer
end

#store_with_associated_recordsBoolean

Returns whether activity_notification stores notificaion records including associated records like target and notifiable

Returns:

  • (Boolean)

    Whether activity_notification stores notificaion records including associated records like target and notifiable.



157
158
159
# File 'lib/activity_notification/config.rb', line 157

def store_with_associated_records
  @store_with_associated_records
end

#subscribe_as_defaultBoolean #default_subscription=(value) ⇒ Boolean

Overloads:

  • #subscribe_as_defaultBoolean

    Returns default subscription value to use when the subscription record does not configured

    Returns:

    • (Boolean)

      Default subscription value to use when the subscription record does not configured.

  • #default_subscription=(value) ⇒ Boolean

    Sets default subscription value to use when the subscription record does not configured

    Parameters:

    • subscribe_as_default (Boolean)

      The new subscribe_as_default

    Returns:

    • (Boolean)

      Default subscription value to use when the subscription record does not configured.



62
63
64
# File 'lib/activity_notification/config.rb', line 62

def subscribe_as_default
  @subscribe_as_default
end

#subscription_enabledBoolean #subscription_enabled=(value) ⇒ Boolean

Overloads:

  • #subscription_enabledBoolean

    Returns whether activity_notification manages subscriptions

    Returns:

    • (Boolean)

      Whether activity_notification manages subscriptions.

  • #subscription_enabled=(value) ⇒ Boolean

    Sets whether activity_notification manages subscriptions

    Parameters:

    • subscription_enabled (Boolean)

      The new subscription_enabled

    Returns:

    • (Boolean)

      Whether activity_notification manages subscriptions.



53
54
55
# File 'lib/activity_notification/config.rb', line 53

def subscription_enabled
  @subscription_enabled
end

#subscription_table_nameString #subscription_table_name=(value) ⇒ String

Overloads:

  • #subscription_table_nameString

    Returns table name to store subscriptions

    Returns:

    • (String)

      Table name to store subscriptions.

  • #subscription_table_name=(value) ⇒ String

    Sets table name to store subscriptions

    Parameters:

    • notification_table_name (String)

      The new subscription_table_name

    Returns:

    • (String)

      Table name to store subscriptions.



35
36
37
# File 'lib/activity_notification/config.rb', line 35

def subscription_table_name
  @subscription_table_name
end