Class: Nfe::ServiceInvoice
- Inherits:
-
Data
- Object
- Data
- Nfe::ServiceInvoice
- Defined in:
- lib/nfe/resources/dto/service_invoice.rb,
sig/nfe/resources/dto/service_invoice.rbs
Overview
Immutable value object for a service invoice (NFS-e) as returned by the
NFE.io api.nfe.io/v1 service-invoice API.
The nf-servico-v1.yaml OpenAPI spec defines NO component schemas (the
shape is derived from the operations), so this DTO is hand-written — mirror
of the fields the Node/PHP SDKs read. ServiceInvoice.from_api maps the API camelCase keys
onto snake_case members, drops unknown keys, and is nil-tolerant
(+from_api(nil)+ returns nil).
flow_status drives the polling lifecycle; pass it to
FlowStatus.terminal? to decide when the document is settled.
Instance Attribute Summary collapse
-
#amount_net ⇒ Object
readonly
Returns the value of attribute amount_net.
-
#borrower ⇒ Object
readonly
Returns the value of attribute borrower.
-
#cancelled_on ⇒ String?
readonly
Returns the value of attribute cancelled_on.
-
#check_code ⇒ String?
readonly
Returns the value of attribute check_code.
-
#city_service_code ⇒ Object
readonly
Returns the value of attribute city_service_code.
-
#created_on ⇒ String?
readonly
Returns the value of attribute created_on.
-
#description ⇒ String?
readonly
Returns the value of attribute description.
-
#environment ⇒ Object
readonly
Returns the value of attribute environment.
-
#federal_service_code ⇒ Object
readonly
Returns the value of attribute federal_service_code.
-
#flow_message ⇒ String?
readonly
Returns the value of attribute flow_message.
-
#flow_status ⇒ String?
readonly
Returns the value of attribute flow_status.
-
#id ⇒ String?
readonly
Returns the value of attribute id.
-
#issued_on ⇒ String?
readonly
Returns the value of attribute issued_on.
-
#modified_on ⇒ String?
readonly
Returns the value of attribute modified_on.
-
#number ⇒ Object
readonly
Returns the value of attribute number.
-
#pdf ⇒ Object
readonly
Returns the value of attribute pdf.
-
#rps_number ⇒ Object
readonly
Returns the value of attribute rps_number.
-
#rps_serial_number ⇒ Object
readonly
Returns the value of attribute rps_serial_number.
-
#services_amount ⇒ Object
readonly
Returns the value of attribute services_amount.
-
#status ⇒ Object
readonly
Returns the value of attribute status.
-
#xml ⇒ Object
readonly
Returns the value of attribute xml.
Class Method Summary collapse
-
.from_api(payload) ⇒ Nfe::ServiceInvoice?
Build a ServiceInvoice from an API payload.
- .new ⇒ instance
Instance Method Summary collapse
-
#initialize ⇒ ServiceInvoice
constructor
A new instance of ServiceInvoice.
Constructor Details
#initialize ⇒ ServiceInvoice
Returns a new instance of ServiceInvoice.
28 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 28
def initialize: (id: String?, flow_status: String?, flow_message: String?, status: untyped, environment: untyped, rps_number: untyped, rps_serial_number: untyped, number: untyped, check_code: String?, issued_on: String?, cancelled_on: String?, amount_net: untyped, services_amount: untyped, borrower: untyped, city_service_code: untyped, federal_service_code: untyped, description: String?, pdf: untyped, xml: untyped, created_on: String?, modified_on: String?) -> void
|
Instance Attribute Details
#amount_net ⇒ Object (readonly)
Returns the value of attribute amount_net.
14 15 16 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 14 def amount_net @amount_net end |
#borrower ⇒ Object (readonly)
Returns the value of attribute borrower.
16 17 18 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 16 def borrower @borrower end |
#cancelled_on ⇒ String? (readonly)
Returns the value of attribute cancelled_on.
13 14 15 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 13 def cancelled_on @cancelled_on end |
#check_code ⇒ String? (readonly)
Returns the value of attribute check_code.
11 12 13 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 11 def check_code @check_code end |
#city_service_code ⇒ Object (readonly)
Returns the value of attribute city_service_code.
17 18 19 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 17 def city_service_code @city_service_code end |
#created_on ⇒ String? (readonly)
Returns the value of attribute created_on.
22 23 24 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 22 def created_on @created_on end |
#description ⇒ String? (readonly)
Returns the value of attribute description.
19 20 21 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 19 def description @description end |
#environment ⇒ Object (readonly)
Returns the value of attribute environment.
7 8 9 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 7 def environment @environment end |
#federal_service_code ⇒ Object (readonly)
Returns the value of attribute federal_service_code.
18 19 20 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 18 def federal_service_code @federal_service_code end |
#flow_message ⇒ String? (readonly)
Returns the value of attribute flow_message.
5 6 7 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 5 def @flow_message end |
#flow_status ⇒ String? (readonly)
Returns the value of attribute flow_status.
4 5 6 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 4 def flow_status @flow_status end |
#id ⇒ String? (readonly)
Returns the value of attribute id.
3 4 5 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 3 def id @id end |
#issued_on ⇒ String? (readonly)
Returns the value of attribute issued_on.
12 13 14 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 12 def issued_on @issued_on end |
#modified_on ⇒ String? (readonly)
Returns the value of attribute modified_on.
23 24 25 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 23 def modified_on @modified_on end |
#number ⇒ Object (readonly)
Returns the value of attribute number.
10 11 12 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 10 def number @number end |
#pdf ⇒ Object (readonly)
Returns the value of attribute pdf.
20 21 22 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 20 def pdf @pdf end |
#rps_number ⇒ Object (readonly)
Returns the value of attribute rps_number.
8 9 10 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 8 def rps_number @rps_number end |
#rps_serial_number ⇒ Object (readonly)
Returns the value of attribute rps_serial_number.
9 10 11 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 9 def rps_serial_number @rps_serial_number end |
#services_amount ⇒ Object (readonly)
Returns the value of attribute services_amount.
15 16 17 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 15 def services_amount @services_amount end |
#status ⇒ Object (readonly)
Returns the value of attribute status.
6 7 8 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 6 def status @status end |
#xml ⇒ Object (readonly)
Returns the value of attribute xml.
21 22 23 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 21 def xml @xml end |
Class Method Details
.from_api(payload) ⇒ Nfe::ServiceInvoice?
Build a Nfe::ServiceInvoice from an API payload.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/nfe/resources/dto/service_invoice.rb', line 42 def self.from_api(payload) return nil if payload.nil? new( id: payload["id"], flow_status: payload["flowStatus"], flow_message: payload["flowMessage"], status: payload["status"], environment: payload["environment"], rps_number: payload["rpsNumber"], rps_serial_number: payload["rpsSerialNumber"], number: payload["number"], check_code: payload["checkCode"], issued_on: payload["issuedOn"], cancelled_on: payload["cancelledOn"], amount_net: payload["amountNet"], services_amount: payload["servicesAmount"], borrower: payload["borrower"], city_service_code: payload["cityServiceCode"], federal_service_code: payload["federalServiceCode"], description: payload["description"], pdf: payload["pdf"], xml: payload["xml"], created_on: payload["createdOn"], modified_on: payload["modifiedOn"] ) end |
.new ⇒ instance
27 |
# File 'sig/nfe/resources/dto/service_invoice.rbs', line 27
def self.new: (id: String?, flow_status: String?, flow_message: String?, status: untyped, environment: untyped, rps_number: untyped, rps_serial_number: untyped, number: untyped, check_code: String?, issued_on: String?, cancelled_on: String?, amount_net: untyped, services_amount: untyped, borrower: untyped, city_service_code: untyped, federal_service_code: untyped, description: String?, pdf: untyped, xml: untyped, created_on: String?, modified_on: String?) -> instance
|