Class: Copyleaks::CopyleaksAiImageDetectionResponseModel
- Inherits:
-
Object
- Object
- Copyleaks::CopyleaksAiImageDetectionResponseModel
- Defined in:
- lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResponseModel.rb
Overview
Response model for Copyleaks AI image detection analysis. Contains the AI detection results, image information, and scan metadata.
Instance Attribute Summary collapse
-
#image_info ⇒ Object
Information about the analyzed image.
-
#model ⇒ Object
The version of the AI detection model used for analysis.
-
#result ⇒ Object
RLE-encoded mask data containing arrays of start positions and lengths for AI-detected regions.
-
#scanned_document ⇒ Object
Metadata about the scan operation.
-
#summary ⇒ Object
Summary statistics of the AI detection analysis.
Class Method Summary collapse
-
.from_json(json_hash) ⇒ Object
Create instance from JSON hash.
Instance Method Summary collapse
-
#initialize(model: nil, result: nil, summary: nil, image_info: nil, scanned_document: nil) ⇒ CopyleaksAiImageDetectionResponseModel
constructor
Initialize a new CopyleaksAiImageDetectionResponseModel.
-
#to_json(*args) ⇒ Object
Convert to JSON.
Constructor Details
#initialize(model: nil, result: nil, summary: nil, image_info: nil, scanned_document: nil) ⇒ CopyleaksAiImageDetectionResponseModel
Initialize a new CopyleaksAiImageDetectionResponseModel
53 54 55 56 57 58 59 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResponseModel.rb', line 53 def initialize(model: nil, result: nil, summary: nil, image_info: nil, scanned_document: nil) @model = model @result = result @summary = summary @image_info = image_info @scanned_document = scanned_document end |
Instance Attribute Details
#image_info ⇒ Object
Information about the analyzed image.
41 42 43 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResponseModel.rb', line 41 def image_info @image_info end |
#model ⇒ Object
The version of the AI detection model used for analysis.
32 33 34 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResponseModel.rb', line 32 def model @model end |
#result ⇒ Object
RLE-encoded mask data containing arrays of start positions and lengths for AI-detected regions.
35 36 37 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResponseModel.rb', line 35 def result @result end |
#scanned_document ⇒ Object
Metadata about the scan operation.
44 45 46 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResponseModel.rb', line 44 def scanned_document @scanned_document end |
#summary ⇒ Object
Summary statistics of the AI detection analysis.
38 39 40 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResponseModel.rb', line 38 def summary @summary end |
Class Method Details
.from_json(json_hash) ⇒ Object
Create instance from JSON hash
62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResponseModel.rb', line 62 def self.from_json(json_hash) return nil if json_hash.nil? result = CopyleaksAiImageDetectionResultModel.from_json(json_hash['result']) if json_hash['result'] summary = CopyleaksAiImageDetectionSummaryModel.from_json(json_hash['summary']) if json_hash['summary'] image_info = CopyleaksAiImageDetectionImageInfoModel.from_json(json_hash['imageInfo']) if json_hash['imageInfo'] scanned_document = CopyleaksAiImageDetectionScannedDocumentModel.from_json(json_hash['scannedDocument']) if json_hash['scannedDocument'] new( model: json_hash['model'], result: result, summary: summary, image_info: image_info, scanned_document: scanned_document ) end |
Instance Method Details
#to_json(*args) ⇒ Object
Convert to JSON
80 81 82 83 84 85 86 87 88 |
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionResponseModel.rb', line 80 def to_json(*args) { 'model' => @model, 'result' => @result ? JSON.parse(@result.to_json) : nil, 'summary' => @summary ? JSON.parse(@summary.to_json) : nil, 'imageInfo' => @image_info ? JSON.parse(@image_info.to_json) : nil, 'scannedDocument' => @scanned_document ? JSON.parse(@scanned_document.to_json) : nil }.to_json(*args) end |