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.0 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
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 64

def initialize(prediction, page_id)
  super()
  @contract_id = StringField.new(prediction['contract_id'], page_id)
  @delivery_point = StringField.new(prediction['delivery_point'], page_id)
  @due_date = DateField.new(prediction['due_date'], page_id)
  @energy_consumer = EnergyBillV1EnergyConsumer.new(prediction['energy_consumer'], page_id)
  @energy_supplier = EnergyBillV1EnergySupplier.new(prediction['energy_supplier'], page_id)
  @energy_usage = []
  prediction['energy_usage'].each do |item|
    @energy_usage.push(EnergyBillV1EnergyUsage.new(item, page_id))
  end
  @invoice_date = DateField.new(prediction['invoice_date'], page_id)
  @invoice_number = StringField.new(prediction['invoice_number'], page_id)
  @meter_details = EnergyBillV1MeterDetail.new(prediction['meter_details'], page_id)
  @subscription = []
  prediction['subscription'].each do |item|
    @subscription.push(EnergyBillV1Subscription.new(item, page_id))
  end
  @taxes_and_contributions = []
  prediction['taxes_and_contributions'].each do |item|
    @taxes_and_contributions.push(EnergyBillV1TaxesAndContribution.new(item, page_id))
  end
  @total_amount = AmountField.new(prediction['total_amount'], page_id)
  @total_before_taxes = AmountField.new(prediction['total_before_taxes'], page_id)
  @total_taxes = 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_usageArray<Mindee::Product::FR::EnergyBill::EnergyBillV1EnergyUsage> (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

#subscriptionArray<Mindee::Product::FR::EnergyBill::EnergyBillV1Subscription> (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_contributionsArray<Mindee::Product::FR::EnergyBill::EnergyBillV1TaxesAndContribution> (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)


92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_document.rb', line 92

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