Class: SimpleShipping::Contact
- Inherits:
-
Abstract::Model
- Object
- Abstract::Model
- SimpleShipping::Contact
- Defined in:
- lib/simple_shipping/contact.rb
Overview
Represents the contact information of the party who takes part in shipment process.
Attributes
-
person_name (optional if company_name is provided)
-
company_name (optional if person_name is provided)
-
phone_number
-
email (optional)
Instance Attribute Summary collapse
-
#company_name ⇒ Object
Returns the value of attribute company_name.
-
#email ⇒ Object
Returns the value of attribute email.
-
#person_name ⇒ Object
Returns the value of attribute person_name.
-
#phone_number ⇒ Object
Returns the value of attribute phone_number.
Instance Method Summary collapse
-
#validate_name ⇒ Object
Validate presence of person or company name.
Methods inherited from Abstract::Model
#initialize, set_default_values, validates_submodel
Constructor Details
This class inherits a constructor from SimpleShipping::Abstract::Model
Instance Attribute Details
#company_name ⇒ Object
Returns the value of attribute company_name.
11 12 13 |
# File 'lib/simple_shipping/contact.rb', line 11 def company_name @company_name end |
#email ⇒ Object
Returns the value of attribute email.
11 12 13 |
# File 'lib/simple_shipping/contact.rb', line 11 def email @email end |
#person_name ⇒ Object
Returns the value of attribute person_name.
11 12 13 |
# File 'lib/simple_shipping/contact.rb', line 11 def person_name @person_name end |
#phone_number ⇒ Object
Returns the value of attribute phone_number.
11 12 13 |
# File 'lib/simple_shipping/contact.rb', line 11 def phone_number @phone_number end |
Instance Method Details
#validate_name ⇒ Object
Validate presence of person or company name.
20 21 22 |
# File 'lib/simple_shipping/contact.rb', line 20 def validate_name errors.add(:abstract, "person_name or company_name must be present") unless (person_name || company_name) end |