Class: WebMerge::Notification
- Inherits:
-
Object
- Object
- WebMerge::Notification
- Includes:
- ActiveModel::Validations
- Defined in:
- lib/web_merge/notification.rb
Instance Attribute Summary collapse
-
#from ⇒ Object
Returns the value of attribute from.
-
#html ⇒ Object
Returns the value of attribute html.
-
#password ⇒ Object
Returns the value of attribute password.
-
#security ⇒ Object
Returns the value of attribute security.
-
#subject ⇒ Object
Returns the value of attribute subject.
-
#to ⇒ Object
Returns the value of attribute to.
Instance Method Summary collapse
- #as_form_data ⇒ Object
-
#initialize(to: required(:to), from: required(:from), subject: "WebMerge Notification", security: WebMerge::Constants::SECURITY_LEVEL_LOW, html: nil, password: nil) ⇒ Notification
constructor
A new instance of Notification.
- #requires_password? ⇒ Boolean
Constructor Details
#initialize(to: required(:to), from: required(:from), subject: "WebMerge Notification", security: WebMerge::Constants::SECURITY_LEVEL_LOW, html: nil, password: nil) ⇒ Notification
Returns a new instance of Notification.
12 13 14 15 16 17 18 19 |
# File 'lib/web_merge/notification.rb', line 12 def initialize(to: required(:to), from: required(:from), subject: "WebMerge Notification", security: WebMerge::Constants::SECURITY_LEVEL_LOW, html: nil, password: nil) @to = to @from = from @subject = subject @security = security @html = html @password = password end |
Instance Attribute Details
#from ⇒ Object
Returns the value of attribute from.
5 6 7 |
# File 'lib/web_merge/notification.rb', line 5 def from @from end |
#html ⇒ Object
Returns the value of attribute html.
5 6 7 |
# File 'lib/web_merge/notification.rb', line 5 def html @html end |
#password ⇒ Object
Returns the value of attribute password.
5 6 7 |
# File 'lib/web_merge/notification.rb', line 5 def password @password end |
#security ⇒ Object
Returns the value of attribute security.
5 6 7 |
# File 'lib/web_merge/notification.rb', line 5 def security @security end |
#subject ⇒ Object
Returns the value of attribute subject.
5 6 7 |
# File 'lib/web_merge/notification.rb', line 5 def subject @subject end |
#to ⇒ Object
Returns the value of attribute to.
5 6 7 |
# File 'lib/web_merge/notification.rb', line 5 def to @to end |
Instance Method Details
#as_form_data ⇒ Object
25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/web_merge/notification.rb', line 25 def as_form_data request_params = { to: to, from: from, subject: subject, html: html, security: security } request_params.merge!(password: password) if requires_password? request_params end |
#requires_password? ⇒ Boolean
21 22 23 |
# File 'lib/web_merge/notification.rb', line 21 def requires_password? security == WebMerge::Constants::SECURITY_LEVEL_MEDIUM || security == WebMerge::Constants::SECURITY_LEVEL_HIGH end |