Class: BarkestCore::ContactMessage

Inherits:
Object
  • Object
show all
Includes:
ActiveModel::Model, ActiveModel::Validations, EmailTester
Defined in:
app/models/barkest_core/contact_message.rb

Overview

Defines the message generated by the generic contact form.

Constant Summary

Constants included from EmailTester

EmailTester::VALID_EMAIL_REGEX

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from EmailTester

included, valid_email?

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



9
10
11
# File 'app/models/barkest_core/contact_message.rb', line 9

def body
  @body
end

Returns the value of attribute related_to.



9
10
11
# File 'app/models/barkest_core/contact_message.rb', line 9

def related_to
  @related_to
end

#remote_ipObject

Returns the value of attribute remote_ip.



9
10
11
# File 'app/models/barkest_core/contact_message.rb', line 9

def remote_ip
  @remote_ip
end

#subjectObject

Returns the value of attribute subject.



9
10
11
# File 'app/models/barkest_core/contact_message.rb', line 9

def subject
  @subject
end

#your_emailObject

Returns the value of attribute your_email.



9
10
11
# File 'app/models/barkest_core/contact_message.rb', line 9

def your_email
  @your_email
end

#your_nameObject

Returns the value of attribute your_name.



9
10
11
# File 'app/models/barkest_core/contact_message.rb', line 9

def your_name
  @your_name
end

Instance Method Details

#full_subjectObject

Gets the full subject for the message.



19
20
21
22
# File 'app/models/barkest_core/contact_message.rb', line 19

def full_subject
  return related_to if subject.blank?
  "#{related_to}: #{subject}"
end

#send_messageObject

Sends the message.



26
27
28
# File 'app/models/barkest_core/contact_message.rb', line 26

def send_message
  BarkestCore::ContactForm.contact(self).deliver_now
end