Class: SimpleShipping::Contact

Inherits:
Abstract::Model show all
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

Instance Method Summary collapse

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_nameObject

Returns the value of attribute company_name.



11
12
13
# File 'lib/simple_shipping/contact.rb', line 11

def company_name
  @company_name
end

#emailObject

Returns the value of attribute email.



11
12
13
# File 'lib/simple_shipping/contact.rb', line 11

def email
  @email
end

#person_nameObject

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_numberObject

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_nameObject

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