Class: Nfe::StateTaxLegalEntity
- Inherits:
-
Data
- Object
- Data
- Nfe::StateTaxLegalEntity
- Defined in:
- lib/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rb,
sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs
Overview
Immutable value object for the legalEntity object returned by the NFE.io
state-tax lookup endpoints (+stateTaxInfo+, stateTaxForInvoice,
stateTaxSuggestedForInvoice) on legalentity.api.nfe.io.
This is a DIFFERENT shape from the basicInfo LegalEntity: it carries
the company-level tax-regime fields plus a stateTaxes collection of state
registrations (Inscrições Estaduais). All fields are optional; StateTaxLegalEntity.from_api
maps API camelCase keys onto snake_case members and is nil-tolerant
(+from_api(nil)+ returns nil).
Defined Under Namespace
Classes: Address, EconomicActivity, FiscalDocumentInfo, StateTax
Instance Attribute Summary collapse
-
#check_code ⇒ String?
readonly
Returns the value of attribute check_code.
-
#created_on ⇒ String?
readonly
Returns the value of attribute created_on.
-
#created_unit ⇒ String?
readonly
Returns the value of attribute created_unit.
-
#federal_tax_number ⇒ String?
readonly
Returns the value of attribute federal_tax_number.
-
#fiscal_unit ⇒ String?
readonly
Returns the value of attribute fiscal_unit.
-
#legal_nature ⇒ Object
readonly
Returns the value of attribute legal_nature.
-
#name ⇒ String?
readonly
Returns the value of attribute name.
-
#state_taxes ⇒ Object
readonly
Returns the value of attribute state_taxes.
-
#tax_regime ⇒ Object
readonly
Returns the value of attribute tax_regime.
-
#trade_name ⇒ String?
readonly
Returns the value of attribute trade_name.
Class Method Summary collapse
-
.from_api(payload) ⇒ Nfe::StateTaxLegalEntity?
nilwhenpayloadisnil. - .new ⇒ instance
Instance Method Summary collapse
-
#initialize ⇒ StateTaxLegalEntity
constructor
A new instance of StateTaxLegalEntity.
Constructor Details
#initialize ⇒ StateTaxLegalEntity
Returns a new instance of StateTaxLegalEntity.
69 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs', line 69
def initialize: (federal_tax_number: String?, name: String?, trade_name: String?, tax_regime: untyped, legal_nature: untyped, fiscal_unit: String?, created_unit: String?, created_on: String?, check_code: String?, state_taxes: untyped) -> void
|
Instance Attribute Details
#check_code ⇒ String? (readonly)
Returns the value of attribute check_code.
64 65 66 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs', line 64 def check_code @check_code end |
#created_on ⇒ String? (readonly)
Returns the value of attribute created_on.
63 64 65 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs', line 63 def created_on @created_on end |
#created_unit ⇒ String? (readonly)
Returns the value of attribute created_unit.
62 63 64 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs', line 62 def created_unit @created_unit end |
#federal_tax_number ⇒ String? (readonly)
Returns the value of attribute federal_tax_number.
56 57 58 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs', line 56 def federal_tax_number @federal_tax_number end |
#fiscal_unit ⇒ String? (readonly)
Returns the value of attribute fiscal_unit.
61 62 63 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs', line 61 def fiscal_unit @fiscal_unit end |
#legal_nature ⇒ Object (readonly)
Returns the value of attribute legal_nature.
60 61 62 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs', line 60 def legal_nature @legal_nature end |
#name ⇒ String? (readonly)
Returns the value of attribute name.
57 58 59 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs', line 57 def name @name end |
#state_taxes ⇒ Object (readonly)
Returns the value of attribute state_taxes.
65 66 67 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs', line 65 def state_taxes @state_taxes end |
#tax_regime ⇒ Object (readonly)
Returns the value of attribute tax_regime.
59 60 61 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs', line 59 def tax_regime @tax_regime end |
#trade_name ⇒ String? (readonly)
Returns the value of attribute trade_name.
58 59 60 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs', line 58 def trade_name @trade_name end |
Class Method Details
.from_api(payload) ⇒ Nfe::StateTaxLegalEntity?
Returns nil when payload is nil.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rb', line 110 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"], tax_regime: payload["taxRegime"], legal_nature: payload["legalNature"], fiscal_unit: payload["fiscalUnit"], created_unit: payload["createdUnit"], created_on: payload["createdOn"], check_code: payload["checkCode"]&.to_s, state_taxes: (payload["stateTaxes"] || []).map { |t| StateTax.from_api(t) } ) end |
.new ⇒ instance
68 |
# File 'sig/nfe/resources/dto/legal_entity_lookup/state_tax_legal_entity.rbs', line 68
def self.new: (federal_tax_number: String?, name: String?, trade_name: String?, tax_regime: untyped, legal_nature: untyped, fiscal_unit: String?, created_unit: String?, created_on: String?, check_code: String?, state_taxes: untyped) -> instance
|