Class: DynamicPDFApi::FixedImageSize

Inherits:
ImageSize
  • Object
show all
Defined in:
lib/ruby_client/Imaging/FixedImageSize.rb

Overview

Represents an image size with fixed dimensions.

Instance Attribute Summary collapse

Attributes inherited from ImageSize

#type

Instance Method Summary collapse

Constructor Details

#initializeFixedImageSize

Initializes a new instance of the FixedImageSize class and sets the image size type to Fixed.



17
18
19
20
21
22
23
# File 'lib/ruby_client/Imaging/FixedImageSize.rb', line 17

def initialize
  super()
  @type = ImageSizeType::Fixed
  @width = nil
  @height = nil
  @unit = nil
end

Instance Attribute Details

#heightObject

Gets or sets the height of the image.



11
12
13
# File 'lib/ruby_client/Imaging/FixedImageSize.rb', line 11

def height
  @height
end

#unitObject

Gets or sets the unit of measurement ImageSizeUnit for the width and height.



12
13
14
# File 'lib/ruby_client/Imaging/FixedImageSize.rb', line 12

def unit
  @unit
end

#widthObject

Gets or sets the width of the image.



10
11
12
# File 'lib/ruby_client/Imaging/FixedImageSize.rb', line 10

def width
  @width
end

Instance Method Details

#to_json(_options = {}) ⇒ String

Returns a JSON representation of the FixedImageSize object.

Returns:

  • (String)

    JSON string representing the FixedImageSize object.



30
31
32
33
34
35
36
37
# File 'lib/ruby_client/Imaging/FixedImageSize.rb', line 30

def to_json(_options = {})
  json_array = {}
  json_array['type'] = 'fixed'
  json_array['width'] = @width
  json_array['height'] = @height
  json_array['unit'] = @unit
  JSON.pretty_generate(json_array)
end