class Economic::OrderProxy
Public Instance Methods
current()
click to toggle source
Fetches all current orders from the API.
# File lib/economic/proxies/order_proxy.rb, line 13 def current response = request(:get_all_current) handles = response.values.flatten.collect { |handle| Entity::Handle.build(handle) } initialize_items get_data_for_handles(handles) self end
find(handle)
click to toggle source
Calls superclass method
FindByHandleWithNumber#find
# File lib/economic/proxies/order_proxy.rb, line 37 def find(handle) if handle.is_a?(Hash) super handle else super({:id => handle}) end end
find_by_other_reference(reference)
click to toggle source
# File lib/economic/proxies/order_proxy.rb, line 22 def find_by_other_reference(reference) response = request(:find_by_other_reference, "otherReference" => reference) 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