Class: Mindee::Product::FR::EnergyBill::EnergyBillV1Subscription
- Inherits:
-
Mindee::Parsing::Standard::FeatureField
- Object
- Mindee::Parsing::Standard::AbstractField
- Mindee::Parsing::Standard::FeatureField
- Mindee::Product::FR::EnergyBill::EnergyBillV1Subscription
- Includes:
- Mindee::Parsing::Standard
- Defined in:
- lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb
Overview
The subscription details fee for the energy service.
Instance Attribute Summary collapse
-
#description ⇒ String
readonly
Description or details of the subscription.
-
#end_date ⇒ String
readonly
The end date of the subscription.
-
#start_date ⇒ String
readonly
The start date of the subscription.
-
#tax_rate ⇒ Float
readonly
The rate of tax applied to the total cost.
-
#total ⇒ Float
readonly
The total cost of subscription.
-
#unit_price ⇒ Float
readonly
The price per unit of subscription.
Attributes inherited from Mindee::Parsing::Standard::AbstractField
#bounding_box, #confidence, #page_id, #polygon
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ EnergyBillV1Subscription
constructor
A new instance of EnergyBillV1Subscription.
- #printable_values ⇒ Hash
- #table_printable_values ⇒ Hash
- #to_s ⇒ String
- #to_table_line ⇒ String
Methods inherited from Mindee::Parsing::Standard::FeatureField
Methods inherited from Mindee::Parsing::Standard::AbstractField
array_confidence, array_sum, float_to_string
Constructor Details
#initialize(prediction, page_id) ⇒ EnergyBillV1Subscription
Returns a new instance of EnergyBillV1Subscription.
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb', line 33 def initialize(prediction, page_id) super(prediction, page_id) @description = prediction['description'] @end_date = prediction['end_date'] @start_date = prediction['start_date'] @tax_rate = prediction['tax_rate'] @total = prediction['total'] @unit_price = prediction['unit_price'] @page_id = page_id end |
Instance Attribute Details
#description ⇒ String (readonly)
Description or details of the subscription.
14 15 16 |
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb', line 14 def description @description end |
#end_date ⇒ String (readonly)
The end date of the subscription.
17 18 19 |
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb', line 17 def end_date @end_date end |
#start_date ⇒ String (readonly)
The start date of the subscription.
20 21 22 |
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb', line 20 def start_date @start_date end |
#tax_rate ⇒ Float (readonly)
The rate of tax applied to the total cost.
23 24 25 |
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb', line 23 def tax_rate @tax_rate end |
#total ⇒ Float (readonly)
The total cost of subscription.
26 27 28 |
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb', line 26 def total @total end |
#unit_price ⇒ Float (readonly)
The price per unit of subscription.
29 30 31 |
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb', line 29 def unit_price @unit_price end |
Instance Method Details
#printable_values ⇒ Hash
45 46 47 48 49 50 51 52 53 54 |
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb', line 45 def printable_values printable = {} printable[:description] = format_for_display(@description) printable[:end_date] = format_for_display(@end_date) printable[:start_date] = format_for_display(@start_date) printable[:tax_rate] = @tax_rate.nil? ? '' : Field.float_to_string(@tax_rate) printable[:total] = @total.nil? ? '' : Field.float_to_string(@total) printable[:unit_price] = @unit_price.nil? ? '' : Field.float_to_string(@unit_price) printable end |
#table_printable_values ⇒ Hash
57 58 59 60 61 62 63 64 65 66 |
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb', line 57 def table_printable_values printable = {} printable[:description] = format_for_display(@description, 36) printable[:end_date] = format_for_display(@end_date, 10) printable[:start_date] = format_for_display(@start_date, nil) printable[:tax_rate] = @tax_rate.nil? ? '' : Field.float_to_string(@tax_rate) printable[:total] = @total.nil? ? '' : Field.float_to_string(@total) printable[:unit_price] = @unit_price.nil? ? '' : Field.float_to_string(@unit_price) printable end |
#to_s ⇒ String
82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb', line 82 def to_s printable = printable_values out_str = String.new out_str << "\n :Description: #{printable[:description]}" out_str << "\n :End Date: #{printable[:end_date]}" out_str << "\n :Start Date: #{printable[:start_date]}" out_str << "\n :Tax Rate: #{printable[:tax_rate]}" out_str << "\n :Total: #{printable[:total]}" out_str << "\n :Unit Price: #{printable[:unit_price]}" out_str end |
#to_table_line ⇒ String
69 70 71 72 73 74 75 76 77 78 79 |
# File 'lib/mindee/product/fr/energy_bill/energy_bill_v1_subscription.rb', line 69 def to_table_line printable = table_printable_values out_str = String.new out_str << format('| %- 37s', printable[:description]) out_str << format('| %- 11s', printable[:end_date]) out_str << format('| %- 11s', printable[:start_date]) out_str << format('| %- 9s', printable[:tax_rate]) out_str << format('| %- 10s', printable[:total]) out_str << format('| %- 11s', printable[:unit_price]) out_str << '|' end |