Class: Nfe::NfeStateTax

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

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeNfeStateTax

Returns a new instance of NfeStateTax.

Parameters:

  • id: (String, nil)
  • tax_number: (Object)
  • serie: (Object)
  • number: (Object)
  • code: (Object)
  • environment_type: (Object)
  • type: (Object)
  • status: (Object)


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

#codeObject (readonly)

Returns the value of attribute code.

Returns:

  • (Object)


7
8
9
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 7

def code
  @code
end

#environment_typeObject (readonly)

Returns the value of attribute environment_type.

Returns:

  • (Object)


8
9
10
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 8

def environment_type
  @environment_type
end

#idString? (readonly)

Returns the value of attribute id.

Returns:

  • (String, nil)


3
4
5
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 3

def id
  @id
end

#numberObject (readonly)

Returns the value of attribute number.

Returns:

  • (Object)


6
7
8
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 6

def number
  @number
end

#serieObject (readonly)

Returns the value of attribute serie.

Returns:

  • (Object)


5
6
7
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 5

def serie
  @serie
end

#statusObject (readonly)

Returns the value of attribute status.

Returns:

  • (Object)


10
11
12
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 10

def status
  @status
end

#tax_numberObject (readonly)

Returns the value of attribute tax_number.

Returns:

  • (Object)


4
5
6
# File 'sig/nfe/resources/dto/state_taxes/nfe_state_tax.rbs', line 4

def tax_number
  @tax_number
end

#typeObject (readonly)

Returns the value of attribute type.

Returns:

  • (Object)


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.

Parameters:

  • payload (Hash, nil)

    the response object.

Returns:



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

.newinstance

Parameters:

  • id: (String, nil)
  • tax_number: (Object)
  • serie: (Object)
  • number: (Object)
  • code: (Object)
  • environment_type: (Object)
  • type: (Object)
  • status: (Object)

Returns:

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