Class: MercadoPublicoCl::POItem
- Inherits:
-
Data
- Object
- Data
- MercadoPublicoCl::POItem
- Defined in:
- lib/mercado_publico_cl/value_objects/purchase_order_item.rb
Instance Attribute Summary collapse
-
#buyer_specification ⇒ Object
readonly
Returns the value of attribute buyer_specification.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#category_code ⇒ Object
readonly
Returns the value of attribute category_code.
-
#correlative ⇒ Object
readonly
Returns the value of attribute correlative.
-
#currency ⇒ Object
readonly
Returns the value of attribute currency.
-
#currency_code ⇒ Object
readonly
Returns the value of attribute currency_code.
-
#product_code ⇒ Object
readonly
Returns the value of attribute product_code.
-
#product_name ⇒ Object
readonly
Returns the value of attribute product_name.
-
#quantity ⇒ Object
readonly
Returns the value of attribute quantity.
-
#raw ⇒ Object
readonly
Returns the value of attribute raw.
-
#supplier_specification ⇒ Object
readonly
Returns the value of attribute supplier_specification.
-
#total ⇒ Object
readonly
Returns the value of attribute total.
-
#total_charges ⇒ Object
readonly
Returns the value of attribute total_charges.
-
#total_discounts ⇒ Object
readonly
Returns the value of attribute total_discounts.
-
#total_taxes ⇒ Object
readonly
Returns the value of attribute total_taxes.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
-
#unit_price ⇒ Object
readonly
Returns the value of attribute unit_price.
Class Method Summary collapse
Instance Method Summary collapse
- #inspect ⇒ Object (also: #to_s)
Instance Attribute Details
#buyer_specification ⇒ Object (readonly)
Returns the value of attribute buyer_specification
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def buyer_specification @buyer_specification end |
#category ⇒ Object (readonly)
Returns the value of attribute category
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def category @category end |
#category_code ⇒ Object (readonly)
Returns the value of attribute category_code
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def category_code @category_code end |
#correlative ⇒ Object (readonly)
Returns the value of attribute correlative
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def correlative @correlative end |
#currency ⇒ Object (readonly)
Returns the value of attribute currency
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def currency @currency end |
#currency_code ⇒ Object (readonly)
Returns the value of attribute currency_code
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def currency_code @currency_code end |
#product_code ⇒ Object (readonly)
Returns the value of attribute product_code
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def product_code @product_code end |
#product_name ⇒ Object (readonly)
Returns the value of attribute product_name
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def product_name @product_name end |
#quantity ⇒ Object (readonly)
Returns the value of attribute quantity
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def quantity @quantity end |
#raw ⇒ Object (readonly)
Returns the value of attribute raw
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def raw @raw end |
#supplier_specification ⇒ Object (readonly)
Returns the value of attribute supplier_specification
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def supplier_specification @supplier_specification end |
#total ⇒ Object (readonly)
Returns the value of attribute total
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def total @total end |
#total_charges ⇒ Object (readonly)
Returns the value of attribute total_charges
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def total_charges @total_charges end |
#total_discounts ⇒ Object (readonly)
Returns the value of attribute total_discounts
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def total_discounts @total_discounts end |
#total_taxes ⇒ Object (readonly)
Returns the value of attribute total_taxes
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def total_taxes @total_taxes end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def unit @unit end |
#unit_price ⇒ Object (readonly)
Returns the value of attribute unit_price
4 5 6 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 4 def unit_price @unit_price end |
Class Method Details
.from_payload(raw) ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 23 def self.from_payload(raw) return nil if raw.nil? currency_code = raw["Moneda"] new( correlative: Resources::Base.to_int(raw["Correlativo"]), category_code: Resources::Base.to_int(raw["CodigoCategoria"]), category: raw["Categoria"], product_code: Resources::Base.to_int(raw["CodigoProducto"]), product_name: raw["Producto"] || raw["NombreProducto"], buyer_specification: raw["EspecificacionComprador"], supplier_specification: raw["EspecificacionProveedor"], quantity: Resources::Base.to_float(raw["Cantidad"]), unit: raw["Unidad"] || raw["UnidadMedida"], currency: Enums::Currency.to_symbol(currency_code), currency_code: currency_code, unit_price: Resources::Base.to_float(raw["PrecioNeto"]), total_charges: Resources::Base.to_float(raw["TotalCargos"]), total_discounts: Resources::Base.to_float(raw["TotalDescuentos"]), total_taxes: Resources::Base.to_float(raw["TotalImpuestos"]), total: Resources::Base.to_float(raw["Total"]), raw: raw ) end |
Instance Method Details
#inspect ⇒ Object Also known as: to_s
48 49 50 |
# File 'lib/mercado_publico_cl/value_objects/purchase_order_item.rb', line 48 def inspect "#<POItem ##{correlative} product=#{product_name.inspect} qty=#{quantity} unit_price=#{unit_price}>" end |