Class: Nfe::NaturalPersonStatusResponse

Inherits:
Data
  • Object
show all
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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNaturalPersonStatusResponse

Returns a new instance of NaturalPersonStatusResponse.

Parameters:

  • name: (String, nil)
  • federal_tax_number: (String, nil)
  • birth_on: (String, nil)
  • status: (String, nil)
  • created_on: (String, nil)


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_onString? (readonly)

Returns the value of attribute birth_on.

Returns:

  • (String, nil)


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_onString? (readonly)

Returns the value of attribute created_on.

Returns:

  • (String, nil)


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_numberString? (readonly)

Returns the value of attribute federal_tax_number.

Returns:

  • (String, nil)


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

#nameString? (readonly)

Returns the value of attribute name.

Returns:

  • (String, nil)


3
4
5
# File 'sig/nfe/resources/dto/natural_person_lookup/natural_person_status_response.rbs', line 3

def name
  @name
end

#statusString? (readonly)

Returns the value of attribute status.

Returns:

  • (String, nil)


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.

Parameters:

  • payload (Hash, nil)

    the unwrapped status object.

Returns:



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

.newinstance

Parameters:

  • name: (String, nil)
  • federal_tax_number: (String, nil)
  • birth_on: (String, nil)
  • status: (String, nil)
  • created_on: (String, nil)

Returns:

  • (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