Class: Nfe::AccountWebhook

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

Overview

Immutable value object for an account-level webhook, as returned by the /v2/webhooks API (account scope, envelope {"webHook": {...}} on the wire). This is the shape the live API accepts and returns — confirmed by probe against api.nfe.io (2026-07-02/03) and matching the schema in openapi/nf-servico-v1.yaml.

Wire-format note: the OpenAPI spec declares +contentType+/+status+ as int enums (0/1), but the API serializes strings (+"json"+, "Active") — this DTO follows the wire. secret (32–64 chars) is echoed only on create and omitted on reads, so it is nil on retrieve/list.

AccountWebhook.from_api maps API camelCase onto snake_case, drops unknown keys, and is nil-tolerant (+from_api(nil)+ returns nil).

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeAccountWebhook

Returns a new instance of AccountWebhook.

Parameters:

  • id: (String, nil)
  • uri: (String, nil)
  • content_type: (String, nil)
  • secret: (String, nil)
  • filters: (Array[String], nil)
  • insecure_ssl: (Boolean, nil)
  • headers: (Object)
  • properties: (Object)
  • status: (String, nil)
  • created_on: (String, nil)
  • modified_on: (String, nil)


19
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 19

def initialize: (id: String?, uri: String?, content_type: String?, secret: String?, filters: Array[String]?, insecure_ssl: bool?, headers: untyped, properties: untyped, status: String?, created_on: String?, modified_on: String?) -> void

Instance Attribute Details

#content_typeString? (readonly)

Returns the value of attribute content_type.

Returns:

  • (String, nil)


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

def content_type
  @content_type
end

#created_onString? (readonly)

Returns the value of attribute created_on.

Returns:

  • (String, nil)


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

def created_on
  @created_on
end

#filtersArray[String]? (readonly)

Returns the value of attribute filters.

Returns:

  • (Array[String], nil)


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

def filters
  @filters
end

#headersObject (readonly)

Returns the value of attribute headers.

Returns:

  • (Object)


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

def headers
  @headers
end

#idString? (readonly)

Returns the value of attribute id.

Returns:

  • (String, nil)


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

def id
  @id
end

#insecure_sslBoolean? (readonly)

Returns the value of attribute insecure_ssl.

Returns:

  • (Boolean, nil)


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

def insecure_ssl
  @insecure_ssl
end

#modified_onString? (readonly)

Returns the value of attribute modified_on.

Returns:

  • (String, nil)


13
14
15
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 13

def modified_on
  @modified_on
end

#propertiesObject (readonly)

Returns the value of attribute properties.

Returns:

  • (Object)


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

def properties
  @properties
end

#secretString? (readonly)

Returns the value of attribute secret.

Returns:

  • (String, nil)


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

def secret
  @secret
end

#statusString? (readonly)

Returns the value of attribute status.

Returns:

  • (String, nil)


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

def status
  @status
end

#uriString? (readonly)

Returns the value of attribute uri.

Returns:

  • (String, nil)


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

def uri
  @uri
end

Class Method Details

.from_api(payload) ⇒ Nfe::AccountWebhook?

Returns nil when payload is nil.

Parameters:

  • payload (Hash, nil)

    the unwrapped webhook object.

Returns:



32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/nfe/resources/dto/account_webhook.rb', line 32

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

  new(
    id: payload["id"],
    uri: payload["uri"],
    content_type: payload["contentType"],
    secret: payload["secret"],
    filters: payload["filters"],
    insecure_ssl: payload["insecureSsl"],
    headers: payload["headers"],
    properties: payload["properties"],
    status: payload["status"],
    created_on: payload["createdOn"],
    modified_on: payload["modifiedOn"]
  )
end

.newinstance

Parameters:

  • id: (String, nil)
  • uri: (String, nil)
  • content_type: (String, nil)
  • secret: (String, nil)
  • filters: (Array[String], nil)
  • insecure_ssl: (Boolean, nil)
  • headers: (Object)
  • properties: (Object)
  • status: (String, nil)
  • created_on: (String, nil)
  • modified_on: (String, nil)

Returns:

  • (instance)


17
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 17

def self.new: (id: String?, uri: String?, content_type: String?, secret: String?, filters: Array[String]?, insecure_ssl: bool?, headers: untyped, properties: untyped, status: String?, created_on: String?, modified_on: String?) -> instance