Class: Zara4::API::ImageProcessing::Request
- Inherits:
-
Object
- Object
- Zara4::API::ImageProcessing::Request
- Defined in:
- lib/zara4/api/image_processing/request.rb
Direct Known Subclasses
Instance Attribute Summary collapse
-
#colour_enhancement ⇒ Object
Returns the value of attribute colour_enhancement.
-
#height ⇒ Object
Returns the value of attribute height.
-
#optimisation_mode ⇒ Object
Returns the value of attribute optimisation_mode.
-
#output_format ⇒ Object
Returns the value of attribute output_format.
-
#resize_mode ⇒ Object
Returns the value of attribute resize_mode.
-
#width ⇒ Object
Returns the value of attribute width.
Instance Method Summary collapse
-
#generate_form_data ⇒ Object
Generate the form data for this request.
-
#initialize(optimisation_mode = nil, output_format = nil, colour_enhancement = nil, resize_mode = nil, width = 100, height = 100) ⇒ Request
constructor
Constructor.
Constructor Details
#initialize(optimisation_mode = nil, output_format = nil, colour_enhancement = nil, resize_mode = nil, width = 100, height = 100) ⇒ Request
Constructor
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/zara4/api/image_processing/request.rb', line 9 def initialize(optimisation_mode=nil, output_format=nil, colour_enhancement=nil, resize_mode=nil, width=100, height=100) if optimisation_mode != nil @optimisation_mode = optimisation_mode else @optimisation_mode = Zara4::API::ImageProcessing::OptimisationMode::COMPROMISE end if output_format != nil @output_format = output_format else @output_format = Zara4::API::ImageProcessing::OutputFormat::MATCH end if colour_enhancement != nil @colour_enhancement = colour_enhancement else @colour_enhancement = Zara4::API::ImageProcessing::ColourEnhancement::NONE end if resize_mode != nil @resize_mode = resize_mode else @resize_mode = Zara4::API::ImageProcessing::ResizeMode::NONE end @width = width @height = height end |
Instance Attribute Details
#colour_enhancement ⇒ Object
Returns the value of attribute colour_enhancement.
4 5 6 |
# File 'lib/zara4/api/image_processing/request.rb', line 4 def colour_enhancement @colour_enhancement end |
#height ⇒ Object
Returns the value of attribute height.
4 5 6 |
# File 'lib/zara4/api/image_processing/request.rb', line 4 def height @height end |
#optimisation_mode ⇒ Object
Returns the value of attribute optimisation_mode.
4 5 6 |
# File 'lib/zara4/api/image_processing/request.rb', line 4 def optimisation_mode @optimisation_mode end |
#output_format ⇒ Object
Returns the value of attribute output_format.
4 5 6 |
# File 'lib/zara4/api/image_processing/request.rb', line 4 def output_format @output_format end |
#resize_mode ⇒ Object
Returns the value of attribute resize_mode.
4 5 6 |
# File 'lib/zara4/api/image_processing/request.rb', line 4 def resize_mode @resize_mode end |
#width ⇒ Object
Returns the value of attribute width.
4 5 6 |
# File 'lib/zara4/api/image_processing/request.rb', line 4 def width @width end |
Instance Method Details
#generate_form_data ⇒ Object
Generate the form data for this request
44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/zara4/api/image_processing/request.rb', line 44 def generate_form_data data = { 'optimisation-mode' => @optimisation_mode, 'output-format' => @output_format, 'colour-enhancement' => @colour_enhancement, 'resize-mode' => @resize_mode } # Only include width and height if resize requested if @resize_mode != nil && @resize_mode != Zara4::API::ImageProcessing::ResizeMode::NONE data['width'] = @width data['height'] = @height end return data end |