Sha256: 02bdeecc2972bd44a381155f2ada1459bd6d8b44ef374d3b5e1f4d16f4436e44

Contents?: true

Size: 726 Bytes

Versions: 3

Compression:

Stored size: 726 Bytes

Contents

module Printfection
  class LineItem < Resource
    extend Actions::Retrieve
    extend Actions::Create
    include Actions::Update
    include Actions::Delete

    property :id,         transform_with: Transforms::Integer
    property :order_id,   transform_with: Transforms::Integer
    property :item_id,    transform_with: Transforms::Integer
    property :size_id,    transform_with: Transforms::Integer
    property :quantity,   transform_with: Transforms::Integer
    property :created_at, transform_with: Transforms::Date

    def self.uri
      "/lineitems"
    end

    def item
      @item ||= Item.retrieve(item_id)
    end

    def size
      @size ||= item.sizes.find { |s| s.id == size_id }
    end

  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
printfection-1.0.3 lib/printfection/line_item.rb
printfection-1.0.2 lib/printfection/line_item.rb
printfection-1.0.1 lib/printfection/line_item.rb