Class: Nfe::LegalEntity
- Inherits:
-
Data
- Object
- Data
- Nfe::LegalEntity
- Defined in:
- lib/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rb,
sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs
Overview
Immutable value object for a legal entity (pessoa jurÃdica) as returned by
the NFE.io legalentity.api.nfe.io basicInfo lookup. All fields are
optional; LegalEntity.from_api maps API camelCase keys onto snake_case members and is
nil-tolerant (+from_api(nil)+ returns nil).
federal_tax_number is kept as a String (CNPJ), never coerced to
Integer, preserving future alphanumeric CNPJ. address, phones,
partners and economic_activities are passed through opaquely.
Instance Attribute Summary collapse
-
#address ⇒ Object
readonly
Returns the value of attribute address.
-
#economic_activities ⇒ Object
readonly
Returns the value of attribute economic_activities.
-
#email ⇒ String?
readonly
Returns the value of attribute email.
-
#federal_tax_number ⇒ String?
readonly
Returns the value of attribute federal_tax_number.
-
#issued_on ⇒ String?
readonly
Returns the value of attribute issued_on.
-
#legal_nature ⇒ Object
readonly
Returns the value of attribute legal_nature.
-
#name ⇒ String?
readonly
Returns the value of attribute name.
-
#opened_on ⇒ String?
readonly
Returns the value of attribute opened_on.
-
#partners ⇒ Object
readonly
Returns the value of attribute partners.
-
#phones ⇒ Object
readonly
Returns the value of attribute phones.
-
#registration_unit ⇒ String?
readonly
Returns the value of attribute registration_unit.
-
#responsable_entity ⇒ String?
readonly
Returns the value of attribute responsable_entity.
-
#share_capital ⇒ Object
readonly
Returns the value of attribute share_capital.
-
#size ⇒ Object
readonly
Returns the value of attribute size.
-
#special_status ⇒ String?
readonly
Returns the value of attribute special_status.
-
#special_status_on ⇒ String?
readonly
Returns the value of attribute special_status_on.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#status_on ⇒ String?
readonly
Returns the value of attribute status_on.
-
#status_reason ⇒ String?
readonly
Returns the value of attribute status_reason.
-
#trade_name ⇒ String?
readonly
Returns the value of attribute trade_name.
-
#unit ⇒ Object
readonly
Returns the value of attribute unit.
Class Method Summary collapse
-
.from_api(payload) ⇒ Nfe::LegalEntity?
nilwhenpayloadisnil. - .new ⇒ instance
Instance Method Summary collapse
-
#initialize ⇒ LegalEntity
constructor
A new instance of LegalEntity.
Constructor Details
#initialize ⇒ LegalEntity
Returns a new instance of LegalEntity.
29 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 29
def initialize: (federal_tax_number: String?, name: String?, trade_name: String?, status: untyped, status_on: String?, status_reason: String?, legal_nature: untyped, size: untyped, opened_on: String?, issued_on: String?, special_status: String?, special_status_on: String?, responsable_entity: String?, share_capital: untyped, registration_unit: String?, unit: untyped, address: untyped, phones: untyped, email: String?, economic_activities: untyped, partners: untyped) -> void
|
Instance Attribute Details
#address ⇒ Object (readonly)
Returns the value of attribute address.
19 20 21 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 19 def address @address end |
#economic_activities ⇒ Object (readonly)
Returns the value of attribute economic_activities.
22 23 24 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 22 def economic_activities @economic_activities end |
#email ⇒ String? (readonly)
Returns the value of attribute email.
21 22 23 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 21 def email @email end |
#federal_tax_number ⇒ String? (readonly)
Returns the value of attribute federal_tax_number.
3 4 5 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 3 def federal_tax_number @federal_tax_number end |
#issued_on ⇒ String? (readonly)
Returns the value of attribute issued_on.
12 13 14 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 12 def issued_on @issued_on end |
#legal_nature ⇒ Object (readonly)
Returns the value of attribute legal_nature.
9 10 11 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 9 def legal_nature @legal_nature end |
#name ⇒ String? (readonly)
Returns the value of attribute name.
4 5 6 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 4 def name @name end |
#opened_on ⇒ String? (readonly)
Returns the value of attribute opened_on.
11 12 13 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 11 def opened_on @opened_on end |
#partners ⇒ Object (readonly)
Returns the value of attribute partners.
23 24 25 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 23 def partners @partners end |
#phones ⇒ Object (readonly)
Returns the value of attribute phones.
20 21 22 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 20 def phones @phones end |
#registration_unit ⇒ String? (readonly)
Returns the value of attribute registration_unit.
17 18 19 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 17 def registration_unit @registration_unit end |
#responsable_entity ⇒ String? (readonly)
Returns the value of attribute responsable_entity.
15 16 17 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 15 def responsable_entity @responsable_entity end |
#share_capital ⇒ Object (readonly)
Returns the value of attribute share_capital.
16 17 18 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 16 def share_capital @share_capital end |
#size ⇒ Object (readonly)
Returns the value of attribute size.
10 11 12 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 10 def size @size end |
#special_status ⇒ String? (readonly)
Returns the value of attribute special_status.
13 14 15 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 13 def special_status @special_status end |
#special_status_on ⇒ String? (readonly)
Returns the value of attribute special_status_on.
14 15 16 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 14 def special_status_on @special_status_on end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 6 def status @status end |
#status_on ⇒ String? (readonly)
Returns the value of attribute status_on.
7 8 9 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 7 def status_on @status_on end |
#status_reason ⇒ String? (readonly)
Returns the value of attribute status_reason.
8 9 10 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 8 def status_reason @status_reason end |
#trade_name ⇒ String? (readonly)
Returns the value of attribute trade_name.
5 6 7 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 5 def trade_name @trade_name end |
#unit ⇒ Object (readonly)
Returns the value of attribute unit.
18 19 20 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 18 def unit @unit end |
Class Method Details
.from_api(payload) ⇒ Nfe::LegalEntity?
Returns nil when payload is nil.
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rb', line 39 def self.from_api(payload) return nil if payload.nil? new( federal_tax_number: payload["federalTaxNumber"]&.to_s, name: payload["name"], trade_name: payload["tradeName"], status: payload["status"], status_on: payload["statusOn"], status_reason: payload["statusReason"], legal_nature: payload["legalNature"], size: payload["size"], opened_on: payload["openedOn"], issued_on: payload["issuedOn"], special_status: payload["specialStatus"], special_status_on: payload["specialStatusOn"], responsable_entity: payload["responsableEntity"], share_capital: payload["shareCapital"], registration_unit: payload["registrationUnit"], unit: payload["unit"], address: payload["address"], phones: payload["phones"], email: payload["email"], economic_activities: payload["economicActivities"], partners: payload["partners"] ) end |
.new ⇒ instance
27 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/legal_entity_responses.rbs', line 27
def self.new: (federal_tax_number: String?, name: String?, trade_name: String?, status: untyped, status_on: String?, status_reason: String?, legal_nature: untyped, size: untyped, opened_on: String?, issued_on: String?, special_status: String?, special_status_on: String?, responsable_entity: String?, share_capital: untyped, registration_unit: String?, unit: untyped, address: untyped, phones: untyped, email: String?, economic_activities: untyped, partners: untyped) -> instance
|