Class: Mindee::Product::FR::EnergyBill::EnergyBillV1Subscriptions

Inherits:
Array
  • Object
show all
Defined in:
lib/mindee/product/fr/energy_bill/energy_bill_v1_subscriptions.rb

Overview

The subscription details fee for the energy service.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction, page_id) ⇒ EnergyBillV1Subscriptions

Returns a new instance of EnergyBillV1Subscriptions.

Parameters:

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


22
23
24
25
26
27
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscriptions.rb', line 22

def initialize(prediction, page_id)
  entries = prediction.map do |entry|
    EnergyBill::EnergyBillV1Subscription.new(entry, page_id)
  end
  super(entries)
end

Instance Attribute Details

#entriesArray<EnergyBillV1Subscription> (readonly)

Entries.

Returns:



18
19
20
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscriptions.rb', line 18

def entries
  @entries
end

Class Method Details

.line_items_separator(char) ⇒ String

Creates a line of rST table-compliant string separators.

Parameters:

  • char (String)

    Character to use as a separator.

Returns:

  • (String)


32
33
34
35
36
37
38
39
40
41
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscriptions.rb', line 32

def self.line_items_separator(char)
  out_str = String.new
  out_str << "+#{char * 38}"
  out_str << "+#{char * 12}"
  out_str << "+#{char * 12}"
  out_str << "+#{char * 10}"
  out_str << "+#{char * 11}"
  out_str << "+#{char * 12}"
  out_str
end

Instance Method Details

#to_sString

Returns:

  • (String)


44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscriptions.rb', line 44

def to_s
  return '' if empty?

  lines = map do |entry|
    "\n  #{entry.to_table_line}\n#{self.class.line_items_separator('-')}"
  end.join
  out_str = String.new
  out_str << ("\n#{self.class.line_items_separator('-')}\n ")
  out_str << ' | Description                         '
  out_str << ' | End Date  '
  out_str << ' | Start Date'
  out_str << ' | Tax Rate'
  out_str << ' | Total    '
  out_str << ' | Unit Price'
  out_str << (" |\n#{self.class.line_items_separator('=')}")
  out_str + lines
end