Sha256: 11eb34358fb46a3315ac5f9f1e1793853c6c2ccbd18e1fbcc1a623c75ff68f7f

Contents?: true

Size: 725 Bytes

Versions: 1

Compression:

Stored size: 725 Bytes

Contents

# frozen_string_literal: true

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 = {})
      serialized_options = options.dup
      if respond_to? :order_lines_attributes
        serialized_options[:methods] = :order_lines_attributes
      end
      super(serialized_options)
    end

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

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
insales_api-0.2.0 lib/insales_api/order.rb