Sha256: 5a3da6fe5e08afa3f328b7ee9dccee6399d7faa81510b43c8d985ca9663b12e4
Contents?: true
Size: 1.13 KB
Versions: 1
Compression:
Stored size: 1.13 KB
Contents
require 'economic/proxies/entity_proxy' module Economic class DebtorProxy < EntityProxy class << self # Returns the class this proxy is a proxy for def entity_class Debtor end end # Returns Debtors that have the given ci_number. The Debtor objects will only be partially loaded def find_by_ci_number(ci_number) # Get a list of DebtorHandles from e-conomic response = session.request self.class.entity_class.soap_action('FindByCINumber') do soap.body = { 'ciNumber' => ci_number } end # Make sure we always have an array of handles even if the result only contains one handles = [response[:debtor_handle]].flatten.reject(&:blank?) # Create partial Debtor entities handles.collect do |handle| debtor = build debtor.partial = true debtor.persisted = true debtor.handle = handle debtor.number = handle[:number] debtor end end # Returns the next available debtor number def next_available_number session.request Debtor.soap_action(:get_next_available_number) end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
rconomic-0.1.0 | lib/economic/proxies/debtor_proxy.rb |