Class: Nfe::NfeStateTax
- Inherits:
-
Data
- Object
- Data
- Nfe::NfeStateTax
- Defined in:
- lib/nfe/resources/dto/state_taxes/nfe_state_tax.rb,
sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs
Overview
Immutable value object for a company's state-tax (Inscrição Estadual)
registration entry, as returned by the CT-e api.nfse.io state-tax API
under /v2/companies/{companyId}/statetaxes.
Hand-written: the generated contribuintes-v2 model lives under a different
namespace/shape, so this top-level NfeStateTax mirrors only the
fields the Node/PHP SDKs read. NfeStateTax.from_api maps the API camelCase keys onto
snake_case members, drops unknown keys, and is nil-tolerant
(+from_api(nil)+ returns nil). All fields are optional.
Instance Attribute Summary collapse
-
#code ⇒ Object
readonly
Returns the value of attribute code.
-
#environment_type ⇒ Object
readonly
Returns the value of attribute environment_type.
-
#id ⇒ String?
readonly
Returns the value of attribute id.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#serie ⇒ Object
readonly
Returns the value of attribute serie.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#tax_number ⇒ Object
readonly
Returns the value of attribute tax_number.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Class Method Summary collapse
-
.from_api(payload) ⇒ Nfe::NfeStateTax?
Build a NfeStateTax from an API payload.
- .new ⇒ instance
Instance Method Summary collapse
-
#initialize ⇒ NfeStateTax
constructor
A new instance of NfeStateTax.
Constructor Details
#initialize ⇒ NfeStateTax
Returns a new instance of NfeStateTax.
15 |
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 15
def initialize: (id: String?, tax_number: untyped, serie: untyped, number: untyped, code: untyped, environment_type: untyped, type: untyped, status: untyped) -> void
|
Instance Attribute Details
#code ⇒ Object (readonly)
Returns the value of attribute code.
7 8 9 |
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 7 def code @code end |
#environment_type ⇒ Object (readonly)
Returns the value of attribute environment_type.
8 9 10 |
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 8 def environment_type @environment_type end |
#id ⇒ String? (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 3 def id @id end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
6 7 8 |
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 6 def number @number end |
#serie ⇒ Object (readonly)
Returns the value of attribute serie.
5 6 7 |
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 5 def serie @serie end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
10 11 12 |
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 10 def status @status end |
#tax_number ⇒ Object (readonly)
Returns the value of attribute tax_number.
4 5 6 |
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 4 def tax_number @tax_number end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
9 10 11 |
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 9 def type @type end |
Class Method Details
.from_api(payload) ⇒ Nfe::NfeStateTax?
Build a Nfe::NfeStateTax from an API payload.
27 28 29 30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/nfe/resources/dto/state_taxes/nfe_state_tax.rb', line 27 def self.from_api(payload) return nil if payload.nil? new( id: payload["id"], tax_number: payload["taxNumber"], serie: payload["serie"], number: payload["number"], code: payload["code"], environment_type: payload["environmentType"], type: payload["type"], status: payload["status"] ) end |
.new ⇒ instance
14 |
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 14
def self.new: (id: String?, tax_number: untyped, serie: untyped, number: untyped, code: untyped, environment_type: untyped, type: untyped, status: untyped) -> instance
|