Class: Jemquarie::Importer

Inherits:
Base
  • Object
show all
Includes:
Parser::CashTransactions
Defined in:
lib/jemquarie/importer.rb

Instance Method Summary collapse

Methods included from Parser::CashTransactions

#parse_cash_transactions_response

Methods inherited from Base

#initialize

Methods included from Parser::Generic

#generic_request_response

Constructor Details

This class inherits a constructor from Jemquarie::Base

Instance Method Details

#cash_transactions(date_from = (Date.today - 1.day), date_to = Date.today, account_number = '', include_closed = 'Y') ⇒ Object



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

def cash_transactions(date_from = (Date.today - 1.day), date_to = Date.today,  = '', include_closed = 'Y')
  if .blank? && ((date_to - date_from).days > 2.days) # if no account specified, ESI api doesn't allow to ask more than 2 days of transactions
    return {:error => "Cannot request more than 2 days of transactions if not account is specified"}
  end
  response = @client.call(:generate_xml_extract, :message => create_message(date_from, date_to, , include_closed))
  return parse_cash_transactions_response(response) if response.success?
  {:error => "An error has occured, please try again later"}
end