aspose_imaging_cloud 1.0.0 → 19.12
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/README.md +224 -61
- data/lib/aspose-imaging-cloud.rb +161 -0
- data/lib/aspose-imaging-cloud/api/imaging_api.rb +684 -0
- data/lib/aspose-imaging-cloud/api_client.rb +357 -0
- data/lib/aspose-imaging-cloud/api_error.rb +42 -0
- data/lib/{aspose_imaging_cloud → aspose-imaging-cloud}/configuration.rb +236 -166
- data/lib/aspose-imaging-cloud/models/big_rectangular_filter_properties.rb +206 -0
- data/lib/aspose-imaging-cloud/models/bilateral_smoothing_filter_properties.rb +281 -0
- data/lib/aspose-imaging-cloud/models/bmp_properties.rb +202 -0
- data/lib/aspose-imaging-cloud/models/convolution_filter_properties.rb +236 -0
- data/lib/aspose-imaging-cloud/models/deconvolution_filter_properties.rb +266 -0
- data/lib/aspose-imaging-cloud/models/dicom_properties.rb +584 -0
- data/lib/aspose-imaging-cloud/models/disc_usage.rb +222 -0
- data/lib/aspose-imaging-cloud/models/djvu_properties.rb +232 -0
- data/lib/aspose-imaging-cloud/models/dng_properties.rb +329 -0
- data/lib/aspose-imaging-cloud/models/error.rb +232 -0
- data/lib/aspose-imaging-cloud/models/error_details.rb +217 -0
- data/lib/aspose-imaging-cloud/models/exif_data.rb +1560 -0
- data/lib/aspose-imaging-cloud/models/file_version.rb +277 -0
- data/lib/aspose-imaging-cloud/models/file_versions.rb +204 -0
- data/lib/aspose-imaging-cloud/models/files_list.rb +204 -0
- data/lib/aspose-imaging-cloud/models/files_upload_result.rb +216 -0
- data/lib/aspose-imaging-cloud/models/filter_properties_base.rb +206 -0
- data/lib/aspose-imaging-cloud/models/gauss_wiener_filter_properties.rb +296 -0
- data/lib/aspose-imaging-cloud/models/gaussian_blur_filter_properties.rb +266 -0
- data/lib/aspose-imaging-cloud/models/gif_properties.rb +247 -0
- data/lib/aspose-imaging-cloud/models/image_duplicates.rb +204 -0
- data/lib/aspose-imaging-cloud/models/image_duplicates_set.rb +204 -0
- data/lib/aspose-imaging-cloud/models/image_features.rb +257 -0
- data/lib/aspose-imaging-cloud/models/imaging_response.rb +412 -0
- data/lib/aspose-imaging-cloud/models/jfif_data.rb +247 -0
- data/lib/aspose-imaging-cloud/models/jpeg2000_properties.rb +214 -0
- data/lib/aspose-imaging-cloud/models/jpeg_exif_data.rb +1738 -0
- data/lib/aspose-imaging-cloud/models/jpeg_properties.rb +222 -0
- data/lib/aspose-imaging-cloud/models/median_filter_properties.rb +221 -0
- data/lib/aspose-imaging-cloud/models/motion_wiener_filter_properties.rb +311 -0
- data/lib/aspose-imaging-cloud/models/object_exist.rb +222 -0
- data/lib/aspose-imaging-cloud/models/odg_metadata.rb +372 -0
- data/lib/aspose-imaging-cloud/models/odg_page.rb +222 -0
- data/lib/aspose-imaging-cloud/models/odg_properties.rb +229 -0
- data/lib/aspose-imaging-cloud/models/png_properties.rb +192 -0
- data/lib/aspose-imaging-cloud/models/psd_properties.rb +242 -0
- data/lib/aspose-imaging-cloud/models/requests/add_search_image_request.rb +91 -0
- data/lib/aspose-imaging-cloud/models/requests/append_tiff_request.rb +88 -0
- data/lib/aspose-imaging-cloud/models/requests/compare_images_request.rb +94 -0
- data/lib/aspose-imaging-cloud/models/requests/convert_tiff_to_fax_request.rb +80 -0
- data/lib/aspose-imaging-cloud/models/requests/copy_file_request.rb +91 -0
- data/lib/aspose-imaging-cloud/models/requests/copy_folder_request.rb +88 -0
- data/lib/aspose-imaging-cloud/models/requests/create_cropped_image_request.rb +121 -0
- data/lib/aspose-imaging-cloud/models/requests/create_folder_request.rb +77 -0
- data/lib/aspose-imaging-cloud/models/requests/create_image_features_request.rb +89 -0
- data/lib/aspose-imaging-cloud/models/requests/create_image_frame_request.rb +112 -0
- data/lib/aspose-imaging-cloud/models/requests/create_image_search_request.rb +79 -0
- data/lib/aspose-imaging-cloud/models/requests/create_image_tag_request.rb +96 -0
- data/lib/aspose-imaging-cloud/models/requests/create_modified_bmp_request.rb +108 -0
- data/lib/aspose-imaging-cloud/models/requests/create_modified_emf_request.rb +127 -0
- data/lib/aspose-imaging-cloud/models/requests/create_modified_gif_request.rb +102 -0
- data/lib/aspose-imaging-cloud/models/requests/create_modified_jpeg2000_request.rb +95 -0
- data/lib/aspose-imaging-cloud/models/requests/create_modified_jpeg_request.rb +90 -0
- data/lib/aspose-imaging-cloud/models/requests/create_modified_psd_request.rb +90 -0
- data/lib/aspose-imaging-cloud/models/requests/create_modified_svg_request.rb +114 -0
- data/lib/aspose-imaging-cloud/models/requests/create_modified_tiff_request.rb +104 -0
- data/lib/aspose-imaging-cloud/models/requests/create_modified_web_p_request.rb +116 -0
- data/lib/aspose-imaging-cloud/models/requests/create_modified_wmf_request.rb +127 -0
- data/lib/aspose-imaging-cloud/models/requests/create_resized_image_request.rb +105 -0
- data/lib/aspose-imaging-cloud/models/requests/create_rotate_flipped_image_request.rb +97 -0
- data/lib/aspose-imaging-cloud/models/requests/create_saved_image_as_request.rb +89 -0
- data/lib/aspose-imaging-cloud/models/requests/create_updated_image_request.rb +145 -0
- data/lib/aspose-imaging-cloud/models/requests/create_web_site_image_features_request.rb +88 -0
- data/lib/aspose-imaging-cloud/models/requests/crop_image_request.rb +120 -0
- data/lib/aspose-imaging-cloud/models/requests/delete_file_request.rb +80 -0
- data/lib/aspose-imaging-cloud/models/requests/delete_folder_request.rb +80 -0
- data/lib/aspose-imaging-cloud/models/requests/delete_image_features_request.rb +88 -0
- data/lib/aspose-imaging-cloud/models/requests/delete_image_search_request.rb +80 -0
- data/lib/aspose-imaging-cloud/models/requests/delete_search_image_request.rb +88 -0
- data/lib/aspose-imaging-cloud/models/requests/download_file_request.rb +80 -0
- data/lib/aspose-imaging-cloud/models/requests/extract_image_features_request.rb +91 -0
- data/lib/aspose-imaging-cloud/models/requests/extract_image_frame_properties_request.rb +82 -0
- data/lib/aspose-imaging-cloud/models/requests/extract_image_properties_request.rb +75 -0
- data/lib/aspose-imaging-cloud/models/requests/filter_effect_image_request.rb +103 -0
- data/lib/aspose-imaging-cloud/models/requests/find_image_duplicates_request.rb +88 -0
- data/lib/aspose-imaging-cloud/models/requests/find_images_by_tags_request.rb +104 -0
- data/lib/aspose-imaging-cloud/models/requests/find_similar_images_request.rb +102 -0
- data/lib/aspose-imaging-cloud/models/requests/get_disc_usage_request.rb +70 -0
- data/lib/aspose-imaging-cloud/models/requests/get_file_versions_request.rb +77 -0
- data/lib/aspose-imaging-cloud/models/requests/get_files_list_request.rb +77 -0
- data/lib/aspose-imaging-cloud/models/requests/get_image_features_request.rb +88 -0
- data/lib/aspose-imaging-cloud/models/requests/get_image_frame_properties_request.rb +87 -0
- data/lib/aspose-imaging-cloud/models/requests/get_image_frame_request.rb +111 -0
- data/lib/aspose-imaging-cloud/models/requests/get_image_properties_request.rb +80 -0
- data/lib/aspose-imaging-cloud/models/requests/get_image_search_status_request.rb +80 -0
- data/lib/aspose-imaging-cloud/models/requests/get_search_image_request.rb +88 -0
- data/lib/aspose-imaging-cloud/models/requests/http_request.rb +50 -0
- data/lib/aspose-imaging-cloud/models/requests/imaging_request.rb +101 -0
- data/lib/aspose-imaging-cloud/models/requests/modify_bmp_request.rb +107 -0
- data/lib/aspose-imaging-cloud/models/requests/modify_emf_request.rb +126 -0
- data/lib/aspose-imaging-cloud/models/requests/modify_gif_request.rb +101 -0
- data/lib/aspose-imaging-cloud/models/requests/modify_jpeg2000_request.rb +94 -0
- data/lib/aspose-imaging-cloud/models/requests/modify_jpeg_request.rb +89 -0
- data/lib/aspose-imaging-cloud/models/requests/modify_psd_request.rb +89 -0
- data/lib/aspose-imaging-cloud/models/requests/modify_svg_request.rb +113 -0
- data/lib/aspose-imaging-cloud/models/requests/modify_tiff_request.rb +103 -0
- data/lib/aspose-imaging-cloud/models/requests/modify_web_p_request.rb +115 -0
- data/lib/aspose-imaging-cloud/models/requests/modify_wmf_request.rb +126 -0
- data/lib/aspose-imaging-cloud/models/requests/move_file_request.rb +91 -0
- data/lib/aspose-imaging-cloud/models/requests/move_folder_request.rb +88 -0
- data/lib/aspose-imaging-cloud/models/requests/object_exists_request.rb +80 -0
- data/lib/aspose-imaging-cloud/models/requests/resize_image_request.rb +104 -0
- data/lib/aspose-imaging-cloud/models/requests/rotate_flip_image_request.rb +96 -0
- data/lib/aspose-imaging-cloud/models/requests/save_image_as_request.rb +88 -0
- data/lib/aspose-imaging-cloud/models/requests/storage_exists_request.rb +74 -0
- data/lib/aspose-imaging-cloud/models/requests/update_image_features_request.rb +91 -0
- data/lib/aspose-imaging-cloud/models/requests/update_image_request.rb +144 -0
- data/lib/aspose-imaging-cloud/models/requests/update_search_image_request.rb +91 -0
- data/lib/aspose-imaging-cloud/models/requests/upload_file_request.rb +86 -0
- data/lib/aspose-imaging-cloud/models/search_context_status.rb +212 -0
- data/lib/aspose-imaging-cloud/models/search_result.rb +217 -0
- data/lib/aspose-imaging-cloud/models/search_results_set.rb +204 -0
- data/lib/aspose-imaging-cloud/models/sharpen_filter_properties.rb +266 -0
- data/lib/aspose-imaging-cloud/models/small_rectangular_filter_properties.rb +206 -0
- data/lib/aspose-imaging-cloud/models/storage_exist.rb +207 -0
- data/lib/aspose-imaging-cloud/models/storage_file.rb +252 -0
- data/lib/aspose-imaging-cloud/models/svg_properties.rb +202 -0
- data/lib/aspose-imaging-cloud/models/tiff_frame.rb +242 -0
- data/lib/aspose-imaging-cloud/models/tiff_options.rb +734 -0
- data/lib/aspose-imaging-cloud/models/tiff_properties.rb +224 -0
- data/lib/aspose-imaging-cloud/models/web_p_properties.rb +252 -0
- data/lib/aspose-imaging-cloud/version.rb +15 -0
- metadata +149 -129
- data/LICENSE +0 -22
- data/aspose_imaging_cloud.gemspec +0 -26
- data/lib/aspose_imaging_cloud.rb +0 -43
- data/lib/aspose_imaging_cloud/api/imaging_api.rb +0 -1776
- data/lib/aspose_imaging_cloud/api_client.rb +0 -335
- data/lib/aspose_imaging_cloud/api_error.rb +0 -24
- data/lib/aspose_imaging_cloud/models/base_object.rb +0 -86
- data/lib/aspose_imaging_cloud/models/base_response.rb +0 -53
- data/lib/aspose_imaging_cloud/models/bmp_properties.rb +0 -37
- data/lib/aspose_imaging_cloud/models/exif_data.rb +0 -855
- data/lib/aspose_imaging_cloud/models/gif_properties.rb +0 -53
- data/lib/aspose_imaging_cloud/models/imaging_response.rb +0 -149
- data/lib/aspose_imaging_cloud/models/jfif_data.rb +0 -61
- data/lib/aspose_imaging_cloud/models/jpeg_exif_data.rb +0 -991
- data/lib/aspose_imaging_cloud/models/jpeg_properties.rb +0 -53
- data/lib/aspose_imaging_cloud/models/psd_properties.rb +0 -61
- data/lib/aspose_imaging_cloud/models/tiff_frame.rb +0 -61
- data/lib/aspose_imaging_cloud/models/tiff_options.rb +0 -419
- data/lib/aspose_imaging_cloud/models/tiff_properties.rb +0 -55
- data/lib/aspose_imaging_cloud/version.rb +0 -3
- data/test/data/TestDemo.tif +0 -0
- data/test/data/aspose.jpg +0 -0
- data/test/data/aspose_imaging_for_cloud.png +0 -0
- data/test/data/demo.tif +0 -0
- data/test/data/sample-multi.tif +0 -0
- data/test/data/sample.bmp +0 -0
- data/test/data/sample.gif +0 -0
- data/test/data/sample.psd +0 -0
- data/test/data/sample.tif +0 -0
- data/test/data/test.bmp +0 -0
- data/test/imaging_tests.rb +0 -291
@@ -0,0 +1,357 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose" file="api_client.rb">
|
3
|
+
# Copyright (c) 2018-2019 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
|
+
require 'date'
|
27
|
+
require 'json'
|
28
|
+
require 'logger'
|
29
|
+
require 'tempfile'
|
30
|
+
require 'faraday'
|
31
|
+
require 'mimemagic'
|
32
|
+
require 'uri'
|
33
|
+
|
34
|
+
module AsposeImagingCloud
|
35
|
+
# Generic API client
|
36
|
+
# Swagger generic API client. This client handles the client-
|
37
|
+
# server communication, and is invariant across implementations.
|
38
|
+
class ApiClient
|
39
|
+
# The Configuration object holding settings to be used in the API client.
|
40
|
+
attr_accessor :config
|
41
|
+
|
42
|
+
# Defines the headers to be used in HTTP requests of all API calls by default.
|
43
|
+
#
|
44
|
+
# @return [Hash]
|
45
|
+
attr_accessor :default_headers
|
46
|
+
|
47
|
+
# Initializes the ApiClient
|
48
|
+
# @param [String] app_key Key to access the server.
|
49
|
+
# @param [String] app_sid ID to access the server.
|
50
|
+
# @param [String] base_url Server URL.
|
51
|
+
# @param [String] api_version Api version.
|
52
|
+
# @param [Object] debug Debug switch [true, false].
|
53
|
+
def initialize(app_key = nil, app_sid = nil, base_url = 'api-qa.aspose.cloud', api_version = 'v3.0', debug = false)
|
54
|
+
@config = Configuration.new(app_key, app_sid, base_url, api_version, debug)
|
55
|
+
@default_headers = {
|
56
|
+
'x-aspose-client' => 'ruby sdk',
|
57
|
+
'x-aspose-version' => '19.12'
|
58
|
+
}
|
59
|
+
end
|
60
|
+
|
61
|
+
# Call an API with given options.
|
62
|
+
#
|
63
|
+
# @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements:
|
64
|
+
# the data deserialized from response body (could be nil), response status code and response headers.
|
65
|
+
def call_api(http_method, path, opts = {})
|
66
|
+
response = build_request(http_method, path, opts)
|
67
|
+
|
68
|
+
if @config.debugging
|
69
|
+
@config.logger.debug "'HTTP' response body '~BEGIN~'\n #{response.body}\n'~END~'\n"
|
70
|
+
end
|
71
|
+
|
72
|
+
unless response.success?
|
73
|
+
if response.status.zero?
|
74
|
+
# Errors from libcurl will be made visible here
|
75
|
+
raise ApiError.new(response.return_message, 0)
|
76
|
+
else
|
77
|
+
begin
|
78
|
+
error = convert_to_type(JSON.parse(response.body, symbolize_names: true)[:error], "Error")
|
79
|
+
ensure
|
80
|
+
raise ApiError.new("#{response.status} Error connecting to the API #{path}; Message: #{error}",
|
81
|
+
response.status, error)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
86
|
+
data = ''
|
87
|
+
if opts[:return_type]
|
88
|
+
data = opts[:return_type] == 'File' ? response.body : deserialize(response, opts[:return_type])
|
89
|
+
end
|
90
|
+
[data, response.status, response.headers]
|
91
|
+
end
|
92
|
+
|
93
|
+
# Builds the HTTP request
|
94
|
+
#
|
95
|
+
# @param [String] http_method HTTP method/verb (e.g. POST)
|
96
|
+
# @param [String] path URL path (e.g. /account/new)
|
97
|
+
# @option opts [Hash] :header_params Header parameters
|
98
|
+
# @option opts [Hash] :query_params Query parameters
|
99
|
+
# @option opts [Hash] :form_params Query parameters
|
100
|
+
# @option opts [Object] :body HTTP body (JSON/XML)
|
101
|
+
# @return [Faraday::Response] A Faraday Response
|
102
|
+
def build_request(http_method, path, opts = {})
|
103
|
+
url = build_request_url(path)
|
104
|
+
http_method = http_method.to_sym.downcase
|
105
|
+
|
106
|
+
header_params = @default_headers.merge(opts[:header_params] || {})
|
107
|
+
query_params = opts[:query_params] || {}
|
108
|
+
form_params = opts[:form_params] || {}
|
109
|
+
body = opts[:body] if opts[:body] || nil?
|
110
|
+
|
111
|
+
update_params_for_auth! header_params, query_params, opts[:auth_names]
|
112
|
+
|
113
|
+
req_opts = {
|
114
|
+
:method => http_method,
|
115
|
+
:headers => header_params,
|
116
|
+
:params => query_params,
|
117
|
+
:body => body
|
118
|
+
}
|
119
|
+
|
120
|
+
if [:post, :patch, :put, :delete].include?(http_method)
|
121
|
+
req_body = build_request_body(header_params, form_params, opts[:body])
|
122
|
+
req_opts.update :body => req_body
|
123
|
+
if @config.debugging
|
124
|
+
@config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
|
125
|
+
end
|
126
|
+
elsif http_method == :get && body.nil? && !form_params.any? && header_params['Content-Type'] == 'multipart/form-data'
|
127
|
+
req_opts[:headers].delete('Content-Type')
|
128
|
+
end
|
129
|
+
|
130
|
+
conn = Faraday.new url, { :params => query_params, :headers => header_params } do |f|
|
131
|
+
f.request :multipart
|
132
|
+
f.request :url_encoded
|
133
|
+
f.adapter :net_http_persistent, pool_size: 5
|
134
|
+
end
|
135
|
+
|
136
|
+
case http_method
|
137
|
+
when :post
|
138
|
+
return conn.post url, req_opts[:body]
|
139
|
+
when :put
|
140
|
+
return conn.put url, req_opts[:body]
|
141
|
+
when :get
|
142
|
+
return conn.get url, req_opts[:body]
|
143
|
+
else
|
144
|
+
return conn.delete url do |c|
|
145
|
+
c.body = req_opts[:body]
|
146
|
+
end
|
147
|
+
end
|
148
|
+
end
|
149
|
+
|
150
|
+
# Check if the given MIME is a JSON MIME.
|
151
|
+
# JSON MIME examples:
|
152
|
+
# application/json
|
153
|
+
# application/json; charset=UTF8
|
154
|
+
# APPLICATION/JSON
|
155
|
+
# */*
|
156
|
+
# @param [String] mime MIME
|
157
|
+
# @return [Boolean] True if the MIME is application/json
|
158
|
+
def json_mime?(mime)
|
159
|
+
(mime == '*/*') || !(mime =~ %r{Application/.*json(?!p)(;.*)?}i).nil?
|
160
|
+
end
|
161
|
+
|
162
|
+
# Deserialize the response to the given return type.
|
163
|
+
#
|
164
|
+
# @param [Response] response HTTP response
|
165
|
+
# @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
|
166
|
+
def deserialize(response, return_type)
|
167
|
+
body = response.body
|
168
|
+
|
169
|
+
# handle file downloading - return the File instance processed in request callbacks
|
170
|
+
# note that response body is empty when the file is written in chunks in request on_body callback
|
171
|
+
return @tempfile if return_type == 'File'
|
172
|
+
|
173
|
+
return nil if body.nil? || body.empty?
|
174
|
+
|
175
|
+
# return response body directly for String return type
|
176
|
+
return body if return_type == 'String'
|
177
|
+
|
178
|
+
# ensuring a default content type
|
179
|
+
content_type = response.headers['Content-Type'] || 'application/json'
|
180
|
+
|
181
|
+
raise "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
|
182
|
+
|
183
|
+
begin
|
184
|
+
data = JSON.parse("[#{body}]", symbolize_names: true)[0]
|
185
|
+
rescue JSON::ParserError => e
|
186
|
+
if %w[String Date DateTime].include?(return_type)
|
187
|
+
data = body
|
188
|
+
else
|
189
|
+
raise e
|
190
|
+
end
|
191
|
+
end
|
192
|
+
|
193
|
+
convert_to_type data, return_type
|
194
|
+
end
|
195
|
+
|
196
|
+
# Convert data to the given return type.
|
197
|
+
# @param [Object] data Data to be converted
|
198
|
+
# @param [String] return_type Return type
|
199
|
+
# @return [Mixed] Data in a particular type
|
200
|
+
def convert_to_type(data, return_type)
|
201
|
+
return nil if data.nil?
|
202
|
+
|
203
|
+
case return_type
|
204
|
+
when 'String'
|
205
|
+
data.to_s
|
206
|
+
when 'Integer'
|
207
|
+
data.to_i
|
208
|
+
when 'Float'
|
209
|
+
data.to_f
|
210
|
+
when 'BOOLEAN'
|
211
|
+
data == true
|
212
|
+
when 'DateTime'
|
213
|
+
# parse date time (expecting ISO 8601 format)
|
214
|
+
DateTime.parse data
|
215
|
+
when 'Date'
|
216
|
+
# parse date time (expecting ISO 8601 format)
|
217
|
+
Date.parse data
|
218
|
+
when 'Object'
|
219
|
+
# generic object (usually a Hash), return directly
|
220
|
+
data
|
221
|
+
when /\AArray<(.+)>\z/
|
222
|
+
# e.g. Array<Pet>
|
223
|
+
sub_type = Regexp.last_match(1)
|
224
|
+
data.map { |item| convert_to_type(item, sub_type) }
|
225
|
+
when /\AHash\<String, (.+)\>\z/
|
226
|
+
# e.g. Hash<String, Integer>
|
227
|
+
sub_type = Regexp.last_match(1)
|
228
|
+
{}.tap do |hash|
|
229
|
+
data.each { |k, v| hash[k] = convert_to_type(v, sub_type) }
|
230
|
+
end
|
231
|
+
else
|
232
|
+
# models, e.g. Pet
|
233
|
+
AsposeImagingCloud.const_get(return_type).new.tap do |model|
|
234
|
+
model.build_from_hash data
|
235
|
+
end
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
239
|
+
# Save response body into a file in (the defined) temporary folder, using the filename
|
240
|
+
# from the "Content-Disposition" header if provided, otherwise a random filename.
|
241
|
+
# The response body is written to the file in chunks in order to handle files which
|
242
|
+
# size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
|
243
|
+
# process can use.
|
244
|
+
#
|
245
|
+
# @see Configuration#temp_folder_path
|
246
|
+
def download_file(response)
|
247
|
+
tempfile = nil
|
248
|
+
encoding = nil
|
249
|
+
content_disposition = response.headers['Content-Disposition']
|
250
|
+
if content_disposition and content_disposition =~ /filename=/i
|
251
|
+
filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
|
252
|
+
prefix = sanitize_filename(filename)
|
253
|
+
else
|
254
|
+
prefix = 'download-'
|
255
|
+
end
|
256
|
+
prefix += '-' unless prefix.end_with?('-')
|
257
|
+
encoding = response.body.encoding
|
258
|
+
tempfile = Tempfile.open(prefix, @config.temp_folder_path).binmode
|
259
|
+
@tempfile = tempfile
|
260
|
+
tempfile.write(response.body)
|
261
|
+
response.on_complete do |resp|
|
262
|
+
tempfile.close
|
263
|
+
@config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
|
264
|
+
"with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
|
265
|
+
"will be deleted automatically with GC. It's also recommended to delete the temp file "\
|
266
|
+
"explicitly with `tempfile.delete`"
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
# Sanitize filename by removing path.
|
271
|
+
# e.g. ../../sun.gif becomes sun.gif
|
272
|
+
#
|
273
|
+
# @param [String] filename the filename to be sanitized
|
274
|
+
# @return [String] the sanitized filename
|
275
|
+
def sanitize_filename(filename)
|
276
|
+
filename.gsub(%r{.*[/\\]}, '')
|
277
|
+
end
|
278
|
+
|
279
|
+
def build_request_url(path)
|
280
|
+
# Add leading and trailing slashes to path
|
281
|
+
path = "/#{path}".gsub(%r{/+}, '/')
|
282
|
+
URI.encode(@config.base_url + path)
|
283
|
+
end
|
284
|
+
|
285
|
+
# Builds the HTTP request body
|
286
|
+
#
|
287
|
+
# @param [Hash] header_params Header parameters
|
288
|
+
# @param [Hash] form_params Query parameters
|
289
|
+
# @param [Object] body HTTP body (JSON/XML)
|
290
|
+
# @return [String] HTTP body data in the form of string
|
291
|
+
def build_request_body(header_params, form_params, body)
|
292
|
+
# http form
|
293
|
+
if (header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
|
294
|
+
header_params['Content-Type'] == 'multipart/form-data') && form_params.any?
|
295
|
+
data = {}
|
296
|
+
form_params.each do |key, value|
|
297
|
+
case value
|
298
|
+
when ::File, ::Tempfile
|
299
|
+
data[key] = Faraday::UploadIO.new(value.path, MimeMagic.by_magic(value).to_s, key)
|
300
|
+
when ::Array, nil
|
301
|
+
data[key] = value
|
302
|
+
when ::StringIO
|
303
|
+
data[key] = Faraday::UploadIO.new(value, MimeMagic.by_magic(value).to_s, key)
|
304
|
+
else
|
305
|
+
data[key] = value.to_s
|
306
|
+
end
|
307
|
+
end
|
308
|
+
elsif body
|
309
|
+
data = body.is_a?(String) ? body : body.to_json
|
310
|
+
else
|
311
|
+
data = nil
|
312
|
+
end
|
313
|
+
data
|
314
|
+
end
|
315
|
+
|
316
|
+
# Update hearder and query params based on authentication settings.
|
317
|
+
#
|
318
|
+
# @param [Hash] header_params Header parameters
|
319
|
+
# @param [Hash] query_params Query parameters
|
320
|
+
# @param [String] auth_names Authentication scheme name
|
321
|
+
def update_params_for_auth!(header_params, query_params, auth_names)
|
322
|
+
Array(auth_names).each do |auth_name|
|
323
|
+
auth_setting = @config.auth_settings[auth_name.to_sym]
|
324
|
+
next unless auth_setting
|
325
|
+
|
326
|
+
case auth_setting[:in]
|
327
|
+
when 'header'
|
328
|
+
header_params[auth_setting[:key]] = auth_setting[:value]
|
329
|
+
when 'query'
|
330
|
+
query_params[auth_setting[:key]] = auth_setting[:value]
|
331
|
+
else
|
332
|
+
raise ArgumentError, 'Authentication token must be in `query` of `header`'
|
333
|
+
end
|
334
|
+
end
|
335
|
+
end
|
336
|
+
|
337
|
+
# Build parameter value according to the given collection format.
|
338
|
+
# @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
|
339
|
+
def build_collection_param(param, collection_format)
|
340
|
+
case collection_format
|
341
|
+
when :csv
|
342
|
+
param.join(',')
|
343
|
+
when :ssv
|
344
|
+
param.join(' ')
|
345
|
+
when :tsv
|
346
|
+
param.join("\t")
|
347
|
+
when :pipes
|
348
|
+
param.join('|')
|
349
|
+
when :multi
|
350
|
+
# return the array directly as typhoeus will handle it as expected
|
351
|
+
param
|
352
|
+
else
|
353
|
+
raise "unknown collection format: #{collection_format.inspect}"
|
354
|
+
end
|
355
|
+
end
|
356
|
+
end
|
357
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# ----------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose" file="api_error.rb">
|
3
|
+
# Copyright (c) 2018-2019 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
|
+
module AsposeImagingCloud
|
28
|
+
# Imaging API Exception
|
29
|
+
class ApiError < StandardError
|
30
|
+
attr_reader :message, :code, :error
|
31
|
+
|
32
|
+
# Initializes a new instance of the ApiError class
|
33
|
+
# @param [String] message
|
34
|
+
# @param [String] code
|
35
|
+
# @param [String] error
|
36
|
+
def initialize(message, code, error = nil)
|
37
|
+
@message = message
|
38
|
+
@code = code
|
39
|
+
@error = error
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
@@ -1,166 +1,236 @@
|
|
1
|
-
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
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
|
-
#
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
#
|
45
|
-
attr_accessor :
|
46
|
-
|
47
|
-
#
|
48
|
-
#
|
49
|
-
#
|
50
|
-
#
|
51
|
-
# @
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
#
|
56
|
-
#
|
57
|
-
# @return [
|
58
|
-
|
59
|
-
|
60
|
-
#
|
61
|
-
|
62
|
-
|
63
|
-
#
|
64
|
-
#
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
#
|
69
|
-
#
|
70
|
-
#
|
71
|
-
|
72
|
-
|
73
|
-
#
|
74
|
-
attr_accessor :
|
75
|
-
|
76
|
-
# Set this to
|
77
|
-
#
|
78
|
-
#
|
79
|
-
#
|
80
|
-
# @
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
#
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
98
|
-
|
99
|
-
|
100
|
-
|
101
|
-
|
102
|
-
|
103
|
-
|
104
|
-
|
105
|
-
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
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
|
-
|
158
|
-
|
159
|
-
|
160
|
-
|
161
|
-
|
162
|
-
{
|
163
|
-
|
164
|
-
|
165
|
-
|
166
|
-
|
1
|
+
# ----------------------------------------------------------------------------
|
2
|
+
# <copyright company="Aspose" file="configuration.rb">
|
3
|
+
# Copyright (c) 2018-2019 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 'uri'
|
28
|
+
|
29
|
+
module AsposeImagingCloud
|
30
|
+
|
31
|
+
# Class which contains configuration parameters
|
32
|
+
class Configuration
|
33
|
+
attr_accessor :on_premise
|
34
|
+
|
35
|
+
# Defines url scheme
|
36
|
+
attr_accessor :scheme
|
37
|
+
|
38
|
+
# Defines url host
|
39
|
+
attr_accessor :host
|
40
|
+
|
41
|
+
# Defines url base path
|
42
|
+
attr_accessor :base_path
|
43
|
+
|
44
|
+
# Defines api version
|
45
|
+
attr_accessor :api_version
|
46
|
+
|
47
|
+
# Defines API keys used with API Key authentications.
|
48
|
+
#
|
49
|
+
# @return [Hash] key: parameter name, value: parameter value (API key)
|
50
|
+
#
|
51
|
+
# @example parameter name is "api_key", API key is "xxx" (e.g. "api_key=xxx" in query string)
|
52
|
+
# config.api_key['api_key'] = 'xxx'
|
53
|
+
attr_accessor :api_key
|
54
|
+
|
55
|
+
# Defines API key prefixes used with API Key authentications.
|
56
|
+
#
|
57
|
+
# @return [Hash] key: parameter name, value: API key prefix
|
58
|
+
#
|
59
|
+
# @example parameter name is "Authorization", API key prefix is "Token" (e.g. "Authorization: Token xxx" in headers)
|
60
|
+
# config.api_key_prefix['api_key'] = 'Token'
|
61
|
+
attr_accessor :api_key_prefix
|
62
|
+
|
63
|
+
# Defines the username used with HTTP basic authentication.
|
64
|
+
#
|
65
|
+
# @return [String]
|
66
|
+
attr_accessor :username
|
67
|
+
|
68
|
+
# Defines the password used with HTTP basic authentication.
|
69
|
+
#
|
70
|
+
# @return [String]
|
71
|
+
attr_accessor :password
|
72
|
+
|
73
|
+
# Defines the access token (Bearer) used with OAuth2.
|
74
|
+
attr_accessor :access_token
|
75
|
+
|
76
|
+
# Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
|
77
|
+
# details will be logged with `logger.debug` (see the `logger` attribute).
|
78
|
+
# Default to false.
|
79
|
+
#
|
80
|
+
# @return [true, false]
|
81
|
+
attr_accessor :debugging
|
82
|
+
|
83
|
+
# Defines the logger used for debugging.
|
84
|
+
# Default to `Rails.logger` (when in Rails) or logging to STDOUT.
|
85
|
+
#
|
86
|
+
# @return [#debug]
|
87
|
+
attr_accessor :logger
|
88
|
+
|
89
|
+
# Defines the temporary folder to store downloaded files
|
90
|
+
# (for API endpoints that have file response).
|
91
|
+
# Default to use `Tempfile`.
|
92
|
+
#
|
93
|
+
# @return [String]
|
94
|
+
attr_accessor :temp_folder_path
|
95
|
+
|
96
|
+
# The time limit for HTTP request in seconds.
|
97
|
+
# Default to 0 (never times out).
|
98
|
+
attr_accessor :timeout
|
99
|
+
|
100
|
+
# Set this to false to skip client side validation in the operation.
|
101
|
+
# Default to true.
|
102
|
+
# @return [true, false]
|
103
|
+
attr_accessor :client_side_validation
|
104
|
+
|
105
|
+
### TLS/SSL setting
|
106
|
+
# Set this to false to skip verifying SSL certificate when calling API from https server.
|
107
|
+
# Default to true.
|
108
|
+
#
|
109
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
110
|
+
#
|
111
|
+
# @return [true, false]
|
112
|
+
attr_accessor :verify_ssl
|
113
|
+
|
114
|
+
### TLS/SSL setting
|
115
|
+
# Set this to false to skip verifying SSL host name
|
116
|
+
# Default to true.
|
117
|
+
#
|
118
|
+
# @note Do NOT set it to false in production code, otherwise you would face multiple types of cryptographic attacks.
|
119
|
+
#
|
120
|
+
# @return [true, false]
|
121
|
+
attr_accessor :verify_ssl_host
|
122
|
+
|
123
|
+
### TLS/SSL setting
|
124
|
+
# Set this to customize the certificate file to verify the peer.
|
125
|
+
#
|
126
|
+
# @return [String] the path to the certificate file
|
127
|
+
#
|
128
|
+
# @see The `cainfo` option of Typhoeus, `--cert` option of libcurl. Related source code:
|
129
|
+
# https://github.com/typhoeus/typhoeus/blob/master/lib/typhoeus/easy_factory.rb#L145
|
130
|
+
attr_accessor :ssl_ca_cert
|
131
|
+
|
132
|
+
### TLS/SSL setting
|
133
|
+
# Client certificate file (for client certificate)
|
134
|
+
attr_accessor :cert_file
|
135
|
+
|
136
|
+
### TLS/SSL setting
|
137
|
+
# Client private key file (for client certificate)
|
138
|
+
attr_accessor :key_file
|
139
|
+
|
140
|
+
# Set this to customize parameters encoding of array parameter with multi collectionFormat.
|
141
|
+
# Default to nil.
|
142
|
+
#
|
143
|
+
# @see The params_encoding option of Ethon. Related source code:
|
144
|
+
# https://github.com/typhoeus/ethon/blob/master/lib/ethon/easy/queryable.rb#L96
|
145
|
+
attr_accessor :params_encoding
|
146
|
+
|
147
|
+
attr_accessor :inject_format
|
148
|
+
|
149
|
+
attr_accessor :force_ending_format
|
150
|
+
|
151
|
+
# Initializes a new instance.
|
152
|
+
# @param [String] app_key Key to access the server.
|
153
|
+
# @param [String] app_sid ID to access the server.
|
154
|
+
# @param [String] base_url Server URL.
|
155
|
+
# @param [String] api_version Api version.
|
156
|
+
# @param [Object] debug Debug switch [true, false].
|
157
|
+
def initialize(app_key = nil, app_sid = nil, base_url = 'api-qa.aspose.cloud', api_version = 'v3.0', debug = false)
|
158
|
+
@scheme = 'https'
|
159
|
+
self.host = base_url
|
160
|
+
@api_version = api_version
|
161
|
+
self.base_path = @api_version
|
162
|
+
@api_key = { 'api_key': app_key || '',
|
163
|
+
'app_sid': app_sid || '' }
|
164
|
+
@api_key_prefix = {}
|
165
|
+
@timeout = 0
|
166
|
+
@client_side_validation = true
|
167
|
+
@verify_ssl = true
|
168
|
+
@verify_ssl_host = true
|
169
|
+
@params_encoding = nil
|
170
|
+
@cert_file = nil
|
171
|
+
@key_file = nil
|
172
|
+
@debugging = debug
|
173
|
+
@inject_format = false
|
174
|
+
@force_ending_format = false
|
175
|
+
@logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
|
176
|
+
@on_premise = (!(app_key || app_sid) && base_url)
|
177
|
+
|
178
|
+
yield(self) if block_given?
|
179
|
+
end
|
180
|
+
|
181
|
+
def configure
|
182
|
+
yield(self) if block_given?
|
183
|
+
end
|
184
|
+
|
185
|
+
def scheme=(scheme)
|
186
|
+
# remove :// from scheme
|
187
|
+
@scheme = scheme.sub(/:\/\//, '')
|
188
|
+
end
|
189
|
+
|
190
|
+
def host=(host)
|
191
|
+
# remove http(s):// and anything after a slash
|
192
|
+
@host = host.sub(/https?:\/\//, '').split('/').first
|
193
|
+
end
|
194
|
+
|
195
|
+
def base_path=(base_path)
|
196
|
+
return unless base_path
|
197
|
+
|
198
|
+
# Add leading and trailing slashes to base_path
|
199
|
+
@base_path = "/#{base_path}".gsub(/\/+/, '/')
|
200
|
+
@base_path = '' if @base_path == '/'
|
201
|
+
end
|
202
|
+
|
203
|
+
def base_url
|
204
|
+
url = "#{scheme}://#{[host, base_path].join('/').gsub(/\/+/, '/')}".sub(/\/+\z/, '')
|
205
|
+
URI.encode(url)
|
206
|
+
end
|
207
|
+
|
208
|
+
# Gets API key (with prefix if set).
|
209
|
+
# @param [String] param_name the parameter name of API key auth
|
210
|
+
def api_key_with_prefix(param_name)
|
211
|
+
if @api_key_prefix[param_name]
|
212
|
+
"#{@api_key_prefix[param_name]} #{@api_key[param_name]}"
|
213
|
+
else
|
214
|
+
@api_key[param_name]
|
215
|
+
end
|
216
|
+
end
|
217
|
+
|
218
|
+
# Gets Basic Auth token string
|
219
|
+
def basic_auth_token
|
220
|
+
'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n")
|
221
|
+
end
|
222
|
+
|
223
|
+
# Returns Auth Settings hash for api client.
|
224
|
+
def auth_settings
|
225
|
+
{
|
226
|
+
JWT:
|
227
|
+
{
|
228
|
+
type: 'oauth2',
|
229
|
+
in: 'header',
|
230
|
+
key: 'Authorization',
|
231
|
+
value: "Bearer #{access_token}"
|
232
|
+
}
|
233
|
+
}
|
234
|
+
end
|
235
|
+
end
|
236
|
+
end
|