Class: Unit::Resource::StatementResource

Inherits:
BaseResource show all
Defined in:
lib/unit/api_resources/statement_resource.rb

Class Method Summary collapse

Methods inherited from BaseResource

file_response_handler, response_handler

Class Method Details

.get_bank_verification(request) ⇒ UnitResponse, UnitError

Get bank verification by calling Unit’s API

Parameters:

  • request (GetBankVerificationRequest)

Returns:



39
40
41
42
# File 'lib/unit/api_resources/statement_resource.rb', line 39

def get_bank_verification(request)
  response = HttpHelper.get("#{api_url}/statements/#{request.}/bank/pdf", params: request&.to_hash, headers: headers)
  file_response_handler(response)
end

.get_html_by_id(request) ⇒ UnitResponse, UnitError

Get a html statement by id by calling Unit’s API

Parameters:

  • params (GetHtmlByIdRequest)

Returns:



23
24
25
26
# File 'lib/unit/api_resources/statement_resource.rb', line 23

def get_html_by_id(request)
  response = HttpHelper.get("#{api_url}/statements/#{request.statement_id}/html", params: request.to_hash, headers: headers)
  file_response_handler(response)
end

.get_pdf_by_id(request) ⇒ UnitResponse, UnitError

Get a pdf statement by id by calling Unit’s API

Parameters:

  • request (GetPdfByIdRequest)

Returns:



31
32
33
34
# File 'lib/unit/api_resources/statement_resource.rb', line 31

def get_pdf_by_id(request)
  response = HttpHelper.get("#{api_url}/statements/#{request.statement_id}/pdf", params: request.to_hash, headers: headers)
  file_response_handler(response)
end

.list(params = nil) ⇒ UnitResponse, UnitError

Get statements by calling Unit’s API

Parameters:

  • params (ListStatementParams) (defaults to: nil)

Returns:



15
16
17
18
# File 'lib/unit/api_resources/statement_resource.rb', line 15

def list(params = nil)
  response = HttpHelper.get("#{api_url}/statements", params: params&.to_hash, headers: headers)
  response_handler(response)
end