Class: Mindee::Product::FR::EnergyBill::EnergyBillV1Document

Inherits:
Mindee::Parsing::Common::Prediction show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb

Overview

Energy Bill API version 1.2 document data.

Direct Known Subclasses

EnergyBillV1PagePrediction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction, page_id) ⇒ EnergyBillV1Document

Returns a new instance of EnergyBillV1Document.

Parameters:

  • prediction (Hash)
  • page_id (Integer, nil)


64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 64

def initialize(prediction, page_id)
  super
  @contract_id = Parsing::Standard::StringField.new(
    prediction['contract_id'],
    page_id
  )
  @delivery_point = Parsing::Standard::StringField.new(
    prediction['delivery_point'],
    page_id
  )
  @due_date = Parsing::Standard::DateField.new(
    prediction['due_date'],
    page_id
  )
  @energy_consumer = Product::FR::EnergyBill::EnergyBillV1EnergyConsumer.new(
    prediction['energy_consumer'],
    page_id
  )
  @energy_supplier = Product::FR::EnergyBill::EnergyBillV1EnergySupplier.new(
    prediction['energy_supplier'],
    page_id
  )
  @energy_usage = Product::FR::EnergyBill::EnergyBillV1EnergyUsages.new(prediction['energy_usage'], page_id)
  @invoice_date = Parsing::Standard::DateField.new(
    prediction['invoice_date'],
    page_id
  )
  @invoice_number = Parsing::Standard::StringField.new(
    prediction['invoice_number'],
    page_id
  )
  @meter_details = Product::FR::EnergyBill::EnergyBillV1MeterDetail.new(
    prediction['meter_details'],
    page_id
  )
  @subscription = Product::FR::EnergyBill::EnergyBillV1Subscriptions.new(prediction['subscription'], page_id)
  @taxes_and_contributions = Product::FR::EnergyBill::EnergyBillV1TaxesAndContributions.new(
    prediction['taxes_and_contributions'], page_id
  )
  @total_amount = Parsing::Standard::AmountField.new(
    prediction['total_amount'],
    page_id
  )
  @total_before_taxes = Parsing::Standard::AmountField.new(
    prediction['total_before_taxes'],
    page_id
  )
  @total_taxes = Parsing::Standard::AmountField.new(
    prediction['total_taxes'],
    page_id
  )
end

Instance Attribute Details

#contract_idMindee::Parsing::Standard::StringField (readonly)

The unique identifier associated with a specific contract.



20
21
22
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 20

def contract_id
  @contract_id
end

#delivery_pointMindee::Parsing::Standard::StringField (readonly)

The unique identifier assigned to each electricity or gas consumption point. It specifies the exact location where the energy is delivered.



24
25
26
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 24

def delivery_point
  @delivery_point
end

#due_dateMindee::Parsing::Standard::DateField (readonly)

The date by which the payment for the energy invoice is due.



27
28
29
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 27

def due_date
  @due_date
end

#energy_consumerMindee::Product::FR::EnergyBill::EnergyBillV1EnergyConsumer (readonly)

The entity that consumes the energy.



30
31
32
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 30

def energy_consumer
  @energy_consumer
end

#energy_supplierMindee::Product::FR::EnergyBill::EnergyBillV1EnergySupplier (readonly)

The company that supplies the energy.



33
34
35
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 33

def energy_supplier
  @energy_supplier
end

#energy_usageMindee::Product::FR::EnergyBill::EnergyBillV1EnergyUsages (readonly)

Details of energy consumption.



36
37
38
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 36

def energy_usage
  @energy_usage
end

#invoice_dateMindee::Parsing::Standard::DateField (readonly)

The date when the energy invoice was issued.



39
40
41
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 39

def invoice_date
  @invoice_date
end

#invoice_numberMindee::Parsing::Standard::StringField (readonly)

The unique identifier of the energy invoice.



42
43
44
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 42

def invoice_number
  @invoice_number
end

#meter_detailsMindee::Product::FR::EnergyBill::EnergyBillV1MeterDetail (readonly)

Information about the energy meter.



45
46
47
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 45

def meter_details
  @meter_details
end

#subscriptionMindee::Product::FR::EnergyBill::EnergyBillV1Subscriptions (readonly)

The subscription details fee for the energy service.



48
49
50
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 48

def subscription
  @subscription
end

#taxes_and_contributionsMindee::Product::FR::EnergyBill::EnergyBillV1TaxesAndContributions (readonly)

Details of Taxes and Contributions.



51
52
53
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 51

def taxes_and_contributions
  @taxes_and_contributions
end

#total_amountMindee::Parsing::Standard::AmountField (readonly)

The total amount to be paid for the energy invoice.



54
55
56
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 54

def total_amount
  @total_amount
end

#total_before_taxesMindee::Parsing::Standard::AmountField (readonly)

The total amount to be paid for the energy invoice before taxes.



57
58
59
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 57

def total_before_taxes
  @total_before_taxes
end

#total_taxesMindee::Parsing::Standard::AmountField (readonly)

Total of taxes applied to the invoice.



60
61
62
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 60

def total_taxes
  @total_taxes
end

Instance Method Details

#to_sString

Returns:

  • (String)


118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 118

def to_s
  energy_supplier = @energy_supplier.to_s
  energy_consumer = @energy_consumer.to_s
  subscription = subscription_to_s
  energy_usage = energy_usage_to_s
  taxes_and_contributions = taxes_and_contributions_to_s
  meter_details = @meter_details.to_s
  out_str = String.new
  out_str << "\n:Invoice Number: #{@invoice_number}".rstrip
  out_str << "\n:Contract ID: #{@contract_id}".rstrip
  out_str << "\n:Delivery Point: #{@delivery_point}".rstrip
  out_str << "\n:Invoice Date: #{@invoice_date}".rstrip
  out_str << "\n:Due Date: #{@due_date}".rstrip
  out_str << "\n:Total Before Taxes: #{@total_before_taxes}".rstrip
  out_str << "\n:Total Taxes: #{@total_taxes}".rstrip
  out_str << "\n:Total Amount: #{@total_amount}".rstrip
  out_str << "\n:Energy Supplier:"
  out_str << energy_supplier
  out_str << "\n:Energy Consumer:"
  out_str << energy_consumer
  out_str << "\n:Subscription:"
  out_str << subscription
  out_str << "\n:Energy Usage:"
  out_str << energy_usage
  out_str << "\n:Taxes and Contributions:"
  out_str << taxes_and_contributions
  out_str << "\n:Meter Details:"
  out_str << meter_details
  out_str[1..].to_s
end