Class: Nfe::ProductInvoiceEventsResponse
- Inherits:
-
Data
- Object
- Data
- Nfe::ProductInvoiceEventsResponse
- Defined in:
- lib/nfe/resources/dto/product_invoice_query/product_invoice_events_response.rb,
sig/nfe/resources/dto/product_invoice_query/product_invoice_events_response.rbs
Overview
Immutable value object for the events (eventos) associated with a product
invoice (NF-e), fetched from the nfe.api.nfe.io query API by access key.
Hand-written (the consulta_nfe_distribuicao_v1 generated schema does not
cover this shape). ProductInvoiceEventsResponse.from_api maps API camelCase keys onto snake_case
members, drops unknown keys, and is nil-tolerant (+from_api(nil)+ returns
nil). All fields are optional.
events is kept as the raw payload array (free-form event bodies); a
missing list normalizes to [].
Instance Attribute Summary collapse
-
#created_on ⇒ String?
readonly
Returns the value of attribute created_on.
-
#events ⇒ Object
readonly
Returns the value of attribute events.
Class Method Summary collapse
-
.from_api(payload) ⇒ Nfe::ProductInvoiceEventsResponse?
Build a ProductInvoiceEventsResponse from an API payload.
- .new ⇒ instance
Instance Method Summary collapse
-
#initialize ⇒ ProductInvoiceEventsResponse
constructor
A new instance of ProductInvoiceEventsResponse.
Constructor Details
#initialize ⇒ ProductInvoiceEventsResponse
Returns a new instance of ProductInvoiceEventsResponse.
10 |
# File 'sig/nfe/resources/dto/product_invoice_query/product_invoice_events_response.rbs', line 10
def initialize: (events: untyped, created_on: String?) -> void
|
Instance Attribute Details
#created_on ⇒ String? (readonly)
Returns the value of attribute created_on.
4 5 6 |
# File 'sig/nfe/resources/dto/product_invoice_query/product_invoice_events_response.rbs', line 4 def created_on @created_on end |
#events ⇒ Object (readonly)
Returns the value of attribute events.
3 4 5 |
# File 'sig/nfe/resources/dto/product_invoice_query/product_invoice_events_response.rbs', line 3 def events @events end |
Class Method Details
.from_api(payload) ⇒ Nfe::ProductInvoiceEventsResponse?
Build a Nfe::ProductInvoiceEventsResponse from an API payload.
22 23 24 25 26 27 28 29 |
# File 'lib/nfe/resources/dto/product_invoice_query/product_invoice_events_response.rb', line 22 def self.from_api(payload) return nil if payload.nil? new( events: payload["events"] || [], created_on: payload["createdOn"] ) end |
.new ⇒ instance
8 |
# File 'sig/nfe/resources/dto/product_invoice_query/product_invoice_events_response.rbs', line 8
def self.new: (events: untyped, created_on: String?) -> instance
|