Class: InsalesApi::Order

Inherits:
Base
  • Object
show all
Extended by:
Resource::WithUpdatedSince
Defined in:
lib/insales_api/order.rb

Instance Method Summary collapse

Methods included from Resource::WithUpdatedSince

find_in_batches, find_updated_since

Methods inherited from Base

configure, dump_config, for_account, restore_config

Methods included from Resource::Countable

#count

Methods included from Resource::Paginated

#find_each, #find_in_batches

Instance Method Details

#order_lines_attributesObject



7
8
9
10
11
12
13
14
# File 'lib/insales_api/order.rb', line 7

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

#paid?Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/insales_api/order.rb', line 24

def paid?
  financial_status == 'paid'
end

#to_xml(options = {}) ⇒ Object



16
17
18
19
20
21
22
# File 'lib/insales_api/order.rb', line 16

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