Class: Nfe::NaturalPersonStatusResponse
- Inherits:
-
Data
- Object
- Data
- Nfe::NaturalPersonStatusResponse
- Defined in:
- lib/nfe/resources/dto/natural_person_lookup/natural_person_status_response.rb,
sig/nfe/resources/dto/natural_person_lookup/natural_person_status_response.rbs
Overview
Immutable value object for the result of a natural-person (CPF) status
lookup against the naturalperson data API. NaturalPersonStatusResponse.from_api maps API camelCase
onto snake_case, drops unknown keys, and is nil-tolerant. All fields are
optional.
federal_tax_number is kept as a String (CPF), never coerced to Integer.
Instance Attribute Summary collapse
-
#birth_on ⇒ String?
readonly
Returns the value of attribute birth_on.
-
#created_on ⇒ String?
readonly
Returns the value of attribute created_on.
-
#federal_tax_number ⇒ String?
readonly
Returns the value of attribute federal_tax_number.
-
#name ⇒ String?
readonly
Returns the value of attribute name.
-
#status ⇒ String?
readonly
Returns the value of attribute status.
Class Method Summary collapse
-
.from_api(payload) ⇒ Nfe::NaturalPersonStatusResponse?
nilwhenpayloadisnil. - .new ⇒ instance
Instance Method Summary collapse
-
#initialize ⇒ NaturalPersonStatusResponse
constructor
A new instance of NaturalPersonStatusResponse.
Constructor Details
#initialize ⇒ NaturalPersonStatusResponse
Returns a new instance of NaturalPersonStatusResponse.
13 |
# File 'sig/nfe/resources/dto/natural_person_lookup/natural_person_status_response.rbs', line 13
def initialize: (name: String?, federal_tax_number: String?, birth_on: String?, status: String?, created_on: String?) -> void
|
Instance Attribute Details
#birth_on ⇒ String? (readonly)
Returns the value of attribute birth_on.
5 6 7 |
# File 'sig/nfe/resources/dto/natural_person_lookup/natural_person_status_response.rbs', line 5 def birth_on @birth_on end |
#created_on ⇒ String? (readonly)
Returns the value of attribute created_on.
7 8 9 |
# File 'sig/nfe/resources/dto/natural_person_lookup/natural_person_status_response.rbs', line 7 def created_on @created_on end |
#federal_tax_number ⇒ String? (readonly)
Returns the value of attribute federal_tax_number.
4 5 6 |
# File 'sig/nfe/resources/dto/natural_person_lookup/natural_person_status_response.rbs', line 4 def federal_tax_number @federal_tax_number end |
#name ⇒ String? (readonly)
Returns the value of attribute name.
3 4 5 |
# File 'sig/nfe/resources/dto/natural_person_lookup/natural_person_status_response.rbs', line 3 def name @name end |
#status ⇒ String? (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'sig/nfe/resources/dto/natural_person_lookup/natural_person_status_response.rbs', line 6 def status @status end |
Class Method Details
.from_api(payload) ⇒ Nfe::NaturalPersonStatusResponse?
Returns nil when payload is nil.
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/nfe/resources/dto/natural_person_lookup/natural_person_status_response.rb', line 19 def self.from_api(payload) return nil if payload.nil? new( name: payload["name"], federal_tax_number: payload["federalTaxNumber"]&.to_s, birth_on: payload["birthOn"], status: payload["status"], created_on: payload["createdOn"] ) end |
.new ⇒ instance
11 |
# File 'sig/nfe/resources/dto/natural_person_lookup/natural_person_status_response.rbs', line 11
def self.new: (name: String?, federal_tax_number: String?, birth_on: String?, status: String?, created_on: String?) -> instance
|