Class: Copyleaks::CopyleaksAiImageDetectionImageInfoModel

Inherits:
Object
  • Object
show all
Defined in:
lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionImageInfoModel.rb

Overview

Information about the analyzed image.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(shape: nil, metadata: nil) ⇒ CopyleaksAiImageDetectionImageInfoModel

Initialize a new CopyleaksAiImageDetectionImageInfoModel

Parameters:



40
41
42
43
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionImageInfoModel.rb', line 40

def initialize(shape: nil, metadata: nil)
  @shape = shape
  @metadata = 
end

Instance Attribute Details

#metadataObject

Optional metadata extracted from the image.



34
35
36
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionImageInfoModel.rb', line 34

def 
  @metadata
end

#shapeObject

Dimensions of the analyzed image.



31
32
33
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionImageInfoModel.rb', line 31

def shape
  @shape
end

Class Method Details

.from_json(json_hash) ⇒ Object

Create instance from JSON hash



46
47
48
49
50
51
52
53
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionImageInfoModel.rb', line 46

def self.from_json(json_hash)
  return nil if json_hash.nil?

  shape = CopyleaksImageShapeModel.from_json(json_hash['shape']) if json_hash['shape']
   = CopyleaksImageMetadataModel.from_json(json_hash['metadata']) if json_hash['metadata']

  new(shape: shape, metadata: )
end

Instance Method Details

#to_json(*args) ⇒ Object

Convert to JSON



56
57
58
59
60
61
# File 'lib/copyleaks/models/imageDetection/responses/CopyleaksAiImageDetectionImageInfoModel.rb', line 56

def to_json(*args)
  {
    'shape' => @shape ? JSON.parse(@shape.to_json) : nil,
    'metadata' => @metadata ? JSON.parse(@metadata.to_json) : nil
  }.to_json(*args)
end