Class: MercadoPublicoCl::POVendor

Inherits:
Data
  • Object
show all
Defined in:
lib/mercado_publico_cl/value_objects/purchase_order_vendor.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_vendor.rb', line 4

def activity
  @activity
end

#addressObject (readonly)

Returns the value of attribute address

Returns:

  • (Object)

    the current value of address



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

def address
  @address
end

#branch_codeObject (readonly)

Returns the value of attribute branch_code

Returns:

  • (Object)

    the current value of branch_code



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

def branch_code
  @branch_code
end

#branch_nameObject (readonly)

Returns the value of attribute branch_name

Returns:

  • (Object)

    the current value of branch_name



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

def branch_name
  @branch_name
end

#branch_rutObject (readonly)

Returns the value of attribute branch_rut

Returns:

  • (Object)

    the current value of branch_rut



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

def branch_rut
  @branch_rut
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_vendor.rb', line 4

def code
  @code
end

#comunaObject (readonly)

Returns the value of attribute comuna

Returns:

  • (Object)

    the current value of comuna



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

def comuna
  @comuna
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_vendor.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_vendor.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_vendor.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_vendor.rb', line 4

def raw
  @raw
end

#regionObject (readonly)

Returns the value of attribute region

Returns:

  • (Object)

    the current value of region



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

def region
  @region
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_vendor.rb', line 18

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

  new(
    code: Resources::Base.to_int(raw["Codigo"] || raw["CodigoProveedor"]),
    name: raw["Nombre"] || raw["NombreProveedor"],
    activity: raw["Actividad"],
    country: raw["Pais"],
    branch_code: raw["CodigoSucursal"],
    branch_name: raw["NombreSucursal"],
    branch_rut: raw["RutSucursal"],
    address: raw["Direccion"],
    comuna: raw["Comuna"],
    region: raw["Region"],
    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_vendor.rb', line 37

def inspect
  "#<POVendor code=#{code.inspect} name=#{name.inspect} branch=#{branch_name.inspect}>"
end