Class: XeroRuby::FinanceApi

Inherits:
Object
  • Object
show all
Defined in:
lib/xero-ruby/api/finance_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_client = ApiClient.new) ⇒ FinanceApi

Returns a new instance of FinanceApi.



16
17
18
# File 'lib/xero-ruby/api/finance_api.rb', line 16

def initialize(api_client = ApiClient.new)
  @api_client = api_client
end

Instance Attribute Details

#api_clientObject

Returns the value of attribute api_client.



14
15
16
# File 'lib/xero-ruby/api/finance_api.rb', line 14

def api_client
  @api_client
end

Instance Method Details

#get_bank_statement_accounting(xero_tenant_id, bank_account_id, from_date, to_date, opts = {}) ⇒ BankStatementAccountingResponse

Get Bank Statement Accounting For lenders that prefer using bank statement data as the source of truth. We provide a data point that will allow access to customer bank statements, plus for reconciled bank transactions the matching accounting, invoice and billing data as well. As customers reconcile bank statements to invoices and bills, this transaction detail will provide valuable insight for lender’s assessment measures.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • bank_account_id (String)

    string, GUID Bank account Id

  • from_date (String)

    date, yyyy-MM-dd Specifies the start date of the query period. The maximum range of the query period is 12 months. If the specified query period is more than 12 months the request will be rejected.

  • to_date (String)

    date, yyyy-MM-dd Specifies the end date of the query period. If the end date is a future date, the request will be rejected.

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :summary_only (Boolean)

    boolean, true/false The default value is true if no parameter is provided. In summary mode, the response will exclude the computation-heavy LineItems fields from bank transaction, invoice, credit note, prepayment and overpayment data, making the API calls quicker and more efficient.

Returns:

  • (BankStatementAccountingResponse)


28
29
30
31
# File 'lib/xero-ruby/api/finance_api.rb', line 28

def get_bank_statement_accounting(xero_tenant_id, , from_date, to_date, opts = {})
  data, _status_code, _headers = get_bank_statement_accounting_with_http_info(xero_tenant_id, , from_date, to_date, opts)
  data
end

#get_bank_statement_accounting_with_http_info(xero_tenant_id, bank_account_id, from_date, to_date, options = {}) ⇒ Array<(BankStatementAccountingResponse, Integer, Hash)>

Get Bank Statement Accounting For lenders that prefer using bank statement data as the source of truth. We provide a data point that will allow access to customer bank statements, plus for reconciled bank transactions the matching accounting, invoice and billing data as well. As customers reconcile bank statements to invoices and bills, this transaction detail will provide valuable insight for lender&#39;s assessment measures.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • bank_account_id (String)

    string, GUID Bank account Id

  • from_date (String)

    date, yyyy-MM-dd Specifies the start date of the query period. The maximum range of the query period is 12 months. If the specified query period is more than 12 months the request will be rejected.

  • to_date (String)

    date, yyyy-MM-dd Specifies the end date of the query period. If the end date is a future date, the request will be rejected.

  • opts (Hash)

    the optional parameters

Returns:

  • (Array<(BankStatementAccountingResponse, Integer, Hash)>)

    BankStatementAccountingResponse data, response status code and response headers



42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/xero-ruby/api/finance_api.rb', line 42

def get_bank_statement_accounting_with_http_info(xero_tenant_id, , from_date, to_date, options = {})
  opts = options.dup
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FinanceApi.get_bank_statement_accounting ...'
  end
  # verify the required parameter 'xero_tenant_id' is set
  if @api_client.config.client_side_validation && xero_tenant_id.nil?
    fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FinanceApi.get_bank_statement_accounting"
  end
  # verify the required parameter 'bank_account_id' is set
  if @api_client.config.client_side_validation && .nil?
    fail ArgumentError, "Missing the required parameter 'bank_account_id' when calling FinanceApi.get_bank_statement_accounting"
  end
  # verify the required parameter 'from_date' is set
  if @api_client.config.client_side_validation && from_date.nil?
    fail ArgumentError, "Missing the required parameter 'from_date' when calling FinanceApi.get_bank_statement_accounting"
  end
  # verify the required parameter 'to_date' is set
  if @api_client.config.client_side_validation && to_date.nil?
    fail ArgumentError, "Missing the required parameter 'to_date' when calling FinanceApi.get_bank_statement_accounting"
  end
  # resource path
  local_var_path = '/BankStatementsPlus/statements'

  # camelize keys of incoming `where` opts
  opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'BankAccountID'] = 
  query_params[:'FromDate'] = from_date
  query_params[:'ToDate'] = to_date
  query_params[:'SummaryOnly'] = opts[:'summary_only'] if !opts[:'summary_only'].nil?
  
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'xero-tenant-id'] = xero_tenant_id

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'BankStatementAccountingResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['OAuth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, "FinanceApi", new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FinanceApi#get_bank_statement_accounting\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_cash_validation(xero_tenant_id, opts = {}) ⇒ Array<CashValidationResponse>

Get cash validation Summarizes the total cash position for each account for an org

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :balance_date (String)

    date, yyyy-MM-dd If no parameter is provided, the current date will be used. The ‘balance date’ will return transactions based on the accounting date entered by the user. Transactions before the balanceDate will be included. The user has discretion as to which accounting period the transaction relates to. The ‘balance date’ will control the latest maximum date of transactions included in the aggregate numbers. Balance date does not affect the CurrentStatement object, as this will always return the most recent statement before asAtSystemDate (if specified)

  • :as_at_system_date (String)

    date, yyyy-MM-dd If no parameter is provided, the current date will be used. The ‘as at’ date will return transactions based on the creation date. It reflects the date the transactions were entered into Xero, not the accounting date. The ‘as at’ date can not be overridden by the user. This can be used to estimate a ‘historical frequency of reconciliation’. The ‘as at’ date will affect the current statement in the response, as any candidate statements created after this date will be filtered out. Thus the current statement returned will be the most recent statement prior to the specified ‘as at’ date. Be aware that neither the begin date, nor the balance date, will affect the current statement. Note; information is only presented when system architecture allows, meaning historical cash validation information will be an estimate. In addition, delete events are not aware of the ‘as at’ functionality in this endpoint, meaning that transactions deleted at the time the API is accessed will be considered to always have been deleted.

  • :begin_date (String)

    date, yyyy-MM-dd If no parameter is provided, the aggregate results will be drawn from the user’s total history. The ‘begin date’ will return transactions based on the accounting date entered by the user. Transactions after the beginDate will be included. The user has discretion as to which accounting period the transaction relates to.

Returns:

  • (Array<CashValidationResponse>)


122
123
124
125
# File 'lib/xero-ruby/api/finance_api.rb', line 122

def get_cash_validation(xero_tenant_id, opts = {})
  data, _status_code, _headers = get_cash_validation_with_http_info(xero_tenant_id, opts)
  data
end

#get_cash_validation_with_http_info(xero_tenant_id, options = {}) ⇒ Array<(Array<CashValidationResponse>, Integer, Hash)>

Get cash validation Summarizes the total cash position for each account for an org

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash)

    the optional parameters

Returns:

  • (Array<(Array<CashValidationResponse>, Integer, Hash)>)

    Array<CashValidationResponse> data, response status code and response headers



135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
# File 'lib/xero-ruby/api/finance_api.rb', line 135

def get_cash_validation_with_http_info(xero_tenant_id, options = {})
  opts = options.dup
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FinanceApi.get_cash_validation ...'
  end
  # verify the required parameter 'xero_tenant_id' is set
  if @api_client.config.client_side_validation && xero_tenant_id.nil?
    fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FinanceApi.get_cash_validation"
  end
  # resource path
  local_var_path = '/CashValidation'

  # camelize keys of incoming `where` opts
  opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'balanceDate'] = opts[:'balance_date'] if !opts[:'balance_date'].nil?
  query_params[:'asAtSystemDate'] = opts[:'as_at_system_date'] if !opts[:'as_at_system_date'].nil?
  query_params[:'beginDate'] = opts[:'begin_date'] if !opts[:'begin_date'].nil?
  
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'xero-tenant-id'] = xero_tenant_id

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'Array<CashValidationResponse>' 

  # auth_names
  auth_names = opts[:auth_names] || ['OAuth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, "FinanceApi", new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FinanceApi#get_cash_validation\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_financial_statement_balance_sheet(xero_tenant_id, opts = {}) ⇒ BalanceSheetResponse

Get Balance Sheet report The balance sheet report is a standard financial report which describes the financial position of an organisation at a point in time.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :balance_date (String)

    Specifies the date for balance sheet report. Format yyyy-MM-dd. If no parameter is provided, the current date will be used.

Returns:

  • (BalanceSheetResponse)


200
201
202
203
# File 'lib/xero-ruby/api/finance_api.rb', line 200

def get_financial_statement_balance_sheet(xero_tenant_id, opts = {})
  data, _status_code, _headers = get_financial_statement_balance_sheet_with_http_info(xero_tenant_id, opts)
  data
end

#get_financial_statement_balance_sheet_with_http_info(xero_tenant_id, options = {}) ⇒ Array<(BalanceSheetResponse, Integer, Hash)>

Get Balance Sheet report The balance sheet report is a standard financial report which describes the financial position of an organisation at a point in time.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash)

    the optional parameters

Returns:

  • (Array<(BalanceSheetResponse, Integer, Hash)>)

    BalanceSheetResponse data, response status code and response headers



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
# File 'lib/xero-ruby/api/finance_api.rb', line 211

def get_financial_statement_balance_sheet_with_http_info(xero_tenant_id, options = {})
  opts = options.dup
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FinanceApi.get_financial_statement_balance_sheet ...'
  end
  # verify the required parameter 'xero_tenant_id' is set
  if @api_client.config.client_side_validation && xero_tenant_id.nil?
    fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FinanceApi.get_financial_statement_balance_sheet"
  end
  # resource path
  local_var_path = '/FinancialStatements/BalanceSheet'

  # camelize keys of incoming `where` opts
  opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'balanceDate'] = opts[:'balance_date'] if !opts[:'balance_date'].nil?
  
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'xero-tenant-id'] = xero_tenant_id

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'BalanceSheetResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['OAuth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, "FinanceApi", new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FinanceApi#get_financial_statement_balance_sheet\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_financial_statement_cashflow(xero_tenant_id, opts = {}) ⇒ CashflowResponse

Get Cash flow report The statement of cash flows - direct method, provides the year to date changes in operating, financing and investing cash flow activities for an organisation. Cashflow statement is not available in US region at this stage.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Date e.g. yyyy-MM-dd Specifies the start date for cash flow report. If no parameter is provided, the date of 12 months before the end date will be used.

  • :end_date (String)

    Date e.g. yyyy-MM-dd Specifies the end date for cash flow report. If no parameter is provided, the current date will be used.

Returns:

  • (CashflowResponse)


275
276
277
278
# File 'lib/xero-ruby/api/finance_api.rb', line 275

def get_financial_statement_cashflow(xero_tenant_id, opts = {})
  data, _status_code, _headers = get_financial_statement_cashflow_with_http_info(xero_tenant_id, opts)
  data
end

#get_financial_statement_cashflow_with_http_info(xero_tenant_id, options = {}) ⇒ Array<(CashflowResponse, Integer, Hash)>

Get Cash flow report The statement of cash flows - direct method, provides the year to date changes in operating, financing and investing cash flow activities for an organisation. Cashflow statement is not available in US region at this stage.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash)

    the optional parameters

Returns:

  • (Array<(CashflowResponse, Integer, Hash)>)

    CashflowResponse data, response status code and response headers



287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
# File 'lib/xero-ruby/api/finance_api.rb', line 287

def get_financial_statement_cashflow_with_http_info(xero_tenant_id, options = {})
  opts = options.dup
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FinanceApi.get_financial_statement_cashflow ...'
  end
  # verify the required parameter 'xero_tenant_id' is set
  if @api_client.config.client_side_validation && xero_tenant_id.nil?
    fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FinanceApi.get_financial_statement_cashflow"
  end
  # resource path
  local_var_path = '/FinancialStatements/Cashflow'

  # camelize keys of incoming `where` opts
  opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'xero-tenant-id'] = xero_tenant_id

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'CashflowResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['OAuth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, "FinanceApi", new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FinanceApi#get_financial_statement_cashflow\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_financial_statement_contacts_expense(xero_tenant_id, opts = {}) ⇒ IncomeByContactResponse

Get expense by contacts report The expense by contact report provides a year to date profit and loss for customers and suppliers for a given organisation, including detailed contact information.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :contact_ids (Array<String>)

    Specifies the customer contacts to be included in the report. If no parameter is provided, all customer contacts will be included

  • :include_manual_journals (Boolean)

    Specifies whether to include the manual journals in the report. If no parameter is provided, manual journals will not be included.

  • :start_date (String)

    Date yyyy-MM-dd Specifies the start date for the report. If no parameter is provided, the date of 12 months before the end date will be used. It is recommended to always specify both a start date and end date; While the initial range may be set to 12 months, this may need to be reduced for high volume organisations in order to improve latency.

  • :end_date (String)

    Date yyyy-MM-dd Specifies the end date for the report. If no parameter is provided, the current date will be used. It is recommended to always specify both a start date and end date; While the initial range may be set to 12 months, this may need to be reduced for high volume organisations in order to improve latency.

Returns:

  • (IncomeByContactResponse)


354
355
356
357
# File 'lib/xero-ruby/api/finance_api.rb', line 354

def get_financial_statement_contacts_expense(xero_tenant_id, opts = {})
  data, _status_code, _headers = get_financial_statement_contacts_expense_with_http_info(xero_tenant_id, opts)
  data
end

#get_financial_statement_contacts_expense_with_http_info(xero_tenant_id, options = {}) ⇒ Array<(IncomeByContactResponse, Integer, Hash)>

Get expense by contacts report The expense by contact report provides a year to date profit and loss for customers and suppliers for a given organisation, including detailed contact information.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash)

    the optional parameters

Returns:

  • (Array<(IncomeByContactResponse, Integer, Hash)>)

    IncomeByContactResponse data, response status code and response headers



368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
# File 'lib/xero-ruby/api/finance_api.rb', line 368

def get_financial_statement_contacts_expense_with_http_info(xero_tenant_id, options = {})
  opts = options.dup
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FinanceApi.get_financial_statement_contacts_expense ...'
  end
  # verify the required parameter 'xero_tenant_id' is set
  if @api_client.config.client_side_validation && xero_tenant_id.nil?
    fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FinanceApi.get_financial_statement_contacts_expense"
  end
  # resource path
  local_var_path = '/FinancialStatements/contacts/expense'

  # camelize keys of incoming `where` opts
  opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'contactIds'] = @api_client.build_collection_param(opts[:'contact_ids'], :multi) if !opts[:'contact_ids'].nil?
  query_params[:'includeManualJournals'] = opts[:'include_manual_journals'] if !opts[:'include_manual_journals'].nil?
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'xero-tenant-id'] = xero_tenant_id

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'IncomeByContactResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['OAuth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, "FinanceApi", new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FinanceApi#get_financial_statement_contacts_expense\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_financial_statement_contacts_revenue(xero_tenant_id, opts = {}) ⇒ IncomeByContactResponse

Get revenue by contacts report The revenue by contact report provides a year to date profit and loss for customers and suppliers for a given organisation, including detailed contact information.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :contact_ids (Array<String>)

    Specifies the customer contacts to be included in the report. If no parameter is provided, all customer contacts will be included

  • :include_manual_journals (Boolean)

    Specifies whether to include the manual journals in the report. If no parameter is provided, manual journals will not be included.

  • :start_date (String)

    Date yyyy-MM-dd Specifies the start date for the report. If no parameter is provided, the date of 12 months before the end date will be used. It is recommended to always specify both a start date and end date; While the initial range may be set to 12 months, this may need to be reduced for high volume organisations in order to improve latency.

  • :end_date (String)

    Date yyyy-MM-dd Specifies the end date for the report. If no parameter is provided, the current date will be used. It is recommended to always specify both a start date and end date; While the initial range may be set to 12 months, this may need to be reduced for high volume organisations in order to improve latency.

Returns:

  • (IncomeByContactResponse)


437
438
439
440
# File 'lib/xero-ruby/api/finance_api.rb', line 437

def get_financial_statement_contacts_revenue(xero_tenant_id, opts = {})
  data, _status_code, _headers = get_financial_statement_contacts_revenue_with_http_info(xero_tenant_id, opts)
  data
end

#get_financial_statement_contacts_revenue_with_http_info(xero_tenant_id, options = {}) ⇒ Array<(IncomeByContactResponse, Integer, Hash)>

Get revenue by contacts report The revenue by contact report provides a year to date profit and loss for customers and suppliers for a given organisation, including detailed contact information.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash)

    the optional parameters

Returns:

  • (Array<(IncomeByContactResponse, Integer, Hash)>)

    IncomeByContactResponse data, response status code and response headers



451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
# File 'lib/xero-ruby/api/finance_api.rb', line 451

def get_financial_statement_contacts_revenue_with_http_info(xero_tenant_id, options = {})
  opts = options.dup
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FinanceApi.get_financial_statement_contacts_revenue ...'
  end
  # verify the required parameter 'xero_tenant_id' is set
  if @api_client.config.client_side_validation && xero_tenant_id.nil?
    fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FinanceApi.get_financial_statement_contacts_revenue"
  end
  # resource path
  local_var_path = '/FinancialStatements/contacts/revenue'

  # camelize keys of incoming `where` opts
  opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'contactIds'] = @api_client.build_collection_param(opts[:'contact_ids'], :multi) if !opts[:'contact_ids'].nil?
  query_params[:'includeManualJournals'] = opts[:'include_manual_journals'] if !opts[:'include_manual_journals'].nil?
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'xero-tenant-id'] = xero_tenant_id

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'IncomeByContactResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['OAuth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, "FinanceApi", new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FinanceApi#get_financial_statement_contacts_revenue\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_financial_statement_profit_and_loss(xero_tenant_id, opts = {}) ⇒ ProfitAndLossResponse

Get Profit & Loss report The profit and loss statement is a standard financial report providing detailed year to date income and expense detail for an organisation.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :start_date (String)

    Date e.g. yyyy-MM-dd Specifies the start date for profit and loss report If no parameter is provided, the date of 12 months before the end date will be used.

  • :end_date (String)

    Date e.g. yyyy-MM-dd Specifies the end date for profit and loss report If no parameter is provided, the current date will be used.

Returns:

  • (ProfitAndLossResponse)


518
519
520
521
# File 'lib/xero-ruby/api/finance_api.rb', line 518

def get_financial_statement_profit_and_loss(xero_tenant_id, opts = {})
  data, _status_code, _headers = get_financial_statement_profit_and_loss_with_http_info(xero_tenant_id, opts)
  data
end

#get_financial_statement_profit_and_loss_with_http_info(xero_tenant_id, options = {}) ⇒ Array<(ProfitAndLossResponse, Integer, Hash)>

Get Profit &amp; Loss report The profit and loss statement is a standard financial report providing detailed year to date income and expense detail for an organisation.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash)

    the optional parameters

Returns:

  • (Array<(ProfitAndLossResponse, Integer, Hash)>)

    ProfitAndLossResponse data, response status code and response headers



530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
# File 'lib/xero-ruby/api/finance_api.rb', line 530

def get_financial_statement_profit_and_loss_with_http_info(xero_tenant_id, options = {})
  opts = options.dup
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FinanceApi.get_financial_statement_profit_and_loss ...'
  end
  # verify the required parameter 'xero_tenant_id' is set
  if @api_client.config.client_side_validation && xero_tenant_id.nil?
    fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FinanceApi.get_financial_statement_profit_and_loss"
  end
  # resource path
  local_var_path = '/FinancialStatements/ProfitAndLoss'

  # camelize keys of incoming `where` opts
  opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'startDate'] = opts[:'start_date'] if !opts[:'start_date'].nil?
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'xero-tenant-id'] = xero_tenant_id

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'ProfitAndLossResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['OAuth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, "FinanceApi", new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FinanceApi#get_financial_statement_profit_and_loss\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end

#get_financial_statement_trial_balance(xero_tenant_id, opts = {}) ⇒ TrialBalanceResponse

Get Trial Balance report The trial balance provides a detailed list of all accounts of an organisation at a point in time, with revenue and expense items being year to date.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash) (defaults to: {})

    the optional parameters

Options Hash (opts):

  • :end_date (String)

    Date e.g. yyyy-MM-dd Specifies the end date for trial balance report If no parameter is provided, the current date will be used.

Returns:

  • (TrialBalanceResponse)


594
595
596
597
# File 'lib/xero-ruby/api/finance_api.rb', line 594

def get_financial_statement_trial_balance(xero_tenant_id, opts = {})
  data, _status_code, _headers = get_financial_statement_trial_balance_with_http_info(xero_tenant_id, opts)
  data
end

#get_financial_statement_trial_balance_with_http_info(xero_tenant_id, options = {}) ⇒ Array<(TrialBalanceResponse, Integer, Hash)>

Get Trial Balance report The trial balance provides a detailed list of all accounts of an organisation at a point in time, with revenue and expense items being year to date.

Parameters:

  • xero_tenant_id (String)

    Xero identifier for Tenant

  • opts (Hash)

    the optional parameters

Returns:

  • (Array<(TrialBalanceResponse, Integer, Hash)>)

    TrialBalanceResponse data, response status code and response headers



605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
# File 'lib/xero-ruby/api/finance_api.rb', line 605

def get_financial_statement_trial_balance_with_http_info(xero_tenant_id, options = {})
  opts = options.dup
  if @api_client.config.debugging
    @api_client.config.logger.debug 'Calling API: FinanceApi.get_financial_statement_trial_balance ...'
  end
  # verify the required parameter 'xero_tenant_id' is set
  if @api_client.config.client_side_validation && xero_tenant_id.nil?
    fail ArgumentError, "Missing the required parameter 'xero_tenant_id' when calling FinanceApi.get_financial_statement_trial_balance"
  end
  # resource path
  local_var_path = '/FinancialStatements/TrialBalance'

  # camelize keys of incoming `where` opts
  opts[:'where'] = @api_client.parameterize_where(opts[:'where']) if !opts[:'where'].nil?

  # query parameters
  query_params = opts[:query_params] || {}
  query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
  
  # XeroAPI's `IDs` convention openapi-generator does not snake_case properly.. manual over-riding `i_ds` malformations:
  query_params[:'IDs'] = @api_client.build_collection_param(opts[:'ids'], :csv) if !opts[:'ids'].nil?
  query_params[:'ContactIDs'] = @api_client.build_collection_param(opts[:'contact_ids'], :csv) if !opts[:'contact_ids'].nil?

  # header parameters
  header_params = opts[:header_params] || {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  header_params[:'xero-tenant-id'] = xero_tenant_id

  # form parameters
  form_params = opts[:form_params] || {}

  # http body (model)
  post_body = opts[:body] 

  # return_type
  return_type = opts[:return_type] || 'TrialBalanceResponse' 

  # auth_names
  auth_names = opts[:auth_names] || ['OAuth2']

  new_options = opts.merge(
    :header_params => header_params,
    :query_params => query_params,
    :form_params => form_params,
    :body => post_body,
    :auth_names => auth_names,
    :return_type => return_type
  )

  data, status_code, headers = @api_client.call_api(:GET, local_var_path, "FinanceApi", new_options)
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called: FinanceApi#get_financial_statement_trial_balance\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  return data, status_code, headers
end