Class: Codat::Models::BankStatementList
- Defined in:
- lib/codat/models/bank_statement_list.rb
Overview
Bank statements for a given company. This endpoint will return an array of records and also metadata (page size, page number and total results).
Constant Summary collapse
- ENDPOINT =
'/companies/:company_id/data/bankStatements'
Instance Attribute Summary collapse
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#records ⇒ Object
readonly
Returns the value of attribute records.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(json:) ⇒ BankStatementList
constructor
A new instance of BankStatementList.
Methods inherited from BaseModel
attributes, #format_url, format_url, get, #get, post, #post, successful_response?
Constructor Details
#initialize(json:) ⇒ BankStatementList
Returns a new instance of BankStatementList.
26 27 28 29 30 31 32 33 34 |
# File 'lib/codat/models/bank_statement_list.rb', line 26 def initialize(json:) super records = json.delete(:results) || [] @records = records.map { |bank_statement| BankStatement.new(json: bank_statement) } @metadata = Metadata.new(json:) end |
Instance Attribute Details
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
14 15 16 |
# File 'lib/codat/models/bank_statement_list.rb', line 14 def @metadata end |
#records ⇒ Object (readonly)
Returns the value of attribute records.
14 15 16 |
# File 'lib/codat/models/bank_statement_list.rb', line 14 def records @records end |
Class Method Details
.for(company_id:, account_id:, page: 1) ⇒ Object
16 17 18 19 20 21 22 23 24 |
# File 'lib/codat/models/bank_statement_list.rb', line 16 def self.for(company_id:, account_id:, page: 1) url = format_url(ENDPOINT, company_id: company_id.to_s.strip) result = get(url, accountId: account_id.to_s.strip, page: page.to_s.strip) return nil unless successful_response?(result) new(json: result.body) end |