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 overriden in initializer.



130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
# File 'lib/activity_notification/config.rb', line 130

def initialize
  @enabled                 = true
  @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_controller       = 'ApplicationController'
  @mailer_templates_dir    = 'activity_notification/mailer'
  @opened_index_limit      = 10
  @orm                     = :active_record
end

Instance Attribute Details

#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.



48
49
50
# File 'lib/activity_notification/config.rb', line 48

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.



11
12
13
# File 'lib/activity_notification/config.rb', line 11

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.



84
85
86
# File 'lib/activity_notification/config.rb', line 84

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.



75
76
77
# File 'lib/activity_notification/config.rb', line 75

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.



111
112
113
# File 'lib/activity_notification/config.rb', line 111

def mailer_templates_dir
  @mailer_templates_dir
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.



30
31
32
# File 'lib/activity_notification/config.rb', line 30

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.



120
121
122
# File 'lib/activity_notification/config.rb', line 120

def opened_index_limit
  @opened_index_limit
end

#Boolean

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

Returns:

  • (Boolean)

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



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

def orm
  @orm
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.



102
103
104
# File 'lib/activity_notification/config.rb', line 102

def parent_controller
  @parent_controller
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.



93
94
95
# File 'lib/activity_notification/config.rb', line 93

def parent_mailer
  @parent_mailer
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.



66
67
68
# File 'lib/activity_notification/config.rb', line 66

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.



57
58
59
# File 'lib/activity_notification/config.rb', line 57

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.



39
40
41
# File 'lib/activity_notification/config.rb', line 39

def subscription_table_name
  @subscription_table_name
end

#table_nameString #table_name=(value) ⇒ String

Deprecated.

as of 1.1.0

Overloads:

  • #table_nameString

    Returns table name to store notifications

    Returns:

    • (String)

      Table name to store notifications.

  • #table_name=(value) ⇒ String

    Sets table name to store notifications

    Parameters:

    • table_name (String)

      The new notification_table_name

    Returns:

    • (String)

      Table name to store notifications.



21
22
23
# File 'lib/activity_notification/config.rb', line 21

def table_name
  @table_name
end