aspose_imaging_cloud 1.0.0

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.
Files changed (35) hide show
  1. checksums.yaml +7 -0
  2. data/LICENSE +22 -0
  3. data/README.md +61 -0
  4. data/aspose_imaging_cloud.gemspec +26 -0
  5. data/lib/aspose_imaging_cloud.rb +43 -0
  6. data/lib/aspose_imaging_cloud/api/imaging_api.rb +1776 -0
  7. data/lib/aspose_imaging_cloud/api_client.rb +335 -0
  8. data/lib/aspose_imaging_cloud/api_error.rb +24 -0
  9. data/lib/aspose_imaging_cloud/configuration.rb +166 -0
  10. data/lib/aspose_imaging_cloud/models/base_object.rb +86 -0
  11. data/lib/aspose_imaging_cloud/models/base_response.rb +53 -0
  12. data/lib/aspose_imaging_cloud/models/bmp_properties.rb +37 -0
  13. data/lib/aspose_imaging_cloud/models/exif_data.rb +855 -0
  14. data/lib/aspose_imaging_cloud/models/gif_properties.rb +53 -0
  15. data/lib/aspose_imaging_cloud/models/imaging_response.rb +149 -0
  16. data/lib/aspose_imaging_cloud/models/jfif_data.rb +61 -0
  17. data/lib/aspose_imaging_cloud/models/jpeg_exif_data.rb +991 -0
  18. data/lib/aspose_imaging_cloud/models/jpeg_properties.rb +53 -0
  19. data/lib/aspose_imaging_cloud/models/psd_properties.rb +61 -0
  20. data/lib/aspose_imaging_cloud/models/tiff_frame.rb +61 -0
  21. data/lib/aspose_imaging_cloud/models/tiff_options.rb +419 -0
  22. data/lib/aspose_imaging_cloud/models/tiff_properties.rb +55 -0
  23. data/lib/aspose_imaging_cloud/version.rb +3 -0
  24. data/test/data/TestDemo.tif +0 -0
  25. data/test/data/aspose.jpg +0 -0
  26. data/test/data/aspose_imaging_for_cloud.png +0 -0
  27. data/test/data/demo.tif +0 -0
  28. data/test/data/sample-multi.tif +0 -0
  29. data/test/data/sample.bmp +0 -0
  30. data/test/data/sample.gif +0 -0
  31. data/test/data/sample.psd +0 -0
  32. data/test/data/sample.tif +0 -0
  33. data/test/data/test.bmp +0 -0
  34. data/test/imaging_tests.rb +291 -0
  35. metadata +160 -0
@@ -0,0 +1,55 @@
1
+ module AsposeImagingCloud
2
+ #
3
+ class TiffProperties < BaseObject
4
+ attr_accessor :frames, :byte_order, :exif_data
5
+ # attribute mapping from ruby-style variable name to JSON key
6
+ def self.attribute_map
7
+ {
8
+
9
+ #
10
+ :'frames' => :'Frames',
11
+
12
+ #
13
+ :'byte_order' => :'ByteOrder',
14
+
15
+ #
16
+ :'exif_data' => :'ExifData'
17
+
18
+ }
19
+ end
20
+
21
+ # attribute type
22
+ def self.swagger_types
23
+ {
24
+ :'frames' => :'Array<TiffFrame>',
25
+ :'byte_order' => :'String',
26
+ :'exif_data' => :'ExifData'
27
+
28
+ }
29
+ end
30
+
31
+ def initialize(attributes = {})
32
+ return if !attributes.is_a?(Hash) || attributes.empty?
33
+
34
+ # convert string to symbol for hash key
35
+ attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
36
+
37
+
38
+ if attributes[:'Frames']
39
+ if (value = attributes[:'Frames']).is_a?(Array)
40
+ self.frames = value
41
+ end
42
+ end
43
+
44
+ if attributes[:'ByteOrder']
45
+ self.byte_order = attributes[:'ByteOrder']
46
+ end
47
+
48
+ if attributes[:'ExifData']
49
+ self.exif_data = attributes[:'ExifData']
50
+ end
51
+
52
+ end
53
+
54
+ end
55
+ end
@@ -0,0 +1,3 @@
1
+ module AsposeImagingCloud
2
+ VERSION = "1.0.0"
3
+ end
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
@@ -0,0 +1,291 @@
1
+ require "minitest/autorun"
2
+ require "minitest/unit"
3
+
4
+ require_relative '../lib/aspose_imaging_cloud'
5
+
6
+ class ImagingTests < Minitest::Test
7
+ include MiniTest::Assertions
8
+ include AsposeImagingCloud
9
+ include AsposeStorageCloud
10
+
11
+ def setup
12
+ #Get App key and App SID from https://cloud.aspose.com
13
+ AsposeApp.app_key_and_sid("", "")
14
+ @imaging_api = ImagingApi.new
15
+ end
16
+
17
+ def teardown
18
+ end
19
+
20
+ def upload_file(file_name)
21
+ @storage_api = StorageApi.new
22
+ response = @storage_api.put_create(file_name, File.open("data/" << file_name,"r") { |io| io.read } )
23
+ assert(response, message="Failed to upload {file_name} file.")
24
+ end
25
+
26
+ def test_post_image_bmp
27
+ bits_per_pixel = 24
28
+ horizontal_resolution = 300
29
+ vertical_resolution = 300
30
+ file_name = "sample.bmp"
31
+ file = File.open("data/" << file_name,"r") { |io| io.read }
32
+
33
+ response = @imaging_api.post_image_bmp(bits_per_pixel, horizontal_resolution, vertical_resolution, file)
34
+ assert(response, message="Failed to update parameters of bmp image.")
35
+ end
36
+
37
+ def test_post_crop_image
38
+ format = "png"
39
+ x = 30
40
+ y = 40
41
+ width = 100
42
+ height = 100
43
+ file_name = "aspose.jpg"
44
+ file = File.open("data/" << file_name,"r") { |io| io.read }
45
+
46
+ response = @imaging_api.post_crop_image(format, x, y, width, height, file)
47
+ assert(response, message="Failed to crop image from body")
48
+ end
49
+
50
+ def test_post_image_gif
51
+ file_name = "sample.gif"
52
+ file = File.open("data/" << file_name,"r") { |io| io.read }
53
+ opts = {background_color_index: "255", color_resolution: "7"}
54
+
55
+ response = @imaging_api.post_image_gif(file, opts)
56
+ assert(response, message="Failed to update parameters of gif image.")
57
+ end
58
+
59
+ def test_post_image_jpg
60
+ file_name = "aspose.jpg"
61
+ file = File.open("data/" << file_name,"r") { |io| io.read }
62
+ opts = {quality: 100, compression_type: "progressive"}
63
+
64
+ response = @imaging_api.post_image_jpg(file, opts)
65
+ assert(response, message="Failed to update parameters of jpg image.")
66
+ end
67
+
68
+ def test_post_image_png
69
+ file_name = "aspose_imaging_for_cloud.png"
70
+ file = File.open("data/" << file_name,"r") { |io| io.read }
71
+ opts = {from_scratch: true}
72
+
73
+ response = @imaging_api.post_image_png(file, opts)
74
+ assert(response, message="Failed to update parameters of png image.")
75
+ end
76
+
77
+ def test_post_image_psd
78
+ file_name = "sample.psd"
79
+ file = File.open("data/" << file_name,"r") { |io| io.read }
80
+ opts = {channels_count: 3, compression_method: "rle"}
81
+
82
+ response = @imaging_api.post_image_psd(file, opts)
83
+ assert(response, message="Failed to update parameters of psd image.")
84
+ end
85
+
86
+ def test_post_change_image_scale
87
+ format = "jpg"
88
+ new_width = 200
89
+ new_height = 200
90
+ file_name = "aspose_imaging_for_cloud.png"
91
+ file = File.open("data/" << file_name,"r") { |io| io.read }
92
+
93
+ response = @imaging_api.post_change_image_scale(format, new_width, new_height, file)
94
+ assert(response, message="Failed to change scale of an image from body.")
95
+ end
96
+
97
+ def test_post_image_rotate_flip
98
+ format = "png"
99
+ method = "Rotate180FlipX"
100
+ file_name = "aspose.jpg"
101
+ file = File.open("data/" << file_name,"r") { |io| io.read }
102
+
103
+ response = @imaging_api.post_image_rotate_flip(format, method, file)
104
+ assert(response, message="Failed to rotate and flip existing image.")
105
+ end
106
+
107
+ def test_post_image_save_as
108
+ format = "png"
109
+ file_name = "aspose.jpg"
110
+ file = File.open("data/" << file_name,"r") { |io| io.read }
111
+
112
+ response = @imaging_api.post_image_save_as(format, file)
113
+ assert(response, message="Failed to export existing image to another format.")
114
+ end
115
+
116
+ def test_post_process_tiff
117
+ file_name = "demo.tif"
118
+ file = File.open("data/" << file_name,"r") { |io| io.read }
119
+ opts = {compression: "ccittfax3", resolution_unit: "inch", bit_depth: 1}
120
+
121
+ response = @imaging_api.post_process_tiff(file, opts)
122
+ assert(response, message="Failed to update tiff image.")
123
+ end
124
+
125
+ def test_post_tiff_append
126
+ file_name = "sample.tif"
127
+ upload_file(file_name)
128
+ append_file = "TestDemo.tif"
129
+ upload_file(append_file)
130
+ opts = {append_file: append_file}
131
+
132
+ response = @imaging_api.post_tiff_append(file_name, opts)
133
+ assert(response, message="Failed to append tiff image.")
134
+ end
135
+
136
+ def test_get_tiff_to_fax
137
+ file_name = "TestDemo.tif"
138
+ upload_file(file_name)
139
+
140
+ response = @imaging_api.get_tiff_to_fax(file_name)
141
+ assert(response, message="Failed to get tiff image for fax.")
142
+ end
143
+
144
+ def test_post_image_save_as_1
145
+ format = "png"
146
+ new_width = 300
147
+ new_height = 300
148
+ x = 96
149
+ y = 96
150
+ rect_width = 200
151
+ rect_height = 200
152
+ rotate_flip_method = ""
153
+ file_name = "TestDemo.tif"
154
+ file = File.open("data/" << file_name,"r") { |io| io.read }
155
+
156
+ response = @imaging_api.post_image_save_as_1(format, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method, file)
157
+ assert(response, message="Failed to perform scaling, cropping and flipping of an image in single request.")
158
+ end
159
+
160
+ def test_get_image_bmp
161
+ file_name = "sample.bmp"
162
+ upload_file(file_name)
163
+ bits_per_pixel = 24
164
+ horizontal_resolution = 300
165
+ vertical_resolution = 300
166
+
167
+ response = @imaging_api.get_image_bmp(file_name, bits_per_pixel, horizontal_resolution, vertical_resolution)
168
+ assert(response, message="Failed to update parameters of bmp image.")
169
+ end
170
+
171
+ def test_get_crop_image
172
+ file_name = "aspose.jpg"
173
+ upload_file(file_name)
174
+ format = "png"
175
+ x = 30
176
+ y = 40
177
+ width = 100
178
+ height = 100
179
+
180
+ response = @imaging_api.get_crop_image(file_name, format, x, y, width, height)
181
+ assert(response, message="Failed to crop existing image.")
182
+ end
183
+
184
+ def test_get_image_frame
185
+ file_name = "sample-multi.tif"
186
+ upload_file(file_name)
187
+ frame_id = 1
188
+
189
+ response = @imaging_api.get_image_frame(file_name, frame_id)
190
+ assert(response, message="Failed to get separate frame of tiff image.")
191
+ end
192
+
193
+ def test_get_image_frame_properties
194
+ file_name = "TestDemo.tif"
195
+ upload_file(file_name)
196
+ frame_id = 0
197
+
198
+ response = @imaging_api.get_image_frame_properties(file_name, frame_id)
199
+ assert(response, message="Failed to get properties of a tiff frame.")
200
+ end
201
+
202
+ def test_get_image_gif
203
+ file_name = "sample.gif"
204
+ upload_file(file_name)
205
+
206
+ response = @imaging_api.get_image_gif(file_name)
207
+ assert(response, message="Failed to update parameters of GIF image.")
208
+ end
209
+
210
+ def test_get_image_jpg
211
+ file_name = "aspose.jpg"
212
+ upload_file(file_name)
213
+ opts = {quality: 100, compression_type: "progressive"}
214
+
215
+ response = @imaging_api.get_image_jpg(file_name, opts)
216
+ assert(response, message="Failed to update parameters of jpg image.")
217
+ end
218
+
219
+ def test_get_image_png
220
+ file_name = "aspose_imaging_for_cloud.png"
221
+ upload_file(file_name)
222
+ opts = {from_scratch: true}
223
+
224
+ response = @imaging_api.get_image_png(file_name, opts)
225
+ assert(response, message="Failed to update parameters of png image.")
226
+ end
227
+
228
+ def test_get_image_properties
229
+ file_name = "demo.tif"
230
+ upload_file(file_name)
231
+
232
+ response = @imaging_api.get_image_properties(file_name)
233
+ assert(response, message="Failed to get properties of an image.")
234
+ end
235
+
236
+ def test_get_image_psd
237
+ file_name = "sample.psd"
238
+ upload_file(file_name)
239
+ opts = {channels_count: 3, compression_method: "rle"}
240
+
241
+ response = @imaging_api.get_image_psd(file_name, opts)
242
+ assert(response, message="Failed to update parameters of psd image.")
243
+ end
244
+
245
+ def test_get_change_image_scale
246
+ file_name = "aspose_imaging_for_cloud.png"
247
+ upload_file(file_name)
248
+ format = "jpg"
249
+ new_width = 200
250
+ new_height = 200
251
+
252
+ response = @imaging_api.get_change_image_scale(file_name, format, new_width, new_height)
253
+ assert(response, message="Failed to change scale of an existing image.")
254
+ end
255
+
256
+ def test_get_image_rotate_flip
257
+ file_name = "aspose.jpg"
258
+ upload_file(file_name)
259
+ format = "png"
260
+ method = "Rotate180FlipX"
261
+
262
+ response = @imaging_api.get_image_rotate_flip(file_name, format, method)
263
+ assert(response, message="Failed to rotate and flip existing image")
264
+ end
265
+
266
+ def test_get_image_save_as
267
+ file_name = "aspose.jpg"
268
+ upload_file(file_name)
269
+ format = "png"
270
+
271
+ response = @imaging_api.get_image_save_as(file_name, format)
272
+ assert(response, message="Failed to export existing image to another format.")
273
+ end
274
+
275
+ def test_get_updated_image
276
+ file_name = "TestDemo.tif"
277
+ upload_file(file_name)
278
+ format = "png"
279
+ new_width = 300
280
+ new_height = 300
281
+ x = 96
282
+ y = 96
283
+ rect_width = 200
284
+ rect_height = 200
285
+ rotate_flip_method = ""
286
+
287
+ response = @imaging_api.get_updated_image(file_name, format, new_width, new_height, x, y, rect_width, rect_height, rotate_flip_method)
288
+ assert(response, message="Failed to perform scaling, cropping and flipping of an image in single request.")
289
+ end
290
+
291
+ end
metadata ADDED
@@ -0,0 +1,160 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: aspose_imaging_cloud
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.0.0
5
+ platform: ruby
6
+ authors:
7
+ - M. Sohail Ismail
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2016-01-31 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: typhoeus
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - "~>"
18
+ - !ruby/object:Gem::Version
19
+ version: '0.8'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - "~>"
25
+ - !ruby/object:Gem::Version
26
+ version: '0.8'
27
+ - !ruby/object:Gem::Dependency
28
+ name: json
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.7'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.7'
41
+ - !ruby/object:Gem::Dependency
42
+ name: aspose_storage_cloud
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '1.0'
48
+ - - ">="
49
+ - !ruby/object:Gem::Version
50
+ version: 1.0.0
51
+ type: :runtime
52
+ prerelease: false
53
+ version_requirements: !ruby/object:Gem::Requirement
54
+ requirements:
55
+ - - "~>"
56
+ - !ruby/object:Gem::Version
57
+ version: '1.0'
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: 1.0.0
61
+ - !ruby/object:Gem::Dependency
62
+ name: minitest
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: '5.8'
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: '5.8'
75
+ description: Aspose.Imaging for Cloud lets you use a REST API to inspect, convert,
76
+ and transform images in the cloud. It supports the most popular image formats such
77
+ as PSD, PNG, GIF, BMP, TIFF, and JPEG, and conversion between them. Aspose.Imaging
78
+ for Cloud also provides a rich set of features for manipulating images on-the-fly
79
+ with cloud based image transformations. You can resize, crop and/or rotate images
80
+ various ways by simply creating a request that includes the correct transformation
81
+ instructions. The most demanding imaging routines, for example TIFF concatenation
82
+ and image conversion to fax compatible format, are available through efficient and
83
+ reliable specialized resources. You can perform these operations without needing
84
+ to know what's going on under the hood so that you can focus on the core business
85
+ goals.
86
+ email:
87
+ - muhammad.sohail@aspose.com
88
+ executables: []
89
+ extensions: []
90
+ extra_rdoc_files: []
91
+ files:
92
+ - LICENSE
93
+ - README.md
94
+ - aspose_imaging_cloud.gemspec
95
+ - lib/aspose_imaging_cloud.rb
96
+ - lib/aspose_imaging_cloud/api/imaging_api.rb
97
+ - lib/aspose_imaging_cloud/api_client.rb
98
+ - lib/aspose_imaging_cloud/api_error.rb
99
+ - lib/aspose_imaging_cloud/configuration.rb
100
+ - lib/aspose_imaging_cloud/models/base_object.rb
101
+ - lib/aspose_imaging_cloud/models/base_response.rb
102
+ - lib/aspose_imaging_cloud/models/bmp_properties.rb
103
+ - lib/aspose_imaging_cloud/models/exif_data.rb
104
+ - lib/aspose_imaging_cloud/models/gif_properties.rb
105
+ - lib/aspose_imaging_cloud/models/imaging_response.rb
106
+ - lib/aspose_imaging_cloud/models/jfif_data.rb
107
+ - lib/aspose_imaging_cloud/models/jpeg_exif_data.rb
108
+ - lib/aspose_imaging_cloud/models/jpeg_properties.rb
109
+ - lib/aspose_imaging_cloud/models/psd_properties.rb
110
+ - lib/aspose_imaging_cloud/models/tiff_frame.rb
111
+ - lib/aspose_imaging_cloud/models/tiff_options.rb
112
+ - lib/aspose_imaging_cloud/models/tiff_properties.rb
113
+ - lib/aspose_imaging_cloud/version.rb
114
+ - test/data/TestDemo.tif
115
+ - test/data/aspose.jpg
116
+ - test/data/aspose_imaging_for_cloud.png
117
+ - test/data/demo.tif
118
+ - test/data/sample-multi.tif
119
+ - test/data/sample.bmp
120
+ - test/data/sample.gif
121
+ - test/data/sample.psd
122
+ - test/data/sample.tif
123
+ - test/data/test.bmp
124
+ - test/imaging_tests.rb
125
+ homepage: http://www.aspose.com/cloud/imaging-api.aspx
126
+ licenses:
127
+ - MIT
128
+ metadata: {}
129
+ post_install_message:
130
+ rdoc_options: []
131
+ require_paths:
132
+ - lib
133
+ required_ruby_version: !ruby/object:Gem::Requirement
134
+ requirements:
135
+ - - ">="
136
+ - !ruby/object:Gem::Version
137
+ version: '0'
138
+ required_rubygems_version: !ruby/object:Gem::Requirement
139
+ requirements:
140
+ - - ">="
141
+ - !ruby/object:Gem::Version
142
+ version: '0'
143
+ requirements: []
144
+ rubyforge_project:
145
+ rubygems_version: 2.5.1
146
+ signing_key:
147
+ specification_version: 4
148
+ summary: Aspose.Imaging for Cloud
149
+ test_files:
150
+ - test/data/TestDemo.tif
151
+ - test/data/aspose.jpg
152
+ - test/data/aspose_imaging_for_cloud.png
153
+ - test/data/demo.tif
154
+ - test/data/sample-multi.tif
155
+ - test/data/sample.bmp
156
+ - test/data/sample.gif
157
+ - test/data/sample.psd
158
+ - test/data/sample.tif
159
+ - test/data/test.bmp
160
+ - test/imaging_tests.rb