Class: Nfe::Resources::NaturalPersonLookup
- Inherits:
-
AbstractResource
- Object
- AbstractResource
- Nfe::Resources::NaturalPersonLookup
- Defined in:
- lib/nfe/resources/natural_person_lookup.rb,
sig/nfe/resources/natural_person_lookup.rbs
Overview
Read-only lookups against the naturalperson data API
(+https://naturalperson.api.nfe.io+). The version segment is embedded in
the request path, so api_version is "".
Instance Attribute Summary
Attributes inherited from AbstractResource
Instance Method Summary collapse
- #api_family ⇒ Symbol
-
#api_version ⇒ String
This family's host embeds the version in the path, so no version segment is prefixed to the request path.
-
#get_status(federal_tax_number, birth_date) ⇒ Nfe::NaturalPersonStatusResponse?
Fetch the registration status of a natural person (CPF) at the federal tax authority.
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
28 |
# File 'lib/nfe/resources/natural_person_lookup.rb', line 28 def api_family = :natural_person |
#api_version ⇒ String
This family's host embeds the version in the path, so no version segment is prefixed to the request path.
32 |
# File 'lib/nfe/resources/natural_person_lookup.rb', line 32 def api_version = "" |
#get_status(federal_tax_number, birth_date) ⇒ Nfe::NaturalPersonStatusResponse?
Fetch the registration status of a natural person (CPF) at the federal
tax authority. The CPF is normalized to 11 digits and the birth date to
YYYY-MM-DD before the request is issued (fail-fast).
19 20 21 22 23 24 |
# File 'lib/nfe/resources/natural_person_lookup.rb', line 19 def get_status(federal_tax_number, birth_date) cpf = Nfe::IdValidator.cpf(federal_tax_number) date = Nfe::DateNormalizer.to_iso_date(birth_date) response = get("/v1/naturalperson/status/#{cpf}/#{date}") hydrate(Nfe::NaturalPersonStatusResponse, parse_json(response.body)) end |