Class: Mindee::V2::Parsing::BaseInference
- Inherits:
-
Mindee::V2::Product::BaseProduct
- Object
- Mindee::V2::Product::BaseProduct
- Mindee::V2::Parsing::BaseInference
- Defined in:
- lib/mindee/v2/parsing/base_inference.rb
Overview
Base class for V2 inference responses.
Direct Known Subclasses
Parsing::V2::Inference, Mindee::V2::Product::Classification::ClassificationInference, Mindee::V2::Product::Crop::CropInference, Mindee::V2::Product::Ocr::OcrInference, Mindee::V2::Product::Split::SplitInference
Instance Attribute Summary collapse
-
#file ⇒ Parsing::V2::InferenceFile
readonly
File info for the inference.
-
#id ⇒ String
readonly
ID of the inference.
-
#job ⇒ InferenceJob
readonly
Metadata about the job.
-
#model ⇒ Parsing::V2::InferenceModel
readonly
Model info for the inference.
Instance Method Summary collapse
-
#initialize(http_response) ⇒ BaseInference
constructor
A new instance of BaseInference.
-
#to_s ⇒ String
String representation.
Constructor Details
#initialize(http_response) ⇒ BaseInference
Returns a new instance of BaseInference.
20 21 22 23 24 25 26 27 28 |
# File 'lib/mindee/v2/parsing/base_inference.rb', line 20 def initialize(http_response) raise ArgumentError, 'Server response must be a Hash' unless http_response.is_a?(Hash) super() @model = Mindee::Parsing::V2::InferenceModel.new(http_response['model']) @file = Mindee::Parsing::V2::InferenceFile.new(http_response['file']) @id = http_response['id'] @job = Mindee::Parsing::V2::InferenceJob.new(http_response['job']) if http_response.key?('job') end |
Instance Attribute Details
#file ⇒ Parsing::V2::InferenceFile (readonly)
Returns File info for the inference.
16 17 18 |
# File 'lib/mindee/v2/parsing/base_inference.rb', line 16 def file @file end |
#id ⇒ String (readonly)
Returns ID of the inference.
18 19 20 |
# File 'lib/mindee/v2/parsing/base_inference.rb', line 18 def id @id end |
#job ⇒ InferenceJob (readonly)
Returns Metadata about the job.
12 13 14 |
# File 'lib/mindee/v2/parsing/base_inference.rb', line 12 def job @job end |
#model ⇒ Parsing::V2::InferenceModel (readonly)
Returns Model info for the inference.
14 15 16 |
# File 'lib/mindee/v2/parsing/base_inference.rb', line 14 def model @model end |
Instance Method Details
#to_s ⇒ String
String representation.
32 33 34 35 36 37 38 39 40 |
# File 'lib/mindee/v2/parsing/base_inference.rb', line 32 def to_s [ 'Inference', '#########', @job.to_s, @model.to_s, @file.to_s, ].join("\n") end |