aspose_pdf_cloud 18.2.0 → 18.3.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.
@@ -99,13 +99,13 @@ module AsposePdfCloud
99
99
  def self.swagger_types
100
100
  {
101
101
  :'brightness' => :'Float',
102
- :'compression' => :'String',
103
- :'color_depth' => :'String',
102
+ :'compression' => :'CompressionType',
103
+ :'color_depth' => :'ColorDepth',
104
104
  :'left_margin' => :'Integer',
105
105
  :'right_margin' => :'Integer',
106
106
  :'top_margin' => :'Integer',
107
107
  :'bottom_margin' => :'Integer',
108
- :'orientation' => :'String',
108
+ :'orientation' => :'ShapeType',
109
109
  :'skip_blank_pages' => :'BOOLEAN',
110
110
  :'width' => :'Integer',
111
111
  :'height' => :'Integer',
@@ -20,5 +20,5 @@ SOFTWARE.
20
20
  =end
21
21
 
22
22
  module AsposePdfCloud
23
- VERSION = "18.2.0"
23
+ VERSION = "18.3.0"
24
24
  end
@@ -33,13 +33,13 @@ class PdfTests < Minitest::Test
33
33
 
34
34
  def setup
35
35
  # Get App key and App SID from https://cloud.aspose.com
36
- AsposeApp.app_key_and_sid('', '')
36
+ AsposeApp.app_key_and_sid('app_key', 'app_sid')
37
37
 
38
38
  @pdf_api = PdfApi.new
39
39
  @storage_api = StorageApi.new
40
40
  @storage_api.api_client.host = 'http://api-dev.aspose.cloud/v1.1'
41
41
 
42
- @temp_folder = 'TempPdf'
42
+ @temp_folder = 'TempPdfCloud'
43
43
  @test_data_folder = '../test_data/'
44
44
 
45
45
  config = @pdf_api.api_client.config
@@ -184,13 +184,13 @@ class PdfTests < Minitest::Test
184
184
  opts = {
185
185
  :result_file => '4pages.tiff',
186
186
  :brightness => 0.6,
187
- :compression => 'Ccitt4',
188
- :color_depth => 'format1bpp',
187
+ :compression => CompressionType::CCITT4,
188
+ :color_depth => ColorDepth::FORMAT1BPP,
189
189
  :left_margin => 0,
190
190
  :right_margin => 0,
191
191
  :top_margin => 0,
192
192
  :bottom_margin => 0,
193
- :orientation => 'portait', # Yes, we know 'portrait'. It will be fixed in the next version.
193
+ :orientation => ShapeType::PORTRAIT,
194
194
  :skip_blank_pages => true,
195
195
  :width => 1200,
196
196
  :height => 1600,
@@ -213,13 +213,13 @@ class PdfTests < Minitest::Test
213
213
  export_options = TiffExportOptions.new
214
214
  export_options.result_file = '4pages.tiff'
215
215
  export_options.brightness = 0.6
216
- export_options.compression = 'Ccitt4'
217
- export_options.color_depth = 'format1bpp'
216
+ export_options.compression = CompressionType::CCITT4
217
+ export_options.color_depth = ColorDepth::FORMAT1BPP
218
218
  export_options.left_margin = 0
219
219
  export_options.right_margin = 0
220
220
  export_options.top_margin = 0
221
221
  export_options.bottom_margin = 0
222
- export_options.orientation = 'portait' # Yes, we know 'portrait'. It will be fixed in the next version.
222
+ export_options.orientation = ShapeType::PORTRAIT
223
223
  export_options.skip_blank_pages = true
224
224
  export_options.width = 1200
225
225
  export_options.height = 1600
@@ -544,6 +544,22 @@ class PdfTests < Minitest::Test
544
544
  assert(response, 'Failed to read document image by number.')
545
545
  end
546
546
 
547
+ def test_get_image_with_format
548
+ file_name = 'PdfWithImages2.pdf'
549
+ upload_file(file_name)
550
+
551
+ page_number = 1
552
+ image_number = 1
553
+ opts = {
554
+ :format => 'jpeg',
555
+ :height => 100,
556
+ :width => 100,
557
+ :folder => @temp_folder
558
+ }
559
+
560
+ response = @pdf_api.get_image(file_name, page_number, image_number, opts)
561
+ assert(response, 'Failed to read document image by number.')
562
+ end
547
563
 
548
564
  def test_get_images
549
565
  file_name = 'PdfWithImages2.pdf'
@@ -577,6 +593,20 @@ class PdfTests < Minitest::Test
577
593
  assert(response, 'Failed to replace document image.')
578
594
  end
579
595
 
596
+ def test_post_replace_image_from_request
597
+ file_name = 'PdfWithImages2.pdf'
598
+ upload_file(file_name)
599
+
600
+ image_file_name = 'Koala.jpg'
601
+ page_number = 1
602
+ image_number = 1
603
+ opts = {
604
+ :image => File.open(@test_data_folder + image_file_name, 'r') { |io| io.read(io.size) },
605
+ :folder => @temp_folder
606
+ }
607
+ response = @pdf_api.post_replace_image(file_name, page_number, image_number, opts)
608
+ assert(response, 'Failed to replace document image.')
609
+ end
580
610
 
581
611
  # Links Tests
582
612
 
@@ -616,6 +646,8 @@ class PdfTests < Minitest::Test
616
646
 
617
647
  result_name = 'MergingResult.pdf'
618
648
 
649
+ file_name_list.collect! {|file_name| @temp_folder + '/' + file_name}
650
+
619
651
  merge_documents = MergeDocuments.new
620
652
  merge_documents.list = file_name_list
621
653
 
@@ -658,6 +690,21 @@ class PdfTests < Minitest::Test
658
690
  assert(response, 'Failed to get document page by its number.')
659
691
  end
660
692
 
693
+ def test_get_page_with_format
694
+ file_name = '4pages.pdf'
695
+ upload_file(file_name)
696
+
697
+ page_number = 3
698
+ opts = {
699
+ :format => 'jpeg',
700
+ :width => 100,
701
+ :height => 100,
702
+ :folder => @temp_folder
703
+ }
704
+
705
+ response = @pdf_api.get_page(file_name, page_number, opts)
706
+ assert(response, 'Failed to get document page by its number.')
707
+ end
661
708
 
662
709
  def test_get_pages
663
710
  file_name = '4pages.pdf'
@@ -1264,5 +1311,223 @@ class PdfTests < Minitest::Test
1264
1311
  assert(response, 'Filed to replace page text by rect.')
1265
1312
  end
1266
1313
 
1314
+ # Convert Tests
1315
+
1316
+ def test_get_pdf_in_storage_to_doc
1317
+ file_name = '4pages.pdf'
1318
+ upload_file(file_name)
1319
+
1320
+ opts = {
1321
+ :folder => @temp_folder
1322
+ }
1323
+
1324
+ response = @pdf_api.get_pdf_in_storage_to_doc(file_name, opts)
1325
+ assert(response, 'Filed to convert PDF to DOC.')
1326
+ end
1327
+
1328
+ def test_put_pdf_in_storage_to_doc
1329
+ file_name = '4pages.pdf'
1330
+ upload_file(file_name)
1331
+ res_file = 'result.doc'
1332
+
1333
+ opts = {
1334
+ :folder => @temp_folder
1335
+ }
1336
+ response = @pdf_api.put_pdf_in_storage_to_doc(file_name, res_file, opts)
1337
+ assert(response, 'Filed to convert PDF to DOC.')
1338
+ end
1339
+
1340
+ def test_put_pdf_in_request_to_doc
1341
+ file_name = '4pages.pdf'
1342
+
1343
+ res_file = 'result.doc'
1344
+
1345
+ opts = {
1346
+ :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1347
+ # :file => @test_data_folder + file_name
1348
+ }
1349
+ response = @pdf_api.put_pdf_in_request_to_tiff(@temp_folder + '/' + res_file, opts)
1350
+ assert(response, 'Filed to convert PDF to DOC.')
1351
+ end
1352
+
1353
+ def test_get_pdf_in_storage_to_pdf_a
1354
+ file_name = '4pages.pdf'
1355
+ upload_file(file_name)
1356
+
1357
+ opts = {
1358
+ :folder => @temp_folder
1359
+ }
1360
+
1361
+ response = @pdf_api.get_pdf_in_storage_to_pdf_a(file_name, PdfAType::PDFA1_A, opts)
1362
+ assert(response, 'Filed to convert PDF to PDFA.')
1363
+ end
1364
+
1365
+ def test_put_pdf_in_storage_to_pdf_a
1366
+ file_name = '4pages.pdf'
1367
+ upload_file(file_name)
1368
+ res_file = 'result.pdf'
1369
+
1370
+ opts = {
1371
+ :folder => @temp_folder
1372
+ }
1373
+ response = @pdf_api.put_pdf_in_storage_to_pdf_a(file_name, res_file, PdfAType::PDFA1_A, opts)
1374
+ assert(response, 'Filed to convert PDF to PDFA.')
1375
+ end
1376
+
1377
+ def test_put_pdf_in_request_to_pdf_a
1378
+ file_name = '4pages.pdf'
1379
+
1380
+ res_file = 'result.pdf'
1381
+
1382
+ opts = {
1383
+ :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1384
+ }
1385
+ response = @pdf_api.put_pdf_in_request_to_pdf_a(@temp_folder + '/' + res_file, PdfAType::PDFA1_A, opts)
1386
+ assert(response, 'Filed to convert PDF to PDFA.')
1387
+ end
1388
+
1389
+ def test_get_pdf_in_storage_to_tiff
1390
+ file_name = '4pages.pdf'
1391
+ upload_file(file_name)
1392
+
1393
+ opts = {
1394
+ :folder => @temp_folder
1395
+ }
1396
+
1397
+ response = @pdf_api.get_pdf_in_storage_to_tiff(file_name, opts)
1398
+ assert(response, 'Filed to convert PDF to Tiff.')
1399
+ end
1400
+
1401
+ def test_put_pdf_in_storage_to_tiff
1402
+ file_name = '4pages.pdf'
1403
+ upload_file(file_name)
1404
+ res_file = 'result.tiff'
1405
+
1406
+ opts = {
1407
+ :folder => @temp_folder
1408
+ }
1409
+ response = @pdf_api.put_pdf_in_storage_to_tiff(file_name, res_file, opts)
1410
+ assert(response, 'Filed to convert PDF to Tiff.')
1411
+ end
1412
+
1413
+ def test_put_pdf_in_request_to_tiff
1414
+ file_name = '4pages.pdf'
1415
+
1416
+ res_file = 'result.pdf'
1417
+
1418
+ opts = {
1419
+ :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1420
+ }
1421
+ response = @pdf_api.put_pdf_in_request_to_tiff(@temp_folder + '/' + res_file, opts)
1422
+ assert(response, 'Filed to convert PDF to Tiff.')
1423
+ end
1424
+
1425
+ def test_get_pdf_in_storage_to_svg
1426
+ file_name = '4pages.pdf'
1427
+ upload_file(file_name)
1428
+
1429
+ opts = {
1430
+ :folder => @temp_folder
1431
+ }
1432
+
1433
+ response = @pdf_api.get_pdf_in_storage_to_svg(file_name, opts)
1434
+ assert(response, 'Filed to convert PDF to SVG.')
1435
+ end
1436
+
1437
+ def test_put_pdf_in_storage_to_svg
1438
+ file_name = '4pages.pdf'
1439
+ upload_file(file_name)
1440
+ res_file = 'result.svg'
1441
+
1442
+ opts = {
1443
+ :folder => @temp_folder
1444
+ }
1445
+ response = @pdf_api.put_pdf_in_storage_to_svg(file_name, res_file, opts)
1446
+ assert(response, 'Filed to convert PDF to SVG.')
1447
+ end
1448
+
1449
+ def test_put_pdf_in_request_to_svg
1450
+ file_name = '4pages.pdf'
1451
+
1452
+ res_file = 'result.svg'
1453
+
1454
+ opts = {
1455
+ :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1456
+ }
1457
+ response = @pdf_api.put_pdf_in_request_to_svg(@temp_folder + '/' + res_file, opts)
1458
+ assert(response, 'Filed to convert PDF to SVG.')
1459
+ end
1460
+
1461
+ def test_get_pdf_in_storage_to_xps
1462
+ file_name = '4pages.pdf'
1463
+ upload_file(file_name)
1464
+
1465
+ opts = {
1466
+ :folder => @temp_folder
1467
+ }
1468
+
1469
+ response = @pdf_api.get_pdf_in_storage_to_xps(file_name, opts)
1470
+ assert(response, 'Filed to convert PDF to XPS.')
1471
+ end
1472
+
1473
+ def test_put_pdf_in_storage_to_xps
1474
+ file_name = '4pages.pdf'
1475
+ upload_file(file_name)
1476
+ res_file = 'result.xps'
1477
+
1478
+ opts = {
1479
+ :folder => @temp_folder
1480
+ }
1481
+ response = @pdf_api.put_pdf_in_storage_to_xps(file_name, res_file, opts)
1482
+ assert(response, 'Filed to convert PDF to XPS.')
1483
+ end
1484
+
1485
+ def test_put_pdf_in_request_to_xps
1486
+ file_name = '4pages.pdf'
1487
+
1488
+ res_file = 'result.xps'
1489
+
1490
+ opts = {
1491
+ :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1492
+ }
1493
+ response = @pdf_api.put_pdf_in_request_to_xps(@temp_folder + '/' + res_file, opts)
1494
+ assert(response, 'Filed to convert PDF to XPS.')
1495
+ end
1496
+
1497
+ def test_get_pdf_in_storage_to_xls
1498
+ file_name = '4pages.pdf'
1499
+ upload_file(file_name)
1500
+
1501
+ opts = {
1502
+ :folder => @temp_folder
1503
+ }
1504
+
1505
+ response = @pdf_api.get_pdf_in_storage_to_xls(file_name, opts)
1506
+ assert(response, 'Filed to convert PDF to XLS.')
1507
+ end
1508
+
1509
+ def test_put_pdf_in_storage_to_xls
1510
+ file_name = '4pages.pdf'
1511
+ upload_file(file_name)
1512
+ res_file = 'result.xls'
1513
+
1514
+ opts = {
1515
+ :folder => @temp_folder
1516
+ }
1517
+ response = @pdf_api.put_pdf_in_storage_to_xls(file_name, res_file, opts)
1518
+ assert(response, 'Filed to convert PDF to XLS.')
1519
+ end
1520
+
1521
+ def test_put_pdf_in_request_to_xls
1522
+ file_name = '4pages.pdf'
1523
+
1524
+ res_file = 'result.xls'
1525
+
1526
+ opts = {
1527
+ :file => File.open(@test_data_folder + file_name, 'r') { |io| io.read(io.size) }
1528
+ }
1529
+ response = @pdf_api.put_pdf_in_request_to_xls(@temp_folder + '/' + res_file, opts)
1530
+ assert(response, 'Filed to convert PDF to XLS.')
1531
+ end
1267
1532
  end
1268
1533
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aspose_pdf_cloud
3
3
  version: !ruby/object:Gem::Version
4
- version: 18.2.0
4
+ version: 18.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Aspose PDF for Cloud
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-03-12 00:00:00.000000000 Z
11
+ date: 2018-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: typhoeus
@@ -58,6 +58,20 @@ dependencies:
58
58
  - - ">="
59
59
  - !ruby/object:Gem::Version
60
60
  version: 1.0.0
61
+ - !ruby/object:Gem::Dependency
62
+ name: faraday
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: 0.14.0
68
+ type: :runtime
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 0.14.0
61
75
  - !ruby/object:Gem::Dependency
62
76
  name: minitest
63
77
  requirement: !ruby/object:Gem::Requirement
@@ -89,7 +103,6 @@ extra_rdoc_files: []
89
103
  files:
90
104
  - ".gitignore"
91
105
  - ".swagger-codegen-ignore"
92
- - ".swagger-codegen/VERSION"
93
106
  - LICENSE
94
107
  - README.md
95
108
  - aspose_pdf_cloud.gemspec
@@ -107,9 +120,10 @@ files:
107
120
  - lib/aspose_pdf_cloud/models/attachment_response.rb
108
121
  - lib/aspose_pdf_cloud/models/attachments.rb
109
122
  - lib/aspose_pdf_cloud/models/attachments_response.rb
110
- - lib/aspose_pdf_cloud/models/bookmarks.rb
111
- - lib/aspose_pdf_cloud/models/bookmarks_response.rb
112
123
  - lib/aspose_pdf_cloud/models/color.rb
124
+ - lib/aspose_pdf_cloud/models/color_depth.rb
125
+ - lib/aspose_pdf_cloud/models/compression_type.rb
126
+ - lib/aspose_pdf_cloud/models/doc_format.rb
113
127
  - lib/aspose_pdf_cloud/models/document.rb
114
128
  - lib/aspose_pdf_cloud/models/document_pages_response.rb
115
129
  - lib/aspose_pdf_cloud/models/document_properties.rb
@@ -147,10 +161,13 @@ files:
147
161
  - lib/aspose_pdf_cloud/models/page_word_count.rb
148
162
  - lib/aspose_pdf_cloud/models/pages.rb
149
163
  - lib/aspose_pdf_cloud/models/paragraph.rb
164
+ - lib/aspose_pdf_cloud/models/pdf_a_type.rb
165
+ - lib/aspose_pdf_cloud/models/recognition_mode.rb
150
166
  - lib/aspose_pdf_cloud/models/rectangle.rb
151
167
  - lib/aspose_pdf_cloud/models/rotation.rb
152
168
  - lib/aspose_pdf_cloud/models/saa_spose_response.rb
153
169
  - lib/aspose_pdf_cloud/models/segment.rb
170
+ - lib/aspose_pdf_cloud/models/shape_type.rb
154
171
  - lib/aspose_pdf_cloud/models/signature.rb
155
172
  - lib/aspose_pdf_cloud/models/signature_type.rb
156
173
  - lib/aspose_pdf_cloud/models/split_result.rb
@@ -1 +0,0 @@
1
- 2.2.3
@@ -1,211 +0,0 @@
1
- =begin
2
- --------------------------------------------------------------------------------------------------------------------
3
- Copyright (c) 2018 Aspose.Pdf for Cloud
4
- Permission is hereby granted, free of charge, to any person obtaining a copy
5
- of this software and associated documentation files (the "Software"), to deal
6
- in the Software without restriction, including without limitation the rights
7
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8
- copies of the Software, and to permit persons to whom the Software is
9
- furnished to do so, subject to the following conditions:
10
- The above copyright notice and this permission notice shall be included in all
11
- copies or substantial portions of the Software.
12
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
13
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
14
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
15
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
16
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
17
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
18
- SOFTWARE.
19
- --------------------------------------------------------------------------------------------------------------------
20
- =end
21
-
22
- require 'date'
23
-
24
- module AsposePdfCloud
25
- # List of bookmark.
26
- class Bookmarks
27
- # Link to the document.
28
- attr_accessor :links
29
-
30
- attr_accessor :list
31
-
32
-
33
- # Attribute mapping from ruby-style variable name to JSON key.
34
- def self.attribute_map
35
- {
36
- :'links' => :'Links',
37
- :'list' => :'List'
38
- }
39
- end
40
-
41
- # Attribute type mapping.
42
- def self.swagger_types
43
- {
44
- :'links' => :'Array<Link>',
45
- :'list' => :'Array<LinkElement>'
46
- }
47
- end
48
-
49
- # Initializes the object
50
- # @param [Hash] attributes Model attributes in the form of hash
51
- def initialize(attributes = {})
52
- return unless attributes.is_a?(Hash)
53
-
54
- # convert string to symbol for hash key
55
- attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
56
-
57
- if attributes.has_key?(:'Links')
58
- if (value = attributes[:'Links']).is_a?(Array)
59
- self.links = value
60
- end
61
- end
62
-
63
- if attributes.has_key?(:'List')
64
- if (value = attributes[:'List']).is_a?(Array)
65
- self.list = value
66
- end
67
- end
68
-
69
- end
70
-
71
- # Show invalid properties with the reasons. Usually used together with valid?
72
- # @return Array for valid properies with the reasons
73
- def list_invalid_properties
74
- invalid_properties = Array.new
75
- return invalid_properties
76
- end
77
-
78
- # Check to see if the all the properties in the model are valid
79
- # @return true if the model is valid
80
- def valid?
81
- return true
82
- end
83
-
84
- # Checks equality by comparing each attribute.
85
- # @param [Object] Object to be compared
86
- def ==(o)
87
- return true if self.equal?(o)
88
- self.class == o.class &&
89
- links == o.links &&
90
- list == o.list
91
- end
92
-
93
- # @see the `==` method
94
- # @param [Object] Object to be compared
95
- def eql?(o)
96
- self == o
97
- end
98
-
99
- # Calculates hash code according to all attributes.
100
- # @return [Fixnum] Hash code
101
- def hash
102
- [links, list].hash
103
- end
104
-
105
- # Builds the object from hash
106
- # @param [Hash] attributes Model attributes in the form of hash
107
- # @return [Object] Returns the model itself
108
- def build_from_hash(attributes)
109
- return nil unless attributes.is_a?(Hash)
110
- self.class.swagger_types.each_pair do |key, type|
111
- if type =~ /\AArray<(.*)>/i
112
- # check to ensure the input is an array given that the the attribute
113
- # is documented as an array but the input is not
114
- if attributes[self.class.attribute_map[key]].is_a?(Array)
115
- self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
116
- end
117
- elsif !attributes[self.class.attribute_map[key]].nil?
118
- self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
119
- end # or else data not found in attributes(hash), not an issue as the data can be optional
120
- end
121
-
122
- self
123
- end
124
-
125
- # Deserializes the data based on type
126
- # @param string type Data type
127
- # @param string value Value to be deserialized
128
- # @return [Object] Deserialized data
129
- def _deserialize(type, value)
130
- case type.to_sym
131
- when :DateTime
132
- DateTime.parse(value)
133
- when :Date
134
- Date.parse(value)
135
- when :String
136
- value.to_s
137
- when :Integer
138
- value.to_i
139
- when :Float
140
- value.to_f
141
- when :BOOLEAN
142
- if value.to_s =~ /\A(true|t|yes|y|1)\z/i
143
- true
144
- else
145
- false
146
- end
147
- when :Object
148
- # generic object (usually a Hash), return directly
149
- value
150
- when /\AArray<(?<inner_type>.+)>\z/
151
- inner_type = Regexp.last_match[:inner_type]
152
- value.map { |v| _deserialize(inner_type, v) }
153
- when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
154
- k_type = Regexp.last_match[:k_type]
155
- v_type = Regexp.last_match[:v_type]
156
- {}.tap do |hash|
157
- value.each do |k, v|
158
- hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
159
- end
160
- end
161
- else # model
162
- temp_model = AsposePdfCloud.const_get(type).new
163
- temp_model.build_from_hash(value)
164
- end
165
- end
166
-
167
- # Returns the string representation of the object
168
- # @return [String] String presentation of the object
169
- def to_s
170
- to_hash.to_s
171
- end
172
-
173
- # to_body is an alias to to_hash (backward compatibility)
174
- # @return [Hash] Returns the object in the form of hash
175
- def to_body
176
- to_hash
177
- end
178
-
179
- # Returns the object in the form of hash
180
- # @return [Hash] Returns the object in the form of hash
181
- def to_hash
182
- hash = {}
183
- self.class.attribute_map.each_pair do |attr, param|
184
- value = self.send(attr)
185
- next if value.nil?
186
- hash[param] = _to_hash(value)
187
- end
188
- hash
189
- end
190
-
191
- # Outputs non-array value in the form of hash
192
- # For object, use to_hash. Otherwise, just return the value
193
- # @param [Object] value Any valid value
194
- # @return [Hash] Returns the value in the form of hash
195
- def _to_hash(value)
196
- if value.is_a?(Array)
197
- value.compact.map{ |v| _to_hash(v) }
198
- elsif value.is_a?(Hash)
199
- {}.tap do |hash|
200
- value.each { |k, v| hash[k] = _to_hash(v) }
201
- end
202
- elsif value.respond_to? :to_hash
203
- value.to_hash
204
- else
205
- value
206
- end
207
- end
208
-
209
- end
210
-
211
- end