Class: Mindee::V2::Product::Split::SplitResponse
- Inherits:
-
Mindee::V2::Parsing::BaseResponse
- Object
- Mindee::V2::Parsing::CommonResponse
- Mindee::V2::Parsing::BaseResponse
- Mindee::V2::Product::Split::SplitResponse
- Defined in:
- lib/mindee/v2/product/split/split_response.rb
Overview
HTTP response wrapper that embeds a V2 Inference.
Instance Attribute Summary collapse
-
#inference ⇒ SplitInference
readonly
Parsed inference payload.
Attributes inherited from Mindee::V2::Parsing::CommonResponse
Instance Method Summary collapse
-
#extract_from_file(input_source) ⇒ FileOperation::SplitFiles
Splits the input PDF.
-
#initialize(server_response) ⇒ SplitResponse
constructor
A new instance of SplitResponse.
-
#to_s ⇒ String
String representation.
Constructor Details
#initialize(server_response) ⇒ SplitResponse
Returns a new instance of SplitResponse.
17 18 19 20 21 |
# File 'lib/mindee/v2/product/split/split_response.rb', line 17 def initialize(server_response) super @inference = SplitInference.new(server_response['inference']) end |
Instance Attribute Details
#inference ⇒ SplitInference (readonly)
Returns Parsed inference payload.
14 15 16 |
# File 'lib/mindee/v2/product/split/split_response.rb', line 14 def inference @inference end |
Instance Method Details
#extract_from_file(input_source) ⇒ FileOperation::SplitFiles
Splits the input PDF.
32 33 34 35 |
# File 'lib/mindee/v2/product/split/split_response.rb', line 32 def extract_from_file(input_source) splits = @inference.result.splits.map(&:page_range) FileOperation::Split.extract_splits(input_source, splits) end |
#to_s ⇒ String
String representation.
25 26 27 |
# File 'lib/mindee/v2/product/split/split_response.rb', line 25 def to_s @inference.to_s end |