Class: Mindee::V1::Product::FR::BankStatement::BankStatementV2Transaction
- Inherits:
-
Mindee::V1::Parsing::Standard::FeatureField
- Object
- Mindee::V1::Parsing::Standard::AbstractField
- Mindee::V1::Parsing::Standard::FeatureField
- Mindee::V1::Product::FR::BankStatement::BankStatementV2Transaction
- Includes:
- Mindee::V1::Parsing::Standard
- Defined in:
- lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rb
Overview
The list of values that represent the financial transactions recorded in a bank statement.
Instance Attribute Summary collapse
-
#amount ⇒ Float
readonly
The monetary amount of the transaction.
-
#date ⇒ String
readonly
The date on which the transaction occurred.
-
#description ⇒ String
readonly
The additional information about the transaction.
Attributes inherited from Mindee::V1::Parsing::Standard::AbstractField
#bounding_box, #confidence, #page_id, #polygon
Instance Method Summary collapse
-
#initialize(prediction, page_id) ⇒ BankStatementV2Transaction
constructor
A new instance of BankStatementV2Transaction.
- #printable_values ⇒ Hash
- #table_printable_values ⇒ Hash
- #to_s ⇒ String
- #to_table_line ⇒ String
Methods inherited from Mindee::V1::Parsing::Standard::FeatureField
Methods inherited from Mindee::V1::Parsing::Standard::AbstractField
array_confidence, array_sum, float_to_string
Constructor Details
#initialize(prediction, page_id) ⇒ BankStatementV2Transaction
Returns a new instance of BankStatementV2Transaction.
26 27 28 29 30 31 32 |
# File 'lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rb', line 26 def initialize(prediction, page_id) super @amount = prediction['amount'] @date = prediction['date'] @description = prediction['description'] @page_id = page_id end |
Instance Attribute Details
#amount ⇒ Float (readonly)
The monetary amount of the transaction.
16 17 18 |
# File 'lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rb', line 16 def amount @amount end |
#date ⇒ String (readonly)
The date on which the transaction occurred.
19 20 21 |
# File 'lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rb', line 19 def date @date end |
#description ⇒ String (readonly)
The additional information about the transaction.
22 23 24 |
# File 'lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rb', line 22 def description @description end |
Instance Method Details
#printable_values ⇒ Hash
35 36 37 38 39 40 41 42 |
# File 'lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rb', line 35 def printable_values printable = {} # @type var printable: Hash[Symbol, String] printable[:amount] = @amount.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@amount) printable[:date] = format_for_display(@date) printable[:description] = format_for_display(@description) printable end |
#table_printable_values ⇒ Hash
45 46 47 48 49 50 51 52 |
# File 'lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rb', line 45 def table_printable_values printable = {} # @type var printable: Hash[Symbol, String] printable[:amount] = @amount.nil? ? '' : Parsing::Standard::BaseField.float_to_string(@amount) printable[:date] = format_for_display(@date, 10) printable[:description] = format_for_display(@description, 36) printable end |
#to_s ⇒ String
65 66 67 68 69 70 71 72 |
# File 'lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rb', line 65 def to_s printable = printable_values out_str = String.new out_str << "\n :Amount: #{printable[:amount]}" out_str << "\n :Date: #{printable[:date]}" out_str << "\n :Description: #{printable[:description]}" out_str end |
#to_table_line ⇒ String
55 56 57 58 59 60 61 62 |
# File 'lib/mindee/v1/product/fr/bank_statement/bank_statement_v2_transaction.rb', line 55 def to_table_line printable = table_printable_values out_str = String.new out_str << format('| %- 11s', printable[:amount]) out_str << format('| %- 11s', printable[:date]) out_str << format('| %- 37s', printable[:description]) out_str << '|' end |