Class: Belvo::TaxReturn
Overview
A Tax return is the representation of the tax return document sent every year by a person or a business to the tax authority in the country.
Defined Under Namespace
Classes: TaxReturnType
Instance Attribute Summary
Attributes inherited from Resource
Instance Method Summary collapse
-
#initialize(session) ⇒ TaxReturn
constructor
A new instance of TaxReturn.
- #resume(_session_id, _token, _link: nil) ⇒ Object
-
#retrieve(link:, year_from: nil, year_to: nil, options: nil) ⇒ Hash
Retrieve tax returns information from a specific fiscal link.
Methods inherited from Resource
#clean, #delete, #detail, #list
Constructor Details
#initialize(session) ⇒ TaxReturn
Returns a new instance of TaxReturn.
445 446 447 448 |
# File 'lib/belvo/resources.rb', line 445 def initialize(session) super(session) @endpoint = 'api/tax-returns/' end |
Instance Method Details
#resume(_session_id, _token, _link: nil) ⇒ Object
482 483 484 |
# File 'lib/belvo/resources.rb', line 482 def resume(_session_id, _token, _link: nil) raise NotImplementedError 'TaxReturn does not support resuming a session.' end |
#retrieve(link:, year_from: nil, year_to: nil, options: nil) ⇒ Hash
Retrieve tax returns information from a specific fiscal link.
462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 |
# File 'lib/belvo/resources.rb', line 462 def retrieve(link:, year_from: nil, year_to: nil, options: nil) = TaxReturnOptions.from() body = { link: link, token: .token, save_data: .save_data || true, attach_pdf: .attach_pdf, type: .type }.merge() if .type == TaxReturnType::MONTHLY body[:date_from] = .date_from body[:date_to] = .date_to else body[:year_from] = year_from body[:year_to] = year_to end body = clean body: body @session.post(@endpoint, body) end |