Class: Economic::DebtorEntryProxy

Inherits:
EntityProxy show all
Defined in:
lib/economic/proxies/debtor_entry_proxy.rb

Instance Attribute Summary

Attributes inherited from EntityProxy

#owner

Instance Method Summary collapse

Methods inherited from EntityProxy

#all, #append, #build, entity_class, #entity_class, entity_class_name, #entity_class_name, #find, #get_data, #initialize, #session

Constructor Details

This class inherits a constructor from Economic::EntityProxy

Instance Method Details

#find_by_invoice_number(from, to = from) ⇒ Object



7
8
9
10
11
12
13
14
15
# File 'lib/economic/proxies/debtor_entry_proxy.rb', line 7

def find_by_invoice_number(from, to = from)
  response = request("FindByInvoiceNumber", "from" => from,
                                            "to" => to)

  response[:debtor_entry_handle].map do |debtor_entry_handle|
    # Kinda ugly, but we get an array instead of a hash when there's only one result. :)
    Hash[*debtor_entry_handle.to_a.flatten][:serial_number].to_i
  end
end

#match(*serial_numbers) ⇒ Object



17
18
19
20
21
22
23
# File 'lib/economic/proxies/debtor_entry_proxy.rb', line 17

def match(*serial_numbers)
  request("MatchEntries", :entries => {
    "DebtorEntryHandle" => serial_numbers.map { |serial_number|
      {"SerialNumber" => serial_number}
    }
  })
end