Class: Mindee::Product::DeliveryNote::DeliveryNoteV1Document

Inherits:
Mindee::Parsing::Common::Prediction show all
Includes:
Mindee::Parsing::Standard
Defined in:
lib/mindee/product/delivery_note/delivery_note_v1_document.rb

Overview

Delivery note API version 1.2 document data.

Direct Known Subclasses

DeliveryNoteV1PagePrediction

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(prediction, page_id) ⇒ DeliveryNoteV1Document

Returns a new instance of DeliveryNoteV1Document.

Parameters:

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


35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/mindee/product/delivery_note/delivery_note_v1_document.rb', line 35

def initialize(prediction, page_id)
  super
  @customer_address = Parsing::Standard::StringField.new(
    prediction['customer_address'],
    page_id
  )
  @customer_name = Parsing::Standard::StringField.new(
    prediction['customer_name'],
    page_id
  )
  @delivery_date = Parsing::Standard::DateField.new(
    prediction['delivery_date'],
    page_id
  )
  @delivery_number = Parsing::Standard::StringField.new(
    prediction['delivery_number'],
    page_id
  )
  @supplier_address = Parsing::Standard::StringField.new(
    prediction['supplier_address'],
    page_id
  )
  @supplier_name = Parsing::Standard::StringField.new(
    prediction['supplier_name'],
    page_id
  )
  @total_amount = Parsing::Standard::AmountField.new(
    prediction['total_amount'],
    page_id
  )
end

Instance Attribute Details

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

The address of the customer receiving the goods.



13
14
15
# File 'lib/mindee/product/delivery_note/delivery_note_v1_document.rb', line 13

def customer_address
  @customer_address
end

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

The name of the customer receiving the goods.



16
17
18
# File 'lib/mindee/product/delivery_note/delivery_note_v1_document.rb', line 16

def customer_name
  @customer_name
end

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

The date on which the delivery is scheduled to arrive.



19
20
21
# File 'lib/mindee/product/delivery_note/delivery_note_v1_document.rb', line 19

def delivery_date
  @delivery_date
end

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

A unique identifier for the delivery note.



22
23
24
# File 'lib/mindee/product/delivery_note/delivery_note_v1_document.rb', line 22

def delivery_number
  @delivery_number
end

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

The address of the supplier providing the goods.



25
26
27
# File 'lib/mindee/product/delivery_note/delivery_note_v1_document.rb', line 25

def supplier_address
  @supplier_address
end

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

The name of the supplier providing the goods.



28
29
30
# File 'lib/mindee/product/delivery_note/delivery_note_v1_document.rb', line 28

def supplier_name
  @supplier_name
end

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

The total monetary value of the goods being delivered.



31
32
33
# File 'lib/mindee/product/delivery_note/delivery_note_v1_document.rb', line 31

def total_amount
  @total_amount
end

Instance Method Details

#to_sString

Returns:

  • (String)


68
69
70
71
72
73
74
75
76
77
78
# File 'lib/mindee/product/delivery_note/delivery_note_v1_document.rb', line 68

def to_s
  out_str = String.new
  out_str << "\n:Delivery Date: #{@delivery_date}".rstrip
  out_str << "\n:Delivery Number: #{@delivery_number}".rstrip
  out_str << "\n:Supplier Name: #{@supplier_name}".rstrip
  out_str << "\n:Supplier Address: #{@supplier_address}".rstrip
  out_str << "\n:Customer Name: #{@customer_name}".rstrip
  out_str << "\n:Customer Address: #{@customer_address}".rstrip
  out_str << "\n:Total Amount: #{@total_amount}".rstrip
  out_str[1..].to_s
end