Class: WcoEmail::EmailFilterAction
- Inherits:
-
Object
- Object
- WcoEmail::EmailFilterAction
- Includes:
- Mongoid::Document, Mongoid::Timestamps
- Defined in:
- app/models/wco_email/email_filter_action.rb
Constant Summary collapse
- KIND_EXE =
'exe'
- KIND_REMOVE_TAG =
::WcoEmail::ACTION_REMOVE_TAG
- KIND_ADD_TAG =
::WcoEmail::ACTION_ADD_TAG
- KIND_AUTORESPOND =
::WcoEmail::ACTION_AUTORESPOND
- KIND_SCHEDULE_EMAIL_ACTION =
'autorespond-email-action'
- KIND_REMOVE_EMAIL_ACTION =
'remove-email-action'
Instance Method Summary collapse
Instance Method Details
#check_value ⇒ Object
22 23 24 25 26 27 28 29 30 31 |
# File 'app/models/wco_email/email_filter_action.rb', line 22 def check_value case kind when KIND_AUTORESPOND existing = WcoEmail::EmailTemplate.where({ id: value }).first if !existing errors.add( :base, 'missing EmailTemplate id when creating an EmailFilterAction' ) throw :abort end end end |
#to_s ⇒ Object
34 35 36 |
# File 'app/models/wco_email/email_filter_action.rb', line 34 def to_s "<EFA #{kind} #{value} />\n" end |
#to_s_full(indent: 0) ⇒ Object
37 38 39 40 41 42 43 44 45 46 |
# File 'app/models/wco_email/email_filter_action.rb', line 37 def to_s_full indent: 0 _value = value if [ KIND_ADD_TAG, KIND_REMOVE_TAG ].include?( kind ) _value = Wco::Tag.find( value ) end if [ KIND_AUTORESPOND ].include?( kind ) _value = WcoEmail::EmailTemplate.find( value ) end "#{" " * indent }<EFAction #{kind} `#{_value}` />\n" end |