Class: Codat::Models::Report
- Defined in:
- lib/codat/models/report.rb
Overview
Reports for a given company.
Constant Summary collapse
- ENDPOINT =
'/companies/:company_id/reports/agedDebtor'
Class Method Summary collapse
Methods inherited from BaseModel
attributes, #format_url, format_url, get, #get, #initialize, post, #post, successful_response?
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 |
# File 'lib/codat/models/report.rb', line 14 def self.all(company_id:) url = format_url(ENDPOINT, company_id: company_id.to_s.strip) result = get(url) return [] unless successful_response?(result) result.body[:data].map { |report| new(json: report) } end |