Class: Belvo::TaxReturn

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

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.

Instance Attribute Summary

Attributes inherited from Resource

#endpoint

Instance Method Summary collapse

Methods inherited from Resource

#clean, #delete, #detail, #list

Constructor Details

#initialize(session) ⇒ TaxReturn

Returns a new instance of TaxReturn.



315
316
317
318
# File 'lib/belvo/resources.rb', line 315

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

Instance Method Details

#resume(_session_id, _token, _link: nil) ⇒ Object



342
343
344
# File 'lib/belvo/resources.rb', line 342

def resume(_session_id, _token, _link: nil)
  raise NotImplementedError 'TaxReturn does not support resuming a session.'
end

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

Retrieve tax returns information from a specific fiscal link.

Parameters:

  • link (String)

    Link UUID

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

    Configurable properties

Returns:

  • (Hash)

    created tax returns details

Raises:



327
328
329
330
331
332
333
334
335
336
337
338
339
340
# File 'lib/belvo/resources.rb', line 327

def retrieve(link:, year_from:, year_to:, options: nil)
  options = TaxReturnOptions.from(options)
  body = {
    link: link,
    year_from: year_from,
    year_to: year_to,
    token: options.token,
    encryption_key: options.encryption_key,
    save_data: options.save_data || true,
    attach_pdf: options.attach_pdf
  }.merge(options)
  body = clean body: body
  @session.post(@endpoint, body)
end