Class: MercadoPublicoCl::TenderAward

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

Overview

Shape de la API: { Tipo, Fecha, Numero, NumeroOferentes, UrlActa }

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#act_urlObject (readonly)

Returns the value of attribute act_url

Returns:

  • (Object)

    the current value of act_url



34
35
36
# File 'lib/mercado_publico_cl/value_objects/tender_award.rb', line 34

def act_url
  @act_url
end

#award_type_codeObject (readonly)

Returns the value of attribute award_type_code

Returns:

  • (Object)

    the current value of award_type_code



34
35
36
# File 'lib/mercado_publico_cl/value_objects/tender_award.rb', line 34

def award_type_code
  @award_type_code
end

#awarded?Object (readonly)

Returns the value of attribute awarded?

Returns:

  • (Object)

    the current value of awarded?



34
35
36
# File 'lib/mercado_publico_cl/value_objects/tender_award.rb', line 34

def awarded?
  @awarded?
end

#bidders_countObject (readonly)

Returns the value of attribute bidders_count

Returns:

  • (Object)

    the current value of bidders_count



34
35
36
# File 'lib/mercado_publico_cl/value_objects/tender_award.rb', line 34

def bidders_count
  @bidders_count
end

#justificationObject (readonly)

Returns the value of attribute justification

Returns:

  • (Object)

    the current value of justification



34
35
36
# File 'lib/mercado_publico_cl/value_objects/tender_award.rb', line 34

def justification
  @justification
end

#rawObject (readonly)

Returns the value of attribute raw

Returns:

  • (Object)

    the current value of raw



34
35
36
# File 'lib/mercado_publico_cl/value_objects/tender_award.rb', line 34

def raw
  @raw
end

#resolution_dateObject (readonly)

Returns the value of attribute resolution_date

Returns:

  • (Object)

    the current value of resolution_date



34
35
36
# File 'lib/mercado_publico_cl/value_objects/tender_award.rb', line 34

def resolution_date
  @resolution_date
end

#resolution_numberObject (readonly)

Returns the value of attribute resolution_number

Returns:

  • (Object)

    the current value of resolution_number



34
35
36
# File 'lib/mercado_publico_cl/value_objects/tender_award.rb', line 34

def resolution_number
  @resolution_number
end

Class Method Details

.from_payload(raw) ⇒ Object



44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/mercado_publico_cl/value_objects/tender_award.rb', line 44

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

  new(
    awarded?: true,
    resolution_number: raw["Numero"] || raw["NumeroActoAdjudicacion"] || raw["NumeroResolucion"],
    resolution_date: Resources::Base.parse_date(
      raw["Fecha"] || raw["FechaActoAdjudicacion"] || raw["FechaAdjudicacion"]
    ),
    award_type_code: Resources::Base.to_int(raw["Tipo"]),
    bidders_count: Resources::Base.to_int(raw["NumeroOferentes"]),
    act_url: raw["UrlActa"],
    justification: raw["Justificacion"],
    raw: raw
  )
end

Instance Method Details

#inspectObject Also known as: to_s



61
62
63
# File 'lib/mercado_publico_cl/value_objects/tender_award.rb', line 61

def inspect
  "#<TenderAward resolution=#{resolution_number.inspect} date=#{resolution_date}>"
end