Sha256: 4ab78fa40deb42b2ce50821d9f19f8556576370eb215276fca1a91f0c574c57e

Contents?: true

Size: 582 Bytes

Versions: 4

Compression:

Stored size: 582 Bytes

Contents

# coding: utf-8
module InsalesApi
  class Order < Base
    extend Resource::WithUpdatedSince

    def order_lines_attributes
      @order_lines_attributes = order_lines.map do |order_line|
        ol = order_line.as_json
        # при смене версии рельсов (видимо) изменилась сериализация
        ol = ol['order_line'] if ol['order_line']
        ol
      end
    end

    def to_xml(options = {})
      super(options.merge(methods: :order_lines_attributes))
    end

    def paid?
      financial_status == 'paid'
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
insales_api-0.1.3 lib/insales_api/order.rb
insales_api-0.1.2 lib/insales_api/order.rb
insales_api-0.1.1 lib/insales_api/order.rb
insales_api-0.1.0 lib/insales_api/order.rb