Class: Belvo::TaxDeclaration

Inherits:
Resource show all
Defined in:
lib/belvo/resources.rb

Overview

A Tax declaration is the representation of the tax declaration document sent every year by a person or a business to the tax authority in the country.

Instance Attribute Summary

Attributes inherited from Resource

#endpoint

Instance Method Summary collapse

Methods inherited from Resource

#clean, #delete, #detail, #list, #resume

Constructor Details

#initialize(session) ⇒ TaxDeclaration

Returns a new instance of TaxDeclaration.



490
491
492
493
# File 'lib/belvo/resources.rb', line 490

def initialize(session)
  super(session)
  @endpoint = 'api/tax-declarations/'
end

Instance Method Details

#retrieve(link:, year_from:, year_to:, options: nil) ⇒ Hash

Retrieve tax declaration information for a specific fiscal link.

Parameters:

  • link (String)

    Link UUID

  • year_from (Integer)
  • year_to (Integer)
  • options (TaxDeclarationOptions) (defaults to: nil)

    Configurable properties

Returns:

  • (Hash)

    created tax declarations details

Raises:



502
503
504
505
506
507
508
509
510
511
512
513
514
515
# File 'lib/belvo/resources.rb', line 502

def retrieve(link:, year_from:, year_to:, options: nil)
  options = TaxDeclarationOptions.from(options)
  body = {
    link: link,
    year_from: year_from,
    year_to: year_to,
    token: options.token,
    save_data: options.save_data || true,
    attach_pdf: options.attach_pdf
  }.merge(options)

  body = clean body: body
  @session.post(@endpoint, body)
end