Class: Unit::Resource::TaxFormResource

Inherits:
BaseResource show all
Defined in:
lib/unit/api_resources/tax_form_resource.rb

Class Method Summary collapse

Methods inherited from BaseResource

file_response_handler, response_handler

Class Method Details

.get_tax_form_by_id(tax_form_id) ⇒ UnitResponse, UnitError

Get a tax form by id by calling Unit’s API

Parameters:

  • tax_form_id (String)

Returns:



24
25
26
27
# File 'lib/unit/api_resources/tax_form_resource.rb', line 24

def get_tax_form_by_id(tax_form_id)
  response = HttpHelper.get("#{api_url}/tax-forms/#{tax_form_id}", headers: headers)
  response_handler(response)
end

.get_tax_form_pdf_by_id(tax_form_id) ⇒ UnitResponse, UnitError

Get a tax form pdf by id by calling Unit’s API

Parameters:

  • tax_form_id (String)

Returns:



32
33
34
35
# File 'lib/unit/api_resources/tax_form_resource.rb', line 32

def get_tax_form_pdf_by_id(tax_form_id)
  response = HttpHelper.get("#{api_url}/tax-forms/#{tax_form_id}/pdf", headers: headers)
  file_response_handler(response)
end

.list(params = nil) ⇒ UnitResponse, UnitError

Get tax_forms by calling Unit’s API

Parameters:

  • params (ListTaxFormParams) (defaults to: nil)

Returns:



16
17
18
19
# File 'lib/unit/api_resources/tax_form_resource.rb', line 16

def list(params = nil)
  response = HttpHelper.get("#{api_url}/tax-forms", params: params&.to_hash, headers: headers)
  response_handler(response)
end