lib/insales_api/order.rb in insales_api-0.0.13 vs lib/insales_api/order.rb in insales_api-0.1.0
- old
+ new
@@ -1,15 +1,23 @@
+# coding: utf-8
module InsalesApi
class Order < Base
+ extend Resource::WithUpdatedSince
+
def order_lines_attributes
- @order_lines_attributes = []
- order_lines.each do |order_line|
- @order_lines_attributes << order_line.as_json['order_line']
+ @order_lines_attributes = order_lines.map do |order_line|
+ ol = order_line.as_json
+ # при смене версии рельсов (видимо) изменилась сериализация
+ ol = ol['order_line'] if ol['order_line']
+ ol
end
- @order_lines_attributes
end
def to_xml(options = {})
- super(options.merge({:methods => :order_lines_attributes}))
+ super(options.merge(methods: :order_lines_attributes))
+ end
+
+ def paid?
+ financial_status == 'paid'
end
end
end