Class: Nfe::InboundSettings

Inherits:
Data
  • Object
show all
Defined in:
lib/nfe/resources/dto/inbound_settings.rb,
sig/nfe/resources/dto/inbound_settings.rbs

Overview

Immutable value object for the inbound auto-fetch settings returned by the CT-e / inbound NF-e endpoints on api.nfse.io (+/v2/companies/#id/inbound/(transportation|product)invoices+).

Hand-written (the consulta-cte-v2 generated tree does not expose a clean settings shape) so the public surface stays small and snake_case. InboundSettings.from_api maps the API camelCase keys onto the snake_case members, drops unknown keys, and is nil-tolerant (+from_api(nil)+ returns nil). The raw payload is preserved in details so callers can read fields the SDK does not surface yet.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeInboundSettings

Returns a new instance of InboundSettings.

Parameters:

  • id: (String, nil)
  • status: (Object)
  • start_from_nsu: (Object)
  • start_from_date: (String, nil)
  • environment_sefaz: (String, nil)
  • automatic_manifesting: (Object)
  • webhook_version: (Object)
  • created_on: (String, nil)
  • modified_on: (String, nil)
  • details: (Object)


18
# File 'sig/nfe/resources/dto/inbound_settings.rbs', line 18

def initialize: (id: String?, status: untyped, start_from_nsu: untyped, start_from_date: String?, environment_sefaz: String?, automatic_manifesting: untyped, webhook_version: untyped, created_on: String?, modified_on: String?, details: untyped) -> void

Instance Attribute Details

#automatic_manifestingObject (readonly)

Returns the value of attribute automatic_manifesting.

Returns:

  • (Object)


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

def automatic_manifesting
  @automatic_manifesting
end

#created_onString? (readonly)

Returns the value of attribute created_on.

Returns:

  • (String, nil)


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

def created_on
  @created_on
end

#detailsObject (readonly)

Returns the value of attribute details.

Returns:

  • (Object)


12
13
14
# File 'sig/nfe/resources/dto/inbound_settings.rbs', line 12

def details
  @details
end

#environment_sefazString? (readonly)

Returns the value of attribute environment_sefaz.

Returns:

  • (String, nil)


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

def environment_sefaz
  @environment_sefaz
end

#idString? (readonly)

Returns the value of attribute id.

Returns:

  • (String, nil)


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

def id
  @id
end

#modified_onString? (readonly)

Returns the value of attribute modified_on.

Returns:

  • (String, nil)


11
12
13
# File 'sig/nfe/resources/dto/inbound_settings.rbs', line 11

def modified_on
  @modified_on
end

#start_from_dateString? (readonly)

Returns the value of attribute start_from_date.

Returns:

  • (String, nil)


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

def start_from_date
  @start_from_date
end

#start_from_nsuObject (readonly)

Returns the value of attribute start_from_nsu.

Returns:

  • (Object)


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

def start_from_nsu
  @start_from_nsu
end

#statusObject (readonly)

Returns the value of attribute status.

Returns:

  • (Object)


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

def status
  @status
end

#webhook_versionObject (readonly)

Returns the value of attribute webhook_version.

Returns:

  • (Object)


9
10
11
# File 'sig/nfe/resources/dto/inbound_settings.rbs', line 9

def webhook_version
  @webhook_version
end

Class Method Details

.from_api(payload) ⇒ Nfe::InboundSettings?

Build a Nfe::InboundSettings from an API payload.

Parameters:

  • payload (Hash, nil)

    the inbound settings object.

Returns:



30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
# File 'lib/nfe/resources/dto/inbound_settings.rb', line 30

def self.from_api(payload)
  return nil if payload.nil?

  new(
    id: payload["id"],
    status: payload["status"],
    start_from_nsu: payload["startFromNsu"],
    start_from_date: payload["startFromDate"],
    environment_sefaz: payload["environmentSefaz"] || payload["environmentSEFAZ"],
    automatic_manifesting: payload["automaticManifesting"],
    webhook_version: payload["webhookVersion"],
    created_on: payload["createdOn"],
    modified_on: payload["modifiedOn"],
    details: payload
  )
end

.newinstance

Parameters:

  • id: (String, nil)
  • status: (Object)
  • start_from_nsu: (Object)
  • start_from_date: (String, nil)
  • environment_sefaz: (String, nil)
  • automatic_manifesting: (Object)
  • webhook_version: (Object)
  • created_on: (String, nil)
  • modified_on: (String, nil)
  • details: (Object)

Returns:

  • (instance)


16
# File 'sig/nfe/resources/dto/inbound_settings.rbs', line 16

def self.new: (id: String?, status: untyped, start_from_nsu: untyped, start_from_date: String?, environment_sefaz: String?, automatic_manifesting: untyped, webhook_version: untyped, created_on: String?, modified_on: String?, details: untyped) -> instance