Class: InventoryUnitSerializer
- Inherits:
-
ActiveModel::Serializer
- Object
- ActiveModel::Serializer
- InventoryUnitSerializer
- Defined in:
- app/serializers/inventory_unit_serializer.rb
Instance Method Summary collapse
Instance Method Details
#name ⇒ Object
18 19 20 |
# File 'app/serializers/inventory_unit_serializer.rb', line 18 def name object.variant.name end |
#price ⇒ Object
10 11 12 |
# File 'app/serializers/inventory_unit_serializer.rb', line 10 def price object.line_item.price.round(2).to_f end |
#product_id ⇒ Object
14 15 16 |
# File 'app/serializers/inventory_unit_serializer.rb', line 14 def product_id object.variant.sku end |
#quantity ⇒ Object
6 7 8 |
# File 'app/serializers/inventory_unit_serializer.rb', line 6 def quantity object.respond_to?(:quantity) ? object.quantity : 1 end |