Class: MercadoPublicoCl::POBuyer

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#activityObject (readonly)

Returns the value of attribute activity

Returns:

  • (Object)

    the current value of activity



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

def activity
  @activity
end

#codeObject (readonly)

Returns the value of attribute code

Returns:

  • (Object)

    the current value of code



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

def code
  @code
end

#contactObject (readonly)

Returns the value of attribute contact

Returns:

  • (Object)

    the current value of contact



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

def contact
  @contact
end

#countryObject (readonly)

Returns the value of attribute country

Returns:

  • (Object)

    the current value of country



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

def country
  @country
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/purchase_order_buyer.rb', line 4

def name
  @name
end

#rawObject (readonly)

Returns the value of attribute raw

Returns:

  • (Object)

    the current value of raw



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

def raw
  @raw
end

#unit_addressObject (readonly)

Returns the value of attribute unit_address

Returns:

  • (Object)

    the current value of unit_address



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

def unit_address
  @unit_address
end

#unit_codeObject (readonly)

Returns the value of attribute unit_code

Returns:

  • (Object)

    the current value of unit_code



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

def unit_code
  @unit_code
end

#unit_comunaObject (readonly)

Returns the value of attribute unit_comuna

Returns:

  • (Object)

    the current value of unit_comuna



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

def unit_comuna
  @unit_comuna
end

#unit_nameObject (readonly)

Returns the value of attribute unit_name

Returns:

  • (Object)

    the current value of unit_name



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

def unit_name
  @unit_name
end

#unit_regionObject (readonly)

Returns the value of attribute unit_region

Returns:

  • (Object)

    the current value of unit_region



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

def unit_region
  @unit_region
end

#unit_rutObject (readonly)

Returns the value of attribute unit_rut

Returns:

  • (Object)

    the current value of unit_rut



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

def unit_rut
  @unit_rut
end

Class Method Details

.from_payload(raw) ⇒ Object



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
# File 'lib/mercado_publico_cl/value_objects/purchase_order_buyer.rb', line 18

def self.from_payload(raw)
  return nil if raw.nil? || raw.empty?

  new(
    code: Resources::Base.to_int(raw["CodigoOrganismo"]),
    name: raw["NombreOrganismo"],
    activity: raw["Actividad"],
    country: raw["Pais"],
    unit_code: raw["CodigoUnidad"],
    unit_name: raw["NombreUnidad"],
    unit_rut: raw["RutUnidad"],
    unit_address: raw["DireccionUnidad"],
    unit_comuna: raw["ComunaUnidad"],
    unit_region: raw["RegionUnidad"],
    contact: Contact.from_payload(raw),
    raw: raw
  )
end

Instance Method Details

#inspectObject Also known as: to_s



37
38
39
# File 'lib/mercado_publico_cl/value_objects/purchase_order_buyer.rb', line 37

def inspect
  "#<POBuyer code=#{code.inspect} name=#{name.inspect} unit=#{unit_name.inspect}>"
end