Class: CloudmersiveImageRecognitionApiClient::ResizeApi
- Inherits:
-
Object
- Object
- CloudmersiveImageRecognitionApiClient::ResizeApi
- Defined in:
- lib/cloudmersive-image-recognition-api-client/api/resize_api.rb
Instance Attribute Summary collapse
-
#api_client ⇒ Object
Returns the value of attribute api_client.
Instance Method Summary collapse
-
#initialize(api_client = ApiClient.default) ⇒ ResizeApi
constructor
A new instance of ResizeApi.
-
#resize_post(max_width, max_height, image_file, opts = {}) ⇒ String
Resize an image while preserving aspect ratio Resize an image to a maximum width and maximum height, while preserving the image’s original aspect ratio.
-
#resize_post_with_http_info(max_width, max_height, image_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>
Resize an image while preserving aspect ratio Resize an image to a maximum width and maximum height, while preserving the image's original aspect ratio.
-
#resize_resize_simple(width, height, image_file, opts = {}) ⇒ String
Resize an image Resize an image to a specific width and specific height.
-
#resize_resize_simple_with_http_info(width, height, image_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>
Resize an image Resize an image to a specific width and specific height.
Constructor Details
#initialize(api_client = ApiClient.default) ⇒ ResizeApi
Returns a new instance of ResizeApi.
19 20 21 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 19 def initialize(api_client = ApiClient.default) @api_client = api_client end |
Instance Attribute Details
#api_client ⇒ Object
Returns the value of attribute api_client.
17 18 19 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 17 def api_client @api_client end |
Instance Method Details
#resize_post(max_width, max_height, image_file, opts = {}) ⇒ String
Resize an image while preserving aspect ratio Resize an image to a maximum width and maximum height, while preserving the image’s original aspect ratio
30 31 32 33 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 30 def resize_post(max_width, max_height, image_file, opts = {}) data, _status_code, _headers = resize_post_with_http_info(max_width, max_height, image_file, opts) return data end |
#resize_post_with_http_info(max_width, max_height, image_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>
Resize an image while preserving aspect ratio Resize an image to a maximum width and maximum height, while preserving the image's original aspect ratio
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 42 def resize_post_with_http_info(max_width, max_height, image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ResizeApi.resize_post ..." end # verify the required parameter 'max_width' is set if @api_client.config.client_side_validation && max_width.nil? fail ArgumentError, "Missing the required parameter 'max_width' when calling ResizeApi.resize_post" end # verify the required parameter 'max_height' is set if @api_client.config.client_side_validation && max_height.nil? fail ArgumentError, "Missing the required parameter 'max_height' when calling ResizeApi.resize_post" end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling ResizeApi.resize_post" end # resource path local_var_path = "/image/resize/preserveAspectRatio/{maxWidth}/{maxHeight}".sub('{' + 'maxWidth' + '}', max_width.to_s).sub('{' + 'maxHeight' + '}', max_height.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params["imageFile"] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: ResizeApi#resize_post\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |
#resize_resize_simple(width, height, image_file, opts = {}) ⇒ String
Resize an image Resize an image to a specific width and specific height
98 99 100 101 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 98 def resize_resize_simple(width, height, image_file, opts = {}) data, _status_code, _headers = resize_resize_simple_with_http_info(width, height, image_file, opts) return data end |
#resize_resize_simple_with_http_info(width, height, image_file, opts = {}) ⇒ Array<(String, Fixnum, Hash)>
Resize an image Resize an image to a specific width and specific height
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 |
# File 'lib/cloudmersive-image-recognition-api-client/api/resize_api.rb', line 110 def resize_resize_simple_with_http_info(width, height, image_file, opts = {}) if @api_client.config.debugging @api_client.config.logger.debug "Calling API: ResizeApi.resize_resize_simple ..." end # verify the required parameter 'width' is set if @api_client.config.client_side_validation && width.nil? fail ArgumentError, "Missing the required parameter 'width' when calling ResizeApi.resize_resize_simple" end # verify the required parameter 'height' is set if @api_client.config.client_side_validation && height.nil? fail ArgumentError, "Missing the required parameter 'height' when calling ResizeApi.resize_resize_simple" end # verify the required parameter 'image_file' is set if @api_client.config.client_side_validation && image_file.nil? fail ArgumentError, "Missing the required parameter 'image_file' when calling ResizeApi.resize_resize_simple" end # resource path local_var_path = "/image/resize/target/{width}/{height}".sub('{' + 'width' + '}', width.to_s).sub('{' + 'height' + '}', height.to_s) # query parameters query_params = {} # header parameters header_params = {} # HTTP header 'Accept' (if needed) header_params['Accept'] = @api_client.select_header_accept(['application/octet-stream']) # HTTP header 'Content-Type' header_params['Content-Type'] = @api_client.select_header_content_type(['multipart/form-data']) # form parameters form_params = {} form_params["imageFile"] = image_file # http body (model) post_body = nil auth_names = ['Apikey'] data, status_code, headers = @api_client.call_api(:POST, local_var_path, :header_params => header_params, :query_params => query_params, :form_params => form_params, :body => post_body, :auth_names => auth_names, :return_type => 'String') if @api_client.config.debugging @api_client.config.logger.debug "API called: ResizeApi#resize_resize_simple\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}" end return data, status_code, headers end |