Class: Nfe::InboundInvoiceMetadata
- Inherits:
-
Data
- Object
- Data
- Nfe::InboundInvoiceMetadata
- Defined in:
- lib/nfe/resources/dto/inbound_invoice_metadata.rb,
sig/nfe/resources/dto/inbound_invoice_metadata.rbs
Overview
Immutable value object for the metadata of an inbound document (CT-e or
supplier NF-e) returned by the api.nfse.io inbound endpoints when looked
up by 44-digit access key, or by an event lookup.
Hand-written so the public surface stays small and snake_case. InboundInvoiceMetadata.from_api
maps the API camelCase keys onto snake_case members, drops unknown keys, and
is nil-tolerant. The full payload is preserved in details (including the
webhook-v2 productInvoices array, when present) so callers can read fields
the SDK does not surface yet.
Instance Attribute Summary collapse
-
#access_key ⇒ String?
readonly
Returns the value of attribute access_key.
-
#details ⇒ Object
readonly
Returns the value of attribute details.
-
#federal_tax_number_sender ⇒ String?
readonly
Returns the value of attribute federal_tax_number_sender.
-
#issued_on ⇒ String?
readonly
Returns the value of attribute issued_on.
-
#name_sender ⇒ String?
readonly
Returns the value of attribute name_sender.
-
#nsu ⇒ Object
readonly
Returns the value of attribute nsu.
-
#product_invoices ⇒ Object
readonly
Returns the value of attribute product_invoices.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#total_invoice_amount ⇒ Object
readonly
Returns the value of attribute total_invoice_amount.
Class Method Summary collapse
-
.from_api(payload) ⇒ Nfe::InboundInvoiceMetadata?
Build a InboundInvoiceMetadata from an API payload.
- .new ⇒ instance
-
.stringify(value) ⇒ String?
private
Coerce a tax number to a
Stringwithout numeric coercion.
Instance Method Summary collapse
-
#initialize ⇒ InboundInvoiceMetadata
constructor
A new instance of InboundInvoiceMetadata.
Constructor Details
#initialize ⇒ InboundInvoiceMetadata
Returns a new instance of InboundInvoiceMetadata.
19 |
# File 'sig/nfe/resources/dto/inbound_invoice_metadata.rbs', line 19
def initialize: (access_key: String?, nsu: untyped, status: untyped, name_sender: String?, federal_tax_number_sender: String?, total_invoice_amount: untyped, issued_on: String?, product_invoices: untyped, details: untyped) -> void
|
Instance Attribute Details
#access_key ⇒ String? (readonly)
Returns the value of attribute access_key.
3 4 5 |
# File 'sig/nfe/resources/dto/inbound_invoice_metadata.rbs', line 3 def access_key @access_key end |
#details ⇒ Object (readonly)
Returns the value of attribute details.
11 12 13 |
# File 'sig/nfe/resources/dto/inbound_invoice_metadata.rbs', line 11 def details @details end |
#federal_tax_number_sender ⇒ String? (readonly)
Returns the value of attribute federal_tax_number_sender.
7 8 9 |
# File 'sig/nfe/resources/dto/inbound_invoice_metadata.rbs', line 7 def federal_tax_number_sender @federal_tax_number_sender end |
#issued_on ⇒ String? (readonly)
Returns the value of attribute issued_on.
9 10 11 |
# File 'sig/nfe/resources/dto/inbound_invoice_metadata.rbs', line 9 def issued_on @issued_on end |
#name_sender ⇒ String? (readonly)
Returns the value of attribute name_sender.
6 7 8 |
# File 'sig/nfe/resources/dto/inbound_invoice_metadata.rbs', line 6 def name_sender @name_sender end |
#nsu ⇒ Object (readonly)
Returns the value of attribute nsu.
4 5 6 |
# File 'sig/nfe/resources/dto/inbound_invoice_metadata.rbs', line 4 def nsu @nsu end |
#product_invoices ⇒ Object (readonly)
Returns the value of attribute product_invoices.
10 11 12 |
# File 'sig/nfe/resources/dto/inbound_invoice_metadata.rbs', line 10 def product_invoices @product_invoices end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
5 6 7 |
# File 'sig/nfe/resources/dto/inbound_invoice_metadata.rbs', line 5 def status @status end |
#total_invoice_amount ⇒ Object (readonly)
Returns the value of attribute total_invoice_amount.
8 9 10 |
# File 'sig/nfe/resources/dto/inbound_invoice_metadata.rbs', line 8 def total_invoice_amount @total_invoice_amount end |
Class Method Details
.from_api(payload) ⇒ Nfe::InboundInvoiceMetadata?
Build a Nfe::InboundInvoiceMetadata from an API payload.
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/nfe/resources/dto/inbound_invoice_metadata.rb', line 28 def self.from_api(payload) return nil if payload.nil? new( access_key: payload["accessKey"] || payload["accesskey"], nsu: payload["nsu"], status: payload["status"], name_sender: payload["nameSender"], federal_tax_number_sender: stringify(payload["federalTaxNumberSender"]), total_invoice_amount: payload["totalInvoiceAmount"], issued_on: payload["issuedOn"], product_invoices: payload["productInvoices"], details: payload ) end |
.new ⇒ instance
17 |
# File 'sig/nfe/resources/dto/inbound_invoice_metadata.rbs', line 17
def self.new: (access_key: String?, nsu: untyped, status: untyped, name_sender: String?, federal_tax_number_sender: String?, total_invoice_amount: untyped, issued_on: String?, product_invoices: untyped, details: untyped) -> instance
|
.stringify(value) ⇒ String?
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Coerce a tax number to a String without numeric coercion. nil stays
nil.
48 49 50 |
# File 'lib/nfe/resources/dto/inbound_invoice_metadata.rb', line 48 def self.stringify(value) value&.to_s end |