Class: Nfe::AccountWebhook
- Inherits:
-
Data
- Object
- Data
- Nfe::AccountWebhook
- 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
-
#content_type ⇒ String?
readonly
Returns the value of attribute content_type.
-
#created_on ⇒ String?
readonly
Returns the value of attribute created_on.
-
#filters ⇒ Array[String]?
readonly
Returns the value of attribute filters.
-
#headers ⇒ Object
readonly
Returns the value of attribute headers.
-
#id ⇒ String?
readonly
Returns the value of attribute id.
-
#insecure_ssl ⇒ Boolean?
readonly
Returns the value of attribute insecure_ssl.
-
#modified_on ⇒ String?
readonly
Returns the value of attribute modified_on.
-
#properties ⇒ Object
readonly
Returns the value of attribute properties.
-
#secret ⇒ String?
readonly
Returns the value of attribute secret.
-
#status ⇒ String?
readonly
Returns the value of attribute status.
-
#uri ⇒ String?
readonly
Returns the value of attribute uri.
Class Method Summary collapse
-
.from_api(payload) ⇒ Nfe::AccountWebhook?
nilwhenpayloadisnil. - .new ⇒ instance
Instance Method Summary collapse
-
#initialize ⇒ AccountWebhook
constructor
A new instance of AccountWebhook.
Constructor Details
#initialize ⇒ AccountWebhook
Returns a new instance of AccountWebhook.
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_type ⇒ String? (readonly)
Returns the value of attribute content_type.
5 6 7 |
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 5 def content_type @content_type end |
#created_on ⇒ String? (readonly)
Returns the value of attribute created_on.
12 13 14 |
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 12 def created_on @created_on end |
#filters ⇒ Array[String]? (readonly)
Returns the value of attribute filters.
7 8 9 |
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 7 def filters @filters end |
#headers ⇒ Object (readonly)
Returns the value of attribute headers.
9 10 11 |
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 9 def headers @headers end |
#id ⇒ String? (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 3 def id @id end |
#insecure_ssl ⇒ Boolean? (readonly)
Returns the value of attribute insecure_ssl.
8 9 10 |
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 8 def insecure_ssl @insecure_ssl end |
#modified_on ⇒ String? (readonly)
Returns the value of attribute modified_on.
13 14 15 |
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 13 def modified_on @modified_on end |
#properties ⇒ Object (readonly)
Returns the value of attribute properties.
10 11 12 |
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 10 def properties @properties end |
#secret ⇒ String? (readonly)
Returns the value of attribute secret.
6 7 8 |
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 6 def secret @secret end |
#status ⇒ String? (readonly)
Returns the value of attribute status.
11 12 13 |
# File 'sig/nfe/resources/dto/account_webhook.rbs', line 11 def status @status end |
#uri ⇒ String? (readonly)
Returns the value of attribute uri.
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.
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 |
.new ⇒ 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
|