Class: OmniAI::Mistral::OCR::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/omniai/mistral/ocr/image.rb

Overview

An image returned by the OCR API.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id:, top_left_x:, top_left_y:, bottom_right_x:, bottom_right_y:, image_base64:) ⇒ Image

Returns a new instance of Image.

Parameters:

  • id (Integer)
  • top_left_x (Integer)
  • top_left_y (Integer)
  • bottom_right_x (Integer)
  • bottom_right_y (Integer)
  • image_base64 (String)


38
39
40
41
42
43
44
45
# File 'lib/omniai/mistral/ocr/image.rb', line 38

def initialize(id:, top_left_x:, top_left_y:, bottom_right_x:, bottom_right_y:, image_base64:)
  @id = id
  @top_left_x = top_left_x
  @top_left_y = top_left_y
  @bottom_right_x = bottom_right_x
  @bottom_right_y = bottom_right_y
  @image_base64 = image_base64
end

Instance Attribute Details

#bottom_right_xObject

!@attribute [rw] bottom_right_x

@return [Integer]


22
23
24
# File 'lib/omniai/mistral/ocr/image.rb', line 22

def bottom_right_x
  @bottom_right_x
end

#bottom_right_yObject

!@attribute [rw] bottom_right_y

@return [Integer]


26
27
28
# File 'lib/omniai/mistral/ocr/image.rb', line 26

def bottom_right_y
  @bottom_right_y
end

#idObject

!@attribute [rw] id

@return [Integer]


10
11
12
# File 'lib/omniai/mistral/ocr/image.rb', line 10

def id
  @id
end

#image_base64Object

!@attribute [rw] image_base64

@return [String]


30
31
32
# File 'lib/omniai/mistral/ocr/image.rb', line 30

def image_base64
  @image_base64
end

#top_left_xObject

!@attribute [rw] top_left_x

@return [Integer]


14
15
16
# File 'lib/omniai/mistral/ocr/image.rb', line 14

def top_left_x
  @top_left_x
end

#top_left_yObject

!@attribute [rw] top_left_y

@return [Integer]


18
19
20
# File 'lib/omniai/mistral/ocr/image.rb', line 18

def top_left_y
  @top_left_y
end

Class Method Details

.parse(data:) ⇒ Image

Parameters:

  • data (Hash)

Returns:



50
51
52
53
54
55
56
57
58
59
# File 'lib/omniai/mistral/ocr/image.rb', line 50

def self.parse(data:)
  new(
    id: data["id"],
    top_left_x: data["top_left_x"],
    top_left_y: data["top_left_y"],
    bottom_right_x: data["bottom_right_x"],
    bottom_right_y: data["bottom_right_y"],
    image_base64: data["image_base64"]
  )
end