Class: Nfe::Resources::TaxCodes
- Inherits:
-
AbstractResource
- Object
- AbstractResource
- Nfe::Resources::TaxCodes
- Defined in:
- lib/nfe/resources/tax_codes.rb,
sig/nfe/resources/tax_codes.rbs
Overview
CT-e tax-code lookup tables for the :cte host family
(+https://api.nfse.io/tax-codes/...+). Exposes the four reference lists
consumed when building a CT-e: operation codes, acquisition purposes, and
the issuer/recipient tax profiles.
These endpoints paginate page-style (1-based +pageIndex+/+pageCount+), so every method returns an TaxCodePaginatedResponse (NOT an ListResponse); see that class for why this differs from the cursor-style lists elsewhere in the SDK.
Instance Attribute Summary
Attributes inherited from AbstractResource
Instance Method Summary collapse
- #api_family ⇒ Symbol
-
#api_version ⇒ String
The
:ctehost (+api.nfse.io+) does not bake in a version and these tax-code paths carry none, so no version segment is prefixed. -
#list_acquisition_purposes(page_index: nil, page_count: nil) ⇒ Nfe::TaxCodePaginatedResponse
List CT-e acquisition purposes (Finalidade de Aquisição).
-
#list_issuer_tax_profiles(page_index: nil, page_count: nil) ⇒ Nfe::TaxCodePaginatedResponse
List CT-e issuer tax profiles (Perfil Tributário do Emitente).
-
#list_operation_codes(page_index: nil, page_count: nil) ⇒ Nfe::TaxCodePaginatedResponse
List CT-e operation codes (Código de Operação).
-
#list_recipient_tax_profiles(page_index: nil, page_count: nil) ⇒ Nfe::TaxCodePaginatedResponse
List CT-e recipient tax profiles (Perfil Tributário do Destinatário).
-
#list_tax_codes(path, page_index, page_count) ⇒ Nfe::TaxCodePaginatedResponse?
Shared GET + page-style query builder for the four tax-code endpoints.
Methods inherited from AbstractResource
#build_list_page, #build_multipart_body, #cursor_list_page, #delete, #dig_key, #download, #extract_invoice_id, #full_path, #get, #handle_async_response, #hydrate, #hydrate_list, #initialize, #multipart_part, #page_list_page, #parse_json, #post, #put, #unwrap, #upload_multipart
Constructor Details
This class inherits a constructor from Nfe::Resources::AbstractResource
Instance Method Details
#api_family ⇒ Symbol
23 24 25 |
# File 'lib/nfe/resources/tax_codes.rb', line 23 def api_family :cte end |
#api_version ⇒ String
The :cte host (+api.nfse.io+) does not bake in a version and these
tax-code paths carry none, so no version segment is prefixed.
29 30 31 |
# File 'lib/nfe/resources/tax_codes.rb', line 29 def api_version "" end |
#list_acquisition_purposes(page_index: nil, page_count: nil) ⇒ Nfe::TaxCodePaginatedResponse
List CT-e acquisition purposes (Finalidade de Aquisição).
49 50 51 |
# File 'lib/nfe/resources/tax_codes.rb', line 49 def list_acquisition_purposes(page_index: nil, page_count: nil) list_tax_codes("/tax-codes/acquisition-purpose", page_index, page_count) end |
#list_issuer_tax_profiles(page_index: nil, page_count: nil) ⇒ Nfe::TaxCodePaginatedResponse
List CT-e issuer tax profiles (Perfil Tributário do Emitente).
58 59 60 |
# File 'lib/nfe/resources/tax_codes.rb', line 58 def list_issuer_tax_profiles(page_index: nil, page_count: nil) list_tax_codes("/tax-codes/issuer-tax-profile", page_index, page_count) end |
#list_operation_codes(page_index: nil, page_count: nil) ⇒ Nfe::TaxCodePaginatedResponse
List CT-e operation codes (Código de Operação).
40 41 42 |
# File 'lib/nfe/resources/tax_codes.rb', line 40 def list_operation_codes(page_index: nil, page_count: nil) list_tax_codes("/tax-codes/operation-code", page_index, page_count) end |
#list_recipient_tax_profiles(page_index: nil, page_count: nil) ⇒ Nfe::TaxCodePaginatedResponse
List CT-e recipient tax profiles (Perfil Tributário do Destinatário).
67 68 69 |
# File 'lib/nfe/resources/tax_codes.rb', line 67 def list_recipient_tax_profiles(page_index: nil, page_count: nil) list_tax_codes("/tax-codes/recipient-tax-profile", page_index, page_count) end |
#list_tax_codes(path, page_index, page_count) ⇒ Nfe::TaxCodePaginatedResponse?
Shared GET + page-style query builder for the four tax-code endpoints. Only the non-nil paging parameters are sent, keeping them out of the URL when omitted.
76 77 78 79 80 81 82 |
# File 'lib/nfe/resources/tax_codes.rb', line 76 def list_tax_codes(path, page_index, page_count) query = {} #: Hash[String, untyped] query["pageIndex"] = page_index unless page_index.nil? query["pageCount"] = page_count unless page_count.nil? response = get(path, query: query) hydrate(Nfe::TaxCodePaginatedResponse, parse_json(response.body)) end |