Class: PapierkramApi::V1::Endpoints::Income::Estimates
- Defined in:
- lib/papierkram_api/v1/endpoints/income/estimates.rb
Overview
This class is responsible for all the API calls related to income estimates.
Instance Attribute Summary
Attributes inherited from Base
Instance Method Summary collapse
-
#all(page: 1, page_size: 100, order_by: nil, order_direction: nil, creditor_id: nil, project_id: nil, document_date_range_start: nil, document_date_range_end: nil) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity.
- #find_by(id:, pdf: false) ⇒ Object
Methods inherited from Base
#http_delete, #http_get, #http_patch, #http_post, #http_put, #initialize, #remaining_quota
Constructor Details
This class inherits a constructor from PapierkramApi::V1::Endpoints::Base
Instance Method Details
#all(page: 1, page_size: 100, order_by: nil, order_direction: nil, creditor_id: nil, project_id: nil, document_date_range_start: nil, document_date_range_end: nil) ⇒ Object
rubocop:disable Metrics/CyclomaticComplexity
21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 |
# File 'lib/papierkram_api/v1/endpoints/income/estimates.rb', line 21 def all(page: 1, # rubocop:disable Metrics/CyclomaticComplexity page_size: 100, order_by: nil, order_direction: nil, creditor_id: nil, project_id: nil, document_date_range_start: nil, document_date_range_end: nil) query = { page: page, page_size: page_size } query[:order_by] = order_by if order_by query[:order_direction] = order_direction if order_direction query[:creditor_id] = creditor_id if creditor_id query[:project_id] = project_id if project_id query[:document_date_range_start] = document_date_range_start if document_date_range_start if document_date_range_end && document_date_range_start query[:document_date_range_end] = document_date_range_end end http_get("#{@url_api_path}/income/estimates", query) end |
#find_by(id:, pdf: false) ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 |
# File 'lib/papierkram_api/v1/endpoints/income/estimates.rb', line 9 def find_by(id:, pdf: false) if pdf == true return http_get( "#{@url_api_path}/income/estimates/#{id}/pdf", nil, { headers: { 'Content-Type' => 'application/pdf' } } ) end http_get("#{@url_api_path}/income/estimates/#{id}") end |