Class: Codat::Models::BankStatement

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/codat/models/bank_statement.rb

Overview

Bank statements for a given company.

Constant Summary collapse

ENDPOINT =
'/companies/:company_id/data/bankStatements/accounts'

Class Method Summary collapse

Methods inherited from BaseModel

attributes, #format_url, format_url, get, #get, #initialize, post, #post

Constructor Details

This class inherits a constructor from Codat::BaseModel

Class Method Details

.all(company_id:) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
# File 'lib/codat/models/bank_statement.rb', line 14

def self.all(company_id:)
  url = format_url(
    ENDPOINT, company_id: company_id.to_s.strip
  )

  result = get(url)

  return [] if result.status == 404

  result.body.map { |bank_statement| new(json: bank_statement) }
end