aspose_imaging_cloud 20.4 → 20.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +15 -8
- data/lib/aspose-imaging-cloud.rb +22 -27
- data/lib/aspose-imaging-cloud/api/imaging_api.rb +55 -15
- data/lib/aspose-imaging-cloud/api_client.rb +1 -1
- data/lib/aspose-imaging-cloud/models/available_labels_list.rb +204 -0
- data/lib/aspose-imaging-cloud/models/detected_object.rb +228 -0
- data/lib/aspose-imaging-cloud/models/detected_object_list.rb +204 -0
- data/lib/aspose-imaging-cloud/models/dicom_properties.rb +4 -64
- data/lib/aspose-imaging-cloud/models/eps_properties.rb +241 -0
- data/lib/aspose-imaging-cloud/models/imaging_response.rb +11 -1
- data/lib/aspose-imaging-cloud/models/rectangle.rb +247 -0
- data/lib/aspose-imaging-cloud/models/requests/{save_image_as_request.rb → convert_image_request.rb} +7 -7
- data/lib/aspose-imaging-cloud/models/requests/{create_saved_image_as_request.rb → create_converted_image_request.rb} +7 -7
- data/lib/aspose-imaging-cloud/models/requests/create_fax_tiff_request.rb +1 -1
- data/lib/aspose-imaging-cloud/models/requests/create_image_frame_range_request.rb +1 -1
- data/lib/aspose-imaging-cloud/models/requests/create_object_bounds_request.rb +99 -0
- data/lib/aspose-imaging-cloud/models/requests/create_visual_object_bounds_request.rb +102 -0
- data/lib/aspose-imaging-cloud/models/requests/get_available_labels_request.rb +74 -0
- data/lib/aspose-imaging-cloud/models/requests/get_object_bounds_request.rb +98 -0
- data/lib/aspose-imaging-cloud/models/requests/get_visual_object_bounds_request.rb +101 -0
- metadata +15 -5
| @@ -0,0 +1,241 @@ | |
| 1 | 
            +
            #  ----------------------------------------------------------------------------
         | 
| 2 | 
            +
            #  <copyright company="Aspose" file="eps_properties.rb">
         | 
| 3 | 
            +
            #    Copyright (c) 2018-2020 Aspose Pty Ltd. All rights reserved.
         | 
| 4 | 
            +
            #  </copyright>
         | 
| 5 | 
            +
            #  <summary>
         | 
| 6 | 
            +
            #    Permission is hereby granted, free of charge, to any person obtaining a
         | 
| 7 | 
            +
            #   copy  of this software and associated documentation files (the "Software"),
         | 
| 8 | 
            +
            #   to deal  in the Software without restriction, including without limitation
         | 
| 9 | 
            +
            #   the rights  to use, copy, modify, merge, publish, distribute, sublicense,
         | 
| 10 | 
            +
            #   and/or sell  copies of the Software, and to permit persons to whom the
         | 
| 11 | 
            +
            #   Software is  furnished to do so, subject to the following conditions:
         | 
| 12 | 
            +
            #
         | 
| 13 | 
            +
            #   The above copyright notice and this permission notice shall be included in
         | 
| 14 | 
            +
            #   all  copies or substantial portions of the Software.
         | 
| 15 | 
            +
            #
         | 
| 16 | 
            +
            #   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 17 | 
            +
            #   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 18 | 
            +
            #   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 19 | 
            +
            #   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 20 | 
            +
            #   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
         | 
| 21 | 
            +
            #   FROM,  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
         | 
| 22 | 
            +
            #   DEALINGS IN THE SOFTWARE.
         | 
| 23 | 
            +
            #  </summary>
         | 
| 24 | 
            +
            #  ----------------------------------------------------------------------------
         | 
| 25 | 
            +
             | 
| 26 | 
            +
             | 
| 27 | 
            +
            require 'date'
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            module AsposeImagingCloud
         | 
| 30 | 
            +
              class EpsProperties
         | 
| 31 | 
            +
                # Gets the BoundingBox.
         | 
| 32 | 
            +
                attr_accessor :bounding_box_string
         | 
| 33 | 
            +
             | 
| 34 | 
            +
                # Gets the CreationDate.
         | 
| 35 | 
            +
                attr_accessor :creation_date_string
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                # Gets the Creator.
         | 
| 38 | 
            +
                attr_accessor :creator
         | 
| 39 | 
            +
             | 
| 40 | 
            +
                # Gets the PostScript version.
         | 
| 41 | 
            +
                attr_accessor :post_script_version
         | 
| 42 | 
            +
             | 
| 43 | 
            +
                # Gets the Title.
         | 
| 44 | 
            +
                attr_accessor :title
         | 
| 45 | 
            +
             | 
| 46 | 
            +
                # Attribute mapping from ruby-style variable name to JSON key.
         | 
| 47 | 
            +
                def self.attribute_map
         | 
| 48 | 
            +
                  {
         | 
| 49 | 
            +
                    :'bounding_box_string' => :'BoundingBoxString',
         | 
| 50 | 
            +
                    :'creation_date_string' => :'CreationDateString',
         | 
| 51 | 
            +
                    :'creator' => :'Creator',
         | 
| 52 | 
            +
                    :'post_script_version' => :'PostScriptVersion',
         | 
| 53 | 
            +
                    :'title' => :'Title'
         | 
| 54 | 
            +
                  }
         | 
| 55 | 
            +
                end
         | 
| 56 | 
            +
             | 
| 57 | 
            +
                # Attribute type mapping.
         | 
| 58 | 
            +
                def self.swagger_types
         | 
| 59 | 
            +
                  {
         | 
| 60 | 
            +
                    :'bounding_box_string' => :'String',
         | 
| 61 | 
            +
                    :'creation_date_string' => :'String',
         | 
| 62 | 
            +
                    :'creator' => :'String',
         | 
| 63 | 
            +
                    :'post_script_version' => :'String',
         | 
| 64 | 
            +
                    :'title' => :'String'
         | 
| 65 | 
            +
                  }
         | 
| 66 | 
            +
                end
         | 
| 67 | 
            +
             | 
| 68 | 
            +
                # Initializes the object
         | 
| 69 | 
            +
                # @param [Hash] attributes Model attributes in the form of hash
         | 
| 70 | 
            +
                def initialize(attributes = {})
         | 
| 71 | 
            +
                  return unless attributes.is_a?(Hash)
         | 
| 72 | 
            +
             | 
| 73 | 
            +
                  # convert string to symbol for hash key
         | 
| 74 | 
            +
                  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
         | 
| 75 | 
            +
             | 
| 76 | 
            +
                  if attributes.has_key?(:'BoundingBoxString')
         | 
| 77 | 
            +
                    self.bounding_box_string = attributes[:'BoundingBoxString']
         | 
| 78 | 
            +
                  end
         | 
| 79 | 
            +
             | 
| 80 | 
            +
                  if attributes.has_key?(:'CreationDateString')
         | 
| 81 | 
            +
                    self.creation_date_string = attributes[:'CreationDateString']
         | 
| 82 | 
            +
                  end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                  if attributes.has_key?(:'Creator')
         | 
| 85 | 
            +
                    self.creator = attributes[:'Creator']
         | 
| 86 | 
            +
                  end
         | 
| 87 | 
            +
             | 
| 88 | 
            +
                  if attributes.has_key?(:'PostScriptVersion')
         | 
| 89 | 
            +
                    self.post_script_version = attributes[:'PostScriptVersion']
         | 
| 90 | 
            +
                  end
         | 
| 91 | 
            +
             | 
| 92 | 
            +
                  if attributes.has_key?(:'Title')
         | 
| 93 | 
            +
                    self.title = attributes[:'Title']
         | 
| 94 | 
            +
                  end
         | 
| 95 | 
            +
                end
         | 
| 96 | 
            +
             | 
| 97 | 
            +
                # Show invalid properties with the reasons. Usually used together with valid?
         | 
| 98 | 
            +
                # @return Array for valid properties with the reasons
         | 
| 99 | 
            +
                def list_invalid_properties
         | 
| 100 | 
            +
                  invalid_properties = Array.new
         | 
| 101 | 
            +
                  invalid_properties
         | 
| 102 | 
            +
                end
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                # Check to see if the all the properties in the model are valid
         | 
| 105 | 
            +
                # @return true if the model is valid
         | 
| 106 | 
            +
                def valid?
         | 
| 107 | 
            +
                  true
         | 
| 108 | 
            +
                end
         | 
| 109 | 
            +
             | 
| 110 | 
            +
                # Checks equality by comparing each attribute.
         | 
| 111 | 
            +
                # @param [Object] Object to be compared
         | 
| 112 | 
            +
                def ==(o)
         | 
| 113 | 
            +
                  return true if self.equal?(o)
         | 
| 114 | 
            +
                  self.class == o.class &&
         | 
| 115 | 
            +
                      bounding_box_string == o.bounding_box_string &&
         | 
| 116 | 
            +
                      creation_date_string == o.creation_date_string &&
         | 
| 117 | 
            +
                      creator == o.creator &&
         | 
| 118 | 
            +
                      post_script_version == o.post_script_version &&
         | 
| 119 | 
            +
                      title == o.title
         | 
| 120 | 
            +
                end
         | 
| 121 | 
            +
             | 
| 122 | 
            +
                # @see the `==` method
         | 
| 123 | 
            +
                # @param [Object] Object to be compared
         | 
| 124 | 
            +
                def eql?(o)
         | 
| 125 | 
            +
                  self == o
         | 
| 126 | 
            +
                end
         | 
| 127 | 
            +
             | 
| 128 | 
            +
                # Calculates hash code according to all attributes.
         | 
| 129 | 
            +
                # @return [Fixnum] Hash code
         | 
| 130 | 
            +
                def hash
         | 
| 131 | 
            +
                  [bounding_box_string, creation_date_string, creator, post_script_version, title].hash
         | 
| 132 | 
            +
                end
         | 
| 133 | 
            +
             | 
| 134 | 
            +
                # Builds the object from hash
         | 
| 135 | 
            +
                # @param [Hash] attributes Model attributes in the form of hash
         | 
| 136 | 
            +
                # @return [Object] Returns the model itself
         | 
| 137 | 
            +
                def build_from_hash(attributes)
         | 
| 138 | 
            +
                  return nil unless attributes.is_a?(Hash)
         | 
| 139 | 
            +
                  self.class.swagger_types.each_pair do |key, type|
         | 
| 140 | 
            +
                    attribute_key = self.class.attribute_map[key]
         | 
| 141 | 
            +
                    attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
         | 
| 142 | 
            +
                    if type =~ /\AArray<(.*)>/i
         | 
| 143 | 
            +
                      # check to ensure the input is an array given that the the attribute
         | 
| 144 | 
            +
                      # is documented as an array but the input is not
         | 
| 145 | 
            +
                      if attributes[attribute_key].is_a?(Array)
         | 
| 146 | 
            +
                        self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
         | 
| 147 | 
            +
                      end
         | 
| 148 | 
            +
                    elsif !attributes[attribute_key].nil?
         | 
| 149 | 
            +
                      self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
         | 
| 150 | 
            +
                    end # or else data not found in attributes(hash), not an issue as the data can be optional
         | 
| 151 | 
            +
                  end
         | 
| 152 | 
            +
             | 
| 153 | 
            +
                  self
         | 
| 154 | 
            +
                end
         | 
| 155 | 
            +
             | 
| 156 | 
            +
                # Deserializes the data based on type
         | 
| 157 | 
            +
                # @param string type Data type
         | 
| 158 | 
            +
                # @param string value Value to be deserialized
         | 
| 159 | 
            +
                # @return [Object] Deserialized data
         | 
| 160 | 
            +
                def _deserialize(type, value)
         | 
| 161 | 
            +
                  case type.to_sym
         | 
| 162 | 
            +
                  when :DateTime
         | 
| 163 | 
            +
                    DateTime.parse(value)
         | 
| 164 | 
            +
                  when :Date
         | 
| 165 | 
            +
                    Date.parse(value)
         | 
| 166 | 
            +
                  when :String
         | 
| 167 | 
            +
                    value.to_s
         | 
| 168 | 
            +
                  when :Integer
         | 
| 169 | 
            +
                    value.to_i
         | 
| 170 | 
            +
                  when :Float
         | 
| 171 | 
            +
                    value.to_f
         | 
| 172 | 
            +
                  when :BOOLEAN
         | 
| 173 | 
            +
                    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
         | 
| 174 | 
            +
                      true
         | 
| 175 | 
            +
                    else
         | 
| 176 | 
            +
                      false
         | 
| 177 | 
            +
                    end
         | 
| 178 | 
            +
                  when :Object
         | 
| 179 | 
            +
                    # generic object (usually a Hash), return directly
         | 
| 180 | 
            +
                    value
         | 
| 181 | 
            +
                  when /\AArray<(?<inner_type>.+)>\z/
         | 
| 182 | 
            +
                    inner_type = Regexp.last_match[:inner_type]
         | 
| 183 | 
            +
                    value.map { |v| _deserialize(inner_type, v) }
         | 
| 184 | 
            +
                  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
         | 
| 185 | 
            +
                    k_type = Regexp.last_match[:k_type]
         | 
| 186 | 
            +
                    v_type = Regexp.last_match[:v_type]
         | 
| 187 | 
            +
                    {}.tap do |hash|
         | 
| 188 | 
            +
                      value.each do |k, v|
         | 
| 189 | 
            +
                        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
         | 
| 190 | 
            +
                      end
         | 
| 191 | 
            +
                    end
         | 
| 192 | 
            +
                  else # model
         | 
| 193 | 
            +
                    temp_model = AsposeImagingCloud.const_get(type).new
         | 
| 194 | 
            +
                    temp_model.build_from_hash(value)
         | 
| 195 | 
            +
                  end
         | 
| 196 | 
            +
                end
         | 
| 197 | 
            +
             | 
| 198 | 
            +
                # Returns the string representation of the object
         | 
| 199 | 
            +
                # @return [String] String presentation of the object
         | 
| 200 | 
            +
                def to_s
         | 
| 201 | 
            +
                  to_hash.to_s
         | 
| 202 | 
            +
                end
         | 
| 203 | 
            +
             | 
| 204 | 
            +
                # to_body is an alias to to_hash (backward compatibility)
         | 
| 205 | 
            +
                # @return [Hash] Returns the object in the form of hash
         | 
| 206 | 
            +
                def to_body
         | 
| 207 | 
            +
                  to_hash
         | 
| 208 | 
            +
                end
         | 
| 209 | 
            +
             | 
| 210 | 
            +
                # Returns the object in the form of hash
         | 
| 211 | 
            +
                # @return [Hash] Returns the object in the form of hash
         | 
| 212 | 
            +
                def to_hash
         | 
| 213 | 
            +
                  hash = {}
         | 
| 214 | 
            +
                  self.class.attribute_map.each_pair do |attr, param|
         | 
| 215 | 
            +
                    value = self.send(attr)
         | 
| 216 | 
            +
                    next if value.nil?
         | 
| 217 | 
            +
                    hash[param] = _to_hash(value)
         | 
| 218 | 
            +
                  end
         | 
| 219 | 
            +
                  hash
         | 
| 220 | 
            +
                end
         | 
| 221 | 
            +
             | 
| 222 | 
            +
                # Outputs non-array value in the form of hash
         | 
| 223 | 
            +
                # For object, use to_hash. Otherwise, just return the value
         | 
| 224 | 
            +
                # @param [Object] value Any valid value
         | 
| 225 | 
            +
                # @return [Hash] Returns the value in the form of hash
         | 
| 226 | 
            +
                def _to_hash(value)
         | 
| 227 | 
            +
                  if value.is_a?(Array)
         | 
| 228 | 
            +
                    value.compact.map { |v| _to_hash(v) }
         | 
| 229 | 
            +
                  elsif value.is_a?(Hash)
         | 
| 230 | 
            +
                    {}.tap do |hash|
         | 
| 231 | 
            +
                      value.each { |k, v| hash[k] = _to_hash(v) }
         | 
| 232 | 
            +
                    end
         | 
| 233 | 
            +
                  elsif value.respond_to? :to_hash
         | 
| 234 | 
            +
                    value.to_hash
         | 
| 235 | 
            +
                  else
         | 
| 236 | 
            +
                    value
         | 
| 237 | 
            +
                  end
         | 
| 238 | 
            +
                end
         | 
| 239 | 
            +
             | 
| 240 | 
            +
              end
         | 
| 241 | 
            +
            end
         | 
| @@ -77,6 +77,9 @@ module AsposeImagingCloud | |
| 77 77 | 
             
                # Gets or sets the SVG properties.
         | 
| 78 78 | 
             
                attr_accessor :svg_properties
         | 
| 79 79 |  | 
| 80 | 
            +
                # Gets or sets the EPS properties.
         | 
| 81 | 
            +
                attr_accessor :eps_properties
         | 
| 82 | 
            +
             | 
| 80 83 | 
             
                # Gets or sets the horizontal resolution of an image.
         | 
| 81 84 | 
             
                attr_accessor :horizontal_resolution
         | 
| 82 85 |  | 
| @@ -105,6 +108,7 @@ module AsposeImagingCloud | |
| 105 108 | 
             
                    :'dng_properties' => :'DngProperties',
         | 
| 106 109 | 
             
                    :'odg_properties' => :'OdgProperties',
         | 
| 107 110 | 
             
                    :'svg_properties' => :'SvgProperties',
         | 
| 111 | 
            +
                    :'eps_properties' => :'EpsProperties',
         | 
| 108 112 | 
             
                    :'horizontal_resolution' => :'HorizontalResolution',
         | 
| 109 113 | 
             
                    :'vertical_resolution' => :'VerticalResolution',
         | 
| 110 114 | 
             
                    :'is_cached' => :'IsCached'
         | 
| @@ -130,6 +134,7 @@ module AsposeImagingCloud | |
| 130 134 | 
             
                    :'dng_properties' => :'DngProperties',
         | 
| 131 135 | 
             
                    :'odg_properties' => :'OdgProperties',
         | 
| 132 136 | 
             
                    :'svg_properties' => :'SvgProperties',
         | 
| 137 | 
            +
                    :'eps_properties' => :'EpsProperties',
         | 
| 133 138 | 
             
                    :'horizontal_resolution' => :'Float',
         | 
| 134 139 | 
             
                    :'vertical_resolution' => :'Float',
         | 
| 135 140 | 
             
                    :'is_cached' => :'BOOLEAN'
         | 
| @@ -208,6 +213,10 @@ module AsposeImagingCloud | |
| 208 213 | 
             
                    self.svg_properties = attributes[:'SvgProperties']
         | 
| 209 214 | 
             
                  end
         | 
| 210 215 |  | 
| 216 | 
            +
                  if attributes.has_key?(:'EpsProperties')
         | 
| 217 | 
            +
                    self.eps_properties = attributes[:'EpsProperties']
         | 
| 218 | 
            +
                  end
         | 
| 219 | 
            +
             | 
| 211 220 | 
             
                  if attributes.has_key?(:'HorizontalResolution')
         | 
| 212 221 | 
             
                    self.horizontal_resolution = attributes[:'HorizontalResolution']
         | 
| 213 222 | 
             
                  end
         | 
| @@ -285,6 +294,7 @@ module AsposeImagingCloud | |
| 285 294 | 
             
                      dng_properties == o.dng_properties &&
         | 
| 286 295 | 
             
                      odg_properties == o.odg_properties &&
         | 
| 287 296 | 
             
                      svg_properties == o.svg_properties &&
         | 
| 297 | 
            +
                      eps_properties == o.eps_properties &&
         | 
| 288 298 | 
             
                      horizontal_resolution == o.horizontal_resolution &&
         | 
| 289 299 | 
             
                      vertical_resolution == o.vertical_resolution &&
         | 
| 290 300 | 
             
                      is_cached == o.is_cached
         | 
| @@ -299,7 +309,7 @@ module AsposeImagingCloud | |
| 299 309 | 
             
                # Calculates hash code according to all attributes.
         | 
| 300 310 | 
             
                # @return [Fixnum] Hash code
         | 
| 301 311 | 
             
                def hash
         | 
| 302 | 
            -
                  [height, width, bits_per_pixel, bmp_properties, gif_properties, jpeg_properties, png_properties, tiff_properties, psd_properties, djvu_properties, web_p_properties, jpeg2000_properties, dicom_properties, dng_properties, odg_properties, svg_properties, horizontal_resolution, vertical_resolution, is_cached].hash
         | 
| 312 | 
            +
                  [height, width, bits_per_pixel, bmp_properties, gif_properties, jpeg_properties, png_properties, tiff_properties, psd_properties, djvu_properties, web_p_properties, jpeg2000_properties, dicom_properties, dng_properties, odg_properties, svg_properties, eps_properties, horizontal_resolution, vertical_resolution, is_cached].hash
         | 
| 303 313 | 
             
                end
         | 
| 304 314 |  | 
| 305 315 | 
             
                # Builds the object from hash
         | 
| @@ -0,0 +1,247 @@ | |
| 1 | 
            +
            #  ----------------------------------------------------------------------------
         | 
| 2 | 
            +
            #  <copyright company="Aspose" file="rectangle.rb">
         | 
| 3 | 
            +
            #    Copyright (c) 2018-2020 Aspose Pty Ltd. All rights reserved.
         | 
| 4 | 
            +
            #  </copyright>
         | 
| 5 | 
            +
            #  <summary>
         | 
| 6 | 
            +
            #    Permission is hereby granted, free of charge, to any person obtaining a
         | 
| 7 | 
            +
            #   copy  of this software and associated documentation files (the "Software"),
         | 
| 8 | 
            +
            #   to deal  in the Software without restriction, including without limitation
         | 
| 9 | 
            +
            #   the rights  to use, copy, modify, merge, publish, distribute, sublicense,
         | 
| 10 | 
            +
            #   and/or sell  copies of the Software, and to permit persons to whom the
         | 
| 11 | 
            +
            #   Software is  furnished to do so, subject to the following conditions:
         | 
| 12 | 
            +
            #
         | 
| 13 | 
            +
            #   The above copyright notice and this permission notice shall be included in
         | 
| 14 | 
            +
            #   all  copies or substantial portions of the Software.
         | 
| 15 | 
            +
            #
         | 
| 16 | 
            +
            #   THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
         | 
| 17 | 
            +
            #   IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
         | 
| 18 | 
            +
            #   FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
         | 
| 19 | 
            +
            #   AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
         | 
| 20 | 
            +
            #   LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
         | 
| 21 | 
            +
            #   FROM,  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
         | 
| 22 | 
            +
            #   DEALINGS IN THE SOFTWARE.
         | 
| 23 | 
            +
            #  </summary>
         | 
| 24 | 
            +
            #  ----------------------------------------------------------------------------
         | 
| 25 | 
            +
             | 
| 26 | 
            +
             | 
| 27 | 
            +
            require 'date'
         | 
| 28 | 
            +
             | 
| 29 | 
            +
            module AsposeImagingCloud
         | 
| 30 | 
            +
              class Rectangle
         | 
| 31 | 
            +
                attr_accessor :x
         | 
| 32 | 
            +
             | 
| 33 | 
            +
                attr_accessor :y
         | 
| 34 | 
            +
             | 
| 35 | 
            +
                attr_accessor :width
         | 
| 36 | 
            +
             | 
| 37 | 
            +
                attr_accessor :height
         | 
| 38 | 
            +
             | 
| 39 | 
            +
                # Attribute mapping from ruby-style variable name to JSON key.
         | 
| 40 | 
            +
                def self.attribute_map
         | 
| 41 | 
            +
                  {
         | 
| 42 | 
            +
                    :'x' => :'X',
         | 
| 43 | 
            +
                    :'y' => :'Y',
         | 
| 44 | 
            +
                    :'width' => :'Width',
         | 
| 45 | 
            +
                    :'height' => :'Height'
         | 
| 46 | 
            +
                  }
         | 
| 47 | 
            +
                end
         | 
| 48 | 
            +
             | 
| 49 | 
            +
                # Attribute type mapping.
         | 
| 50 | 
            +
                def self.swagger_types
         | 
| 51 | 
            +
                  {
         | 
| 52 | 
            +
                    :'x' => :'Float',
         | 
| 53 | 
            +
                    :'y' => :'Float',
         | 
| 54 | 
            +
                    :'width' => :'Float',
         | 
| 55 | 
            +
                    :'height' => :'Float'
         | 
| 56 | 
            +
                  }
         | 
| 57 | 
            +
                end
         | 
| 58 | 
            +
             | 
| 59 | 
            +
                # Initializes the object
         | 
| 60 | 
            +
                # @param [Hash] attributes Model attributes in the form of hash
         | 
| 61 | 
            +
                def initialize(attributes = {})
         | 
| 62 | 
            +
                  return unless attributes.is_a?(Hash)
         | 
| 63 | 
            +
             | 
| 64 | 
            +
                  # convert string to symbol for hash key
         | 
| 65 | 
            +
                  attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
         | 
| 66 | 
            +
             | 
| 67 | 
            +
                  if attributes.has_key?(:'X')
         | 
| 68 | 
            +
                    self.x = attributes[:'X']
         | 
| 69 | 
            +
                  end
         | 
| 70 | 
            +
             | 
| 71 | 
            +
                  if attributes.has_key?(:'Y')
         | 
| 72 | 
            +
                    self.y = attributes[:'Y']
         | 
| 73 | 
            +
                  end
         | 
| 74 | 
            +
             | 
| 75 | 
            +
                  if attributes.has_key?(:'Width')
         | 
| 76 | 
            +
                    self.width = attributes[:'Width']
         | 
| 77 | 
            +
                  end
         | 
| 78 | 
            +
             | 
| 79 | 
            +
                  if attributes.has_key?(:'Height')
         | 
| 80 | 
            +
                    self.height = attributes[:'Height']
         | 
| 81 | 
            +
                  end
         | 
| 82 | 
            +
                end
         | 
| 83 | 
            +
             | 
| 84 | 
            +
                # Show invalid properties with the reasons. Usually used together with valid?
         | 
| 85 | 
            +
                # @return Array for valid properties with the reasons
         | 
| 86 | 
            +
                def list_invalid_properties
         | 
| 87 | 
            +
                  invalid_properties = Array.new
         | 
| 88 | 
            +
                  if @x.nil?
         | 
| 89 | 
            +
                    invalid_properties.push('invalid value for "x", x cannot be nil.')
         | 
| 90 | 
            +
                  end
         | 
| 91 | 
            +
             | 
| 92 | 
            +
                  if @y.nil?
         | 
| 93 | 
            +
                    invalid_properties.push('invalid value for "y", y cannot be nil.')
         | 
| 94 | 
            +
                  end
         | 
| 95 | 
            +
             | 
| 96 | 
            +
                  if @width.nil?
         | 
| 97 | 
            +
                    invalid_properties.push('invalid value for "width", width cannot be nil.')
         | 
| 98 | 
            +
                  end
         | 
| 99 | 
            +
             | 
| 100 | 
            +
                  if @height.nil?
         | 
| 101 | 
            +
                    invalid_properties.push('invalid value for "height", height cannot be nil.')
         | 
| 102 | 
            +
                  end
         | 
| 103 | 
            +
             | 
| 104 | 
            +
                  invalid_properties
         | 
| 105 | 
            +
                end
         | 
| 106 | 
            +
             | 
| 107 | 
            +
                # Check to see if the all the properties in the model are valid
         | 
| 108 | 
            +
                # @return true if the model is valid
         | 
| 109 | 
            +
                def valid?
         | 
| 110 | 
            +
                  return false if @x.nil?
         | 
| 111 | 
            +
                  return false if @y.nil?
         | 
| 112 | 
            +
                  return false if @width.nil?
         | 
| 113 | 
            +
                  return false if @height.nil?
         | 
| 114 | 
            +
                  true
         | 
| 115 | 
            +
                end
         | 
| 116 | 
            +
             | 
| 117 | 
            +
                # Checks equality by comparing each attribute.
         | 
| 118 | 
            +
                # @param [Object] Object to be compared
         | 
| 119 | 
            +
                def ==(o)
         | 
| 120 | 
            +
                  return true if self.equal?(o)
         | 
| 121 | 
            +
                  self.class == o.class &&
         | 
| 122 | 
            +
                      x == o.x &&
         | 
| 123 | 
            +
                      y == o.y &&
         | 
| 124 | 
            +
                      width == o.width &&
         | 
| 125 | 
            +
                      height == o.height
         | 
| 126 | 
            +
                end
         | 
| 127 | 
            +
             | 
| 128 | 
            +
                # @see the `==` method
         | 
| 129 | 
            +
                # @param [Object] Object to be compared
         | 
| 130 | 
            +
                def eql?(o)
         | 
| 131 | 
            +
                  self == o
         | 
| 132 | 
            +
                end
         | 
| 133 | 
            +
             | 
| 134 | 
            +
                # Calculates hash code according to all attributes.
         | 
| 135 | 
            +
                # @return [Fixnum] Hash code
         | 
| 136 | 
            +
                def hash
         | 
| 137 | 
            +
                  [x, y, width, height].hash
         | 
| 138 | 
            +
                end
         | 
| 139 | 
            +
             | 
| 140 | 
            +
                # Builds the object from hash
         | 
| 141 | 
            +
                # @param [Hash] attributes Model attributes in the form of hash
         | 
| 142 | 
            +
                # @return [Object] Returns the model itself
         | 
| 143 | 
            +
                def build_from_hash(attributes)
         | 
| 144 | 
            +
                  return nil unless attributes.is_a?(Hash)
         | 
| 145 | 
            +
                  self.class.swagger_types.each_pair do |key, type|
         | 
| 146 | 
            +
                    attribute_key = self.class.attribute_map[key]
         | 
| 147 | 
            +
                    attribute_key = (attribute_key[0, 1].downcase + attribute_key[1..-1]).to_sym
         | 
| 148 | 
            +
                    if type =~ /\AArray<(.*)>/i
         | 
| 149 | 
            +
                      # check to ensure the input is an array given that the the attribute
         | 
| 150 | 
            +
                      # is documented as an array but the input is not
         | 
| 151 | 
            +
                      if attributes[attribute_key].is_a?(Array)
         | 
| 152 | 
            +
                        self.send("#{key}=", attributes[attribute_key].map { |v| _deserialize($1, v) })
         | 
| 153 | 
            +
                      end
         | 
| 154 | 
            +
                    elsif !attributes[attribute_key].nil?
         | 
| 155 | 
            +
                      self.send("#{key}=", _deserialize(type, attributes[attribute_key]))
         | 
| 156 | 
            +
                    end # or else data not found in attributes(hash), not an issue as the data can be optional
         | 
| 157 | 
            +
                  end
         | 
| 158 | 
            +
             | 
| 159 | 
            +
                  self
         | 
| 160 | 
            +
                end
         | 
| 161 | 
            +
             | 
| 162 | 
            +
                # Deserializes the data based on type
         | 
| 163 | 
            +
                # @param string type Data type
         | 
| 164 | 
            +
                # @param string value Value to be deserialized
         | 
| 165 | 
            +
                # @return [Object] Deserialized data
         | 
| 166 | 
            +
                def _deserialize(type, value)
         | 
| 167 | 
            +
                  case type.to_sym
         | 
| 168 | 
            +
                  when :DateTime
         | 
| 169 | 
            +
                    DateTime.parse(value)
         | 
| 170 | 
            +
                  when :Date
         | 
| 171 | 
            +
                    Date.parse(value)
         | 
| 172 | 
            +
                  when :String
         | 
| 173 | 
            +
                    value.to_s
         | 
| 174 | 
            +
                  when :Integer
         | 
| 175 | 
            +
                    value.to_i
         | 
| 176 | 
            +
                  when :Float
         | 
| 177 | 
            +
                    value.to_f
         | 
| 178 | 
            +
                  when :BOOLEAN
         | 
| 179 | 
            +
                    if value.to_s =~ /\A(true|t|yes|y|1)\z/i
         | 
| 180 | 
            +
                      true
         | 
| 181 | 
            +
                    else
         | 
| 182 | 
            +
                      false
         | 
| 183 | 
            +
                    end
         | 
| 184 | 
            +
                  when :Object
         | 
| 185 | 
            +
                    # generic object (usually a Hash), return directly
         | 
| 186 | 
            +
                    value
         | 
| 187 | 
            +
                  when /\AArray<(?<inner_type>.+)>\z/
         | 
| 188 | 
            +
                    inner_type = Regexp.last_match[:inner_type]
         | 
| 189 | 
            +
                    value.map { |v| _deserialize(inner_type, v) }
         | 
| 190 | 
            +
                  when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
         | 
| 191 | 
            +
                    k_type = Regexp.last_match[:k_type]
         | 
| 192 | 
            +
                    v_type = Regexp.last_match[:v_type]
         | 
| 193 | 
            +
                    {}.tap do |hash|
         | 
| 194 | 
            +
                      value.each do |k, v|
         | 
| 195 | 
            +
                        hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
         | 
| 196 | 
            +
                      end
         | 
| 197 | 
            +
                    end
         | 
| 198 | 
            +
                  else # model
         | 
| 199 | 
            +
                    temp_model = AsposeImagingCloud.const_get(type).new
         | 
| 200 | 
            +
                    temp_model.build_from_hash(value)
         | 
| 201 | 
            +
                  end
         | 
| 202 | 
            +
                end
         | 
| 203 | 
            +
             | 
| 204 | 
            +
                # Returns the string representation of the object
         | 
| 205 | 
            +
                # @return [String] String presentation of the object
         | 
| 206 | 
            +
                def to_s
         | 
| 207 | 
            +
                  to_hash.to_s
         | 
| 208 | 
            +
                end
         | 
| 209 | 
            +
             | 
| 210 | 
            +
                # to_body is an alias to to_hash (backward compatibility)
         | 
| 211 | 
            +
                # @return [Hash] Returns the object in the form of hash
         | 
| 212 | 
            +
                def to_body
         | 
| 213 | 
            +
                  to_hash
         | 
| 214 | 
            +
                end
         | 
| 215 | 
            +
             | 
| 216 | 
            +
                # Returns the object in the form of hash
         | 
| 217 | 
            +
                # @return [Hash] Returns the object in the form of hash
         | 
| 218 | 
            +
                def to_hash
         | 
| 219 | 
            +
                  hash = {}
         | 
| 220 | 
            +
                  self.class.attribute_map.each_pair do |attr, param|
         | 
| 221 | 
            +
                    value = self.send(attr)
         | 
| 222 | 
            +
                    next if value.nil?
         | 
| 223 | 
            +
                    hash[param] = _to_hash(value)
         | 
| 224 | 
            +
                  end
         | 
| 225 | 
            +
                  hash
         | 
| 226 | 
            +
                end
         | 
| 227 | 
            +
             | 
| 228 | 
            +
                # Outputs non-array value in the form of hash
         | 
| 229 | 
            +
                # For object, use to_hash. Otherwise, just return the value
         | 
| 230 | 
            +
                # @param [Object] value Any valid value
         | 
| 231 | 
            +
                # @return [Hash] Returns the value in the form of hash
         | 
| 232 | 
            +
                def _to_hash(value)
         | 
| 233 | 
            +
                  if value.is_a?(Array)
         | 
| 234 | 
            +
                    value.compact.map { |v| _to_hash(v) }
         | 
| 235 | 
            +
                  elsif value.is_a?(Hash)
         | 
| 236 | 
            +
                    {}.tap do |hash|
         | 
| 237 | 
            +
                      value.each { |k, v| hash[k] = _to_hash(v) }
         | 
| 238 | 
            +
                    end
         | 
| 239 | 
            +
                  elsif value.respond_to? :to_hash
         | 
| 240 | 
            +
                    value.to_hash
         | 
| 241 | 
            +
                  else
         | 
| 242 | 
            +
                    value
         | 
| 243 | 
            +
                  end
         | 
| 244 | 
            +
                end
         | 
| 245 | 
            +
             | 
| 246 | 
            +
              end
         | 
| 247 | 
            +
            end
         |