Class: MercadoPublicoCl::Contact
- Inherits:
-
Data
- Object
- Data
- MercadoPublicoCl::Contact
- Defined in:
- lib/mercado_publico_cl/value_objects/contact.rb
Instance Attribute Summary collapse
-
#email ⇒ Object
readonly
Returns the value of attribute email.
-
#name ⇒ Object
readonly
Returns the value of attribute name.
-
#phone ⇒ Object
readonly
Returns the value of attribute phone.
-
#role ⇒ Object
readonly
Returns the value of attribute role.
Class Method Summary collapse
Instance Method Summary collapse
- #empty? ⇒ Boolean
- #inspect ⇒ Object (also: #to_s)
Instance Attribute Details
#email ⇒ Object (readonly)
Returns the value of attribute email
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/contact.rb', line 4 def email @email end |
#name ⇒ Object (readonly)
Returns the value of attribute name
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/contact.rb', line 4 def name @name end |
#phone ⇒ Object (readonly)
Returns the value of attribute phone
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/contact.rb', line 4 def phone @phone end |
#role ⇒ Object (readonly)
Returns the value of attribute role
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/contact.rb', line 4 def role @role end |
Class Method Details
.from_payload(raw) ⇒ Object
5 6 7 8 9 10 11 12 13 14 |
# File 'lib/mercado_publico_cl/value_objects/contact.rb', line 5 def self.from_payload(raw) return nil if raw.nil? new( name: raw["NombreContacto"], role: raw["CargoContacto"], phone: raw["FonoContacto"], email: raw["MailContacto"] ) end |
Instance Method Details
#empty? ⇒ Boolean
16 17 18 |
# File 'lib/mercado_publico_cl/value_objects/contact.rb', line 16 def empty? [name, role, phone, email].all? { |v| v.nil? || v.to_s.empty? } end |
#inspect ⇒ Object Also known as: to_s
20 21 22 |
# File 'lib/mercado_publico_cl/value_objects/contact.rb', line 20 def inspect "#<Contact name=#{name.inspect} role=#{role.inspect}>" end |