Class: MercadoPublicoCl::TenderContact

Inherits:
Data
  • Object
show all
Defined in:
lib/mercado_publico_cl/value_objects/tender_contact.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#emailObject (readonly)

Returns the value of attribute email

Returns:

  • (Object)

    the current value of email



4
5
6
# File 'lib/mercado_publico_cl/value_objects/tender_contact.rb', line 4

def email
  @email
end

#nameObject (readonly)

Returns the value of attribute name

Returns:

  • (Object)

    the current value of name



4
5
6
# File 'lib/mercado_publico_cl/value_objects/tender_contact.rb', line 4

def name
  @name
end

#phoneObject (readonly)

Returns the value of attribute phone

Returns:

  • (Object)

    the current value of phone



4
5
6
# File 'lib/mercado_publico_cl/value_objects/tender_contact.rb', line 4

def phone
  @phone
end

Class Method Details

.from_payload(name:, email:, phone: nil) ⇒ Object



5
6
7
8
9
# File 'lib/mercado_publico_cl/value_objects/tender_contact.rb', line 5

def self.from_payload(name:, email:, phone: nil)
  return nil if [name, email, phone].compact.all? { |v| v.to_s.empty? }

  new(name: name, email: email, phone: phone)
end

Instance Method Details

#empty?Boolean

Returns:

  • (Boolean)


11
12
13
# File 'lib/mercado_publico_cl/value_objects/tender_contact.rb', line 11

def empty?
  [name, email, phone].all? { |v| v.nil? || v.to_s.empty? }
end

#inspectObject Also known as: to_s



15
16
17
# File 'lib/mercado_publico_cl/value_objects/tender_contact.rb', line 15

def inspect
  "#<TenderContact name=#{name.inspect} email=#{email.inspect}>"
end