Class: MercadoPublicoCl::PODates

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#acceptanceObject (readonly)

Returns the value of attribute acceptance

Returns:

  • (Object)

    the current value of acceptance



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

def acceptance
  @acceptance
end

#cancellationObject (readonly)

Returns the value of attribute cancellation

Returns:

  • (Object)

    the current value of cancellation



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

def cancellation
  @cancellation
end

#creationObject (readonly)

Returns the value of attribute creation

Returns:

  • (Object)

    the current value of creation



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

def creation
  @creation
end

#last_modifiedObject (readonly)

Returns the value of attribute last_modified

Returns:

  • (Object)

    the current value of last_modified



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

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

def raw
  @raw
end

#sentObject (readonly)

Returns the value of attribute sent

Returns:

  • (Object)

    the current value of sent



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

def sent
  @sent
end

Class Method Details

.from_payload(raw) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
# File 'lib/mercado_publico_cl/value_objects/purchase_order_dates.rb', line 12

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

  new(
    creation: Resources::Base.parse_date(raw["FechaCreacion"]),
    sent: Resources::Base.parse_date(raw["FechaEnvio"]),
    acceptance: Resources::Base.parse_date(raw["FechaAceptacion"]),
    cancellation: Resources::Base.parse_date(raw["FechaCancelacion"]),
    last_modified: Resources::Base.parse_date(raw["FechaUltimaModificacion"]),
    raw: raw
  )
end

Instance Method Details

#inspectObject Also known as: to_s



25
26
27
# File 'lib/mercado_publico_cl/value_objects/purchase_order_dates.rb', line 25

def inspect
  "#<PODates creation=#{creation} acceptance=#{acceptance} last_modified=#{last_modified}>"
end