Class: Mindee::Parsing::V2::Inference

Inherits:
Object
  • Object
show all
Defined in:
lib/mindee/parsing/v2/inference.rb

Overview

Complete data returned by an inference request.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(server_response) ⇒ Inference

Returns a new instance of Inference.

Raises:

  • (ArgumentError)


25
26
27
28
29
30
31
32
33
34
# File 'lib/mindee/parsing/v2/inference.rb', line 25

def initialize(server_response)
  raise ArgumentError, 'server_response must be a Hash' unless server_response.is_a?(Hash)

  @model  = InferenceModel.new(server_response['model'])
  @file   = InferenceFile.new(server_response['file'])
  @active_options = InferenceActiveOptions.new(server_response['active_options'])
  @result = InferenceResult.new(server_response['result'])

  @id = server_response['id']
end

Instance Attribute Details

#active_optionsInferenceActiveOptions (readonly)



20
21
22
# File 'lib/mindee/parsing/v2/inference.rb', line 20

def active_options
  @active_options
end

#fileInferenceFile (readonly)



18
19
20
# File 'lib/mindee/parsing/v2/inference.rb', line 18

def file
  @file
end

#idString (readonly)



14
15
16
# File 'lib/mindee/parsing/v2/inference.rb', line 14

def id
  @id
end

#modelInferenceModel (readonly)



16
17
18
# File 'lib/mindee/parsing/v2/inference.rb', line 16

def model
  @model
end

#resultInferenceResult (readonly)



22
23
24
# File 'lib/mindee/parsing/v2/inference.rb', line 22

def result
  @result
end

Instance Method Details

#to_sString

String representation.



38
39
40
41
42
43
44
45
46
47
48
# File 'lib/mindee/parsing/v2/inference.rb', line 38

def to_s
  [
    'Inference',
    '#########',
    @model.to_s,
    @file.to_s,
    @active_options.to_s,
    @result.to_s,
    '',
  ].join("\n")
end