class Economic::OrderLineProxy

Public Instance Methods

find(handle) click to toggle source
Calls superclass method FindByHandleWithNumber#find
# File lib/economic/proxies/order_line_proxy.rb, line 25
def find(handle)
  if handle.is_a?(Hash)
    super handle
  else
    super({:id => handle})
  end
end
find_by_order(handle) click to toggle source
# File lib/economic/proxies/order_line_proxy.rb, line 10
def find_by_order(handle)
  response = request(:find_by_order_list, "orderHandles" => {"OrderHandle" => handle})

  handle_key = "#{Support::String.underscore(entity_class_name)}_handle".intern
  handles = [response[handle_key]].flatten.reject(&:blank?).collect do |handle|
    Entity::Handle.build(handle)
  end

  get_data_array(handles).collect do |entity_hash|
    entity = build(entity_hash)
    entity.persisted = true
    entity
  end
end