aspose_pdf_cloud 1.0.2 → 18.2.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (118) hide show
  1. checksums.yaml +5 -5
  2. data/.gitignore +42 -0
  3. data/.swagger-codegen-ignore +58 -0
  4. data/.swagger-codegen/VERSION +1 -0
  5. data/LICENSE +21 -22
  6. data/README.md +51 -43
  7. data/aspose_pdf_cloud.gemspec +32 -8
  8. data/lib/aspose_pdf_cloud.rb +93 -58
  9. data/lib/aspose_pdf_cloud/api/pdf_api.rb +2624 -1916
  10. data/lib/aspose_pdf_cloud/api_client.rb +280 -92
  11. data/lib/aspose_pdf_cloud/api_error.rb +29 -6
  12. data/lib/aspose_pdf_cloud/configuration.rb +86 -63
  13. data/lib/aspose_pdf_cloud/models/annotation.rb +218 -45
  14. data/lib/aspose_pdf_cloud/models/annotation_response.rb +195 -34
  15. data/lib/aspose_pdf_cloud/models/annotations.rb +187 -25
  16. data/lib/aspose_pdf_cloud/models/annotations_response.rb +195 -34
  17. data/lib/aspose_pdf_cloud/models/append_document.rb +198 -23
  18. data/lib/aspose_pdf_cloud/models/attachment.rb +224 -49
  19. data/lib/aspose_pdf_cloud/models/attachment_response.rb +195 -34
  20. data/lib/aspose_pdf_cloud/models/attachments.rb +187 -25
  21. data/lib/aspose_pdf_cloud/models/attachments_response.rb +195 -34
  22. data/lib/aspose_pdf_cloud/models/bookmarks.rb +187 -25
  23. data/lib/aspose_pdf_cloud/models/bookmarks_response.rb +195 -34
  24. data/lib/aspose_pdf_cloud/models/color.rb +214 -31
  25. data/lib/aspose_pdf_cloud/models/document.rb +194 -29
  26. data/lib/aspose_pdf_cloud/models/document_pages_response.rb +195 -34
  27. data/lib/aspose_pdf_cloud/models/document_properties.rb +187 -25
  28. data/lib/aspose_pdf_cloud/models/document_properties_response.rb +195 -34
  29. data/lib/aspose_pdf_cloud/models/document_property.rb +197 -33
  30. data/lib/aspose_pdf_cloud/models/document_property_response.rb +195 -34
  31. data/lib/aspose_pdf_cloud/models/document_response.rb +206 -34
  32. data/lib/aspose_pdf_cloud/models/document_text_replace_response.rb +203 -41
  33. data/lib/aspose_pdf_cloud/models/field.rb +213 -42
  34. data/lib/aspose_pdf_cloud/models/field_response.rb +195 -34
  35. data/lib/aspose_pdf_cloud/models/field_type.rb +44 -0
  36. data/lib/aspose_pdf_cloud/models/fields.rb +187 -25
  37. data/lib/aspose_pdf_cloud/models/fields_response.rb +195 -34
  38. data/lib/aspose_pdf_cloud/models/font_styles.rb +43 -0
  39. data/lib/aspose_pdf_cloud/models/horizontal_alignment.rb +44 -0
  40. data/lib/aspose_pdf_cloud/models/http_status_code.rb +87 -0
  41. data/lib/aspose_pdf_cloud/models/image.rb +194 -29
  42. data/lib/aspose_pdf_cloud/models/image_response.rb +195 -34
  43. data/lib/aspose_pdf_cloud/models/images.rb +187 -25
  44. data/lib/aspose_pdf_cloud/models/images_list_request.rb +205 -0
  45. data/lib/aspose_pdf_cloud/models/images_response.rb +195 -34
  46. data/lib/aspose_pdf_cloud/models/line_spacing.rb +43 -0
  47. data/lib/aspose_pdf_cloud/models/link.rb +194 -27
  48. data/lib/aspose_pdf_cloud/models/link_action_type.rb +46 -0
  49. data/lib/aspose_pdf_cloud/models/link_annotation.rb +204 -39
  50. data/lib/aspose_pdf_cloud/models/link_annotation_response.rb +195 -34
  51. data/lib/aspose_pdf_cloud/models/link_annotations.rb +187 -25
  52. data/lib/aspose_pdf_cloud/models/link_annotations_response.rb +195 -34
  53. data/lib/aspose_pdf_cloud/models/link_element.rb +175 -14
  54. data/lib/aspose_pdf_cloud/models/link_highlighting_mode.rb +45 -0
  55. data/lib/aspose_pdf_cloud/models/merge_documents.rb +175 -14
  56. data/lib/aspose_pdf_cloud/models/optimize_options.rb +293 -0
  57. data/lib/aspose_pdf_cloud/models/page.rb +198 -33
  58. data/lib/aspose_pdf_cloud/models/page_text_replace_response.rb +203 -41
  59. data/lib/aspose_pdf_cloud/models/page_word_count.rb +192 -19
  60. data/lib/aspose_pdf_cloud/models/pages.rb +187 -25
  61. data/lib/aspose_pdf_cloud/models/paragraph.rb +303 -0
  62. data/lib/aspose_pdf_cloud/models/rectangle.rb +210 -27
  63. data/lib/aspose_pdf_cloud/models/rotation.rb +44 -0
  64. data/lib/aspose_pdf_cloud/models/saa_spose_response.rb +213 -0
  65. data/lib/aspose_pdf_cloud/models/segment.rb +206 -0
  66. data/lib/aspose_pdf_cloud/models/signature.rb +278 -54
  67. data/lib/aspose_pdf_cloud/models/signature_type.rb +42 -0
  68. data/lib/aspose_pdf_cloud/models/split_result.rb +175 -14
  69. data/lib/aspose_pdf_cloud/models/split_result_document.rb +206 -37
  70. data/lib/aspose_pdf_cloud/models/split_result_response.rb +196 -34
  71. data/lib/aspose_pdf_cloud/models/stamp.rb +312 -104
  72. data/lib/aspose_pdf_cloud/models/stamp_type.rb +44 -0
  73. data/lib/aspose_pdf_cloud/models/text_format.rb +197 -33
  74. data/lib/aspose_pdf_cloud/models/text_format_response.rb +195 -34
  75. data/lib/aspose_pdf_cloud/models/text_horizontal_alignment.rb +47 -0
  76. data/lib/aspose_pdf_cloud/models/text_item.rb +192 -29
  77. data/lib/aspose_pdf_cloud/models/text_item_response.rb +195 -34
  78. data/lib/aspose_pdf_cloud/models/text_items.rb +187 -25
  79. data/lib/aspose_pdf_cloud/models/text_items_response.rb +195 -34
  80. data/lib/aspose_pdf_cloud/models/text_line.rb +210 -0
  81. data/lib/aspose_pdf_cloud/models/text_rect.rb +220 -0
  82. data/lib/aspose_pdf_cloud/models/text_rects.rb +199 -0
  83. data/lib/aspose_pdf_cloud/models/text_rects_response.rb +222 -0
  84. data/lib/aspose_pdf_cloud/models/text_replace.rb +225 -25
  85. data/lib/aspose_pdf_cloud/models/text_replace_list_request.rb +209 -16
  86. data/lib/aspose_pdf_cloud/models/text_replace_request.rb +262 -0
  87. data/lib/aspose_pdf_cloud/models/text_replace_response.rb +222 -0
  88. data/lib/aspose_pdf_cloud/models/text_state.rb +211 -32
  89. data/lib/aspose_pdf_cloud/models/tiff_export_options.rb +266 -75
  90. data/lib/aspose_pdf_cloud/models/vertical_alignment.rb +45 -0
  91. data/lib/aspose_pdf_cloud/models/word_count.rb +174 -14
  92. data/lib/aspose_pdf_cloud/models/word_count_response.rb +196 -34
  93. data/lib/aspose_pdf_cloud/models/wrap_mode.rb +44 -0
  94. data/lib/aspose_pdf_cloud/version.rb +23 -2
  95. data/test/pdf_tests.rb +1268 -623
  96. data/test_data/33539.jpg +0 -0
  97. data/test_data/44781.jpg +0 -0
  98. data/test_data/4pages.pdf +0 -0
  99. data/test_data/BlankWithSignature.pdf +0 -0
  100. data/test_data/Hello_world.pdf +0 -0
  101. data/test_data/HtmlExample1.html +27 -0
  102. data/test_data/Koala.jpg +0 -0
  103. data/test_data/PdfWithAcroForm.pdf +321 -0
  104. data/test_data/PdfWithAnnotations.pdf +720 -1
  105. data/test_data/PdfWithBookmarks.pdf +0 -0
  106. data/test_data/PdfWithEmbeddedFiles.pdf +0 -0
  107. data/test_data/PdfWithImages2.pdf +0 -0
  108. data/test_data/PdfWithLinks.pdf +0 -0
  109. data/test_data/Penguins.jpg +0 -0
  110. data/test_data/butterfly.jpg +0 -0
  111. data/test_data/marketing.pdf +0 -0
  112. data/test_data/rusdoc.pdf +0 -0
  113. data/test_data/test1234.pfx +0 -0
  114. metadata +54 -13
  115. data/lib/aspose_pdf_cloud/models/barcode_response_list.rb +0 -45
  116. data/lib/aspose_pdf_cloud/models/base_object.rb +0 -86
  117. data/lib/aspose_pdf_cloud/models/base_response.rb +0 -61
  118. data/lib/aspose_pdf_cloud/models/page_response.rb +0 -61
@@ -1,95 +1,270 @@
1
- module AsposePDFCloud
2
- #
3
- class Attachment < BaseObject
4
- attr_accessor :description, :mime_type, :name, :creation_date, :modification_date, :size, :check_sum, :links
5
- # attribute mapping from ruby-style variable name to JSON key
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
+ # Provides link to attachment.
26
+ class Attachment
27
+ # Link to the document.
28
+ attr_accessor :links
29
+
30
+ # Gets text associated with the attachment.
31
+ attr_accessor :description
32
+
33
+ # Gets subtype of the attachment file.
34
+ attr_accessor :mime_type
35
+
36
+ # Gets the name of the attachment.
37
+ attr_accessor :name
38
+
39
+ # The date and time when the embedded file was created.
40
+ attr_accessor :creation_date
41
+
42
+ # The date and time when the embedded file was last modified.
43
+ attr_accessor :modification_date
44
+
45
+ # The size of the uncompressed embedded file, in bytes.
46
+ attr_accessor :size
47
+
48
+ # A 16-byte string that is the checksum of the bytes of the uncompressed embedded file. The checksum is calculated by applying the standard MD5 message-digest algorithm to the bytes of the embedded file stream.
49
+ attr_accessor :check_sum
50
+
51
+
52
+ # Attribute mapping from ruby-style variable name to JSON key.
6
53
  def self.attribute_map
7
54
  {
8
-
9
- #
55
+ :'links' => :'Links',
10
56
  :'description' => :'Description',
11
-
12
- #
13
57
  :'mime_type' => :'MimeType',
14
-
15
- #
16
58
  :'name' => :'Name',
17
-
18
- #
19
59
  :'creation_date' => :'CreationDate',
20
-
21
- #
22
60
  :'modification_date' => :'ModificationDate',
23
-
24
- #
25
61
  :'size' => :'Size',
26
-
27
- #
28
- :'check_sum' => :'CheckSum',
29
-
30
- #
31
- :'links' => :'Links'
32
-
62
+ :'check_sum' => :'CheckSum'
33
63
  }
34
64
  end
35
65
 
36
- # attribute type
66
+ # Attribute type mapping.
37
67
  def self.swagger_types
38
68
  {
69
+ :'links' => :'Array<Link>',
39
70
  :'description' => :'String',
40
71
  :'mime_type' => :'String',
41
72
  :'name' => :'String',
42
73
  :'creation_date' => :'String',
43
74
  :'modification_date' => :'String',
44
75
  :'size' => :'Integer',
45
- :'check_sum' => :'String',
46
- :'links' => :'Array<Link>'
47
-
76
+ :'check_sum' => :'String'
48
77
  }
49
78
  end
50
79
 
80
+ # Initializes the object
81
+ # @param [Hash] attributes Model attributes in the form of hash
51
82
  def initialize(attributes = {})
52
- return if !attributes.is_a?(Hash) || attributes.empty?
83
+ return unless attributes.is_a?(Hash)
53
84
 
54
85
  # convert string to symbol for hash key
55
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
86
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
56
87
 
57
-
58
- if attributes[:'Description']
88
+ if attributes.has_key?(:'Links')
89
+ if (value = attributes[:'Links']).is_a?(Array)
90
+ self.links = value
91
+ end
92
+ end
93
+
94
+ if attributes.has_key?(:'Description')
59
95
  self.description = attributes[:'Description']
60
96
  end
61
-
62
- if attributes[:'MimeType']
97
+
98
+ if attributes.has_key?(:'MimeType')
63
99
  self.mime_type = attributes[:'MimeType']
64
100
  end
65
-
66
- if attributes[:'Name']
101
+
102
+ if attributes.has_key?(:'Name')
67
103
  self.name = attributes[:'Name']
68
104
  end
69
-
70
- if attributes[:'CreationDate']
105
+
106
+ if attributes.has_key?(:'CreationDate')
71
107
  self.creation_date = attributes[:'CreationDate']
72
108
  end
73
-
74
- if attributes[:'ModificationDate']
109
+
110
+ if attributes.has_key?(:'ModificationDate')
75
111
  self.modification_date = attributes[:'ModificationDate']
76
112
  end
77
-
78
- if attributes[:'Size']
113
+
114
+ if attributes.has_key?(:'Size')
79
115
  self.size = attributes[:'Size']
80
116
  end
81
-
82
- if attributes[:'CheckSum']
117
+
118
+ if attributes.has_key?(:'CheckSum')
83
119
  self.check_sum = attributes[:'CheckSum']
84
120
  end
85
-
86
- if attributes[:'Links']
87
- if (value = attributes[:'Links']).is_a?(Array)
88
- self.links = value
121
+
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properies with the reasons
126
+ def list_invalid_properties
127
+ invalid_properties = Array.new
128
+ return invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ return true
135
+ end
136
+
137
+ # Checks equality by comparing each attribute.
138
+ # @param [Object] Object to be compared
139
+ def ==(o)
140
+ return true if self.equal?(o)
141
+ self.class == o.class &&
142
+ links == o.links &&
143
+ description == o.description &&
144
+ mime_type == o.mime_type &&
145
+ name == o.name &&
146
+ creation_date == o.creation_date &&
147
+ modification_date == o.modification_date &&
148
+ size == o.size &&
149
+ check_sum == o.check_sum
150
+ end
151
+
152
+ # @see the `==` method
153
+ # @param [Object] Object to be compared
154
+ def eql?(o)
155
+ self == o
156
+ end
157
+
158
+ # Calculates hash code according to all attributes.
159
+ # @return [Fixnum] Hash code
160
+ def hash
161
+ [links, description, mime_type, name, creation_date, modification_date, size, check_sum].hash
162
+ end
163
+
164
+ # Builds the object from hash
165
+ # @param [Hash] attributes Model attributes in the form of hash
166
+ # @return [Object] Returns the model itself
167
+ def build_from_hash(attributes)
168
+ return nil unless attributes.is_a?(Hash)
169
+ self.class.swagger_types.each_pair do |key, type|
170
+ if type =~ /\AArray<(.*)>/i
171
+ # check to ensure the input is an array given that the the attribute
172
+ # is documented as an array but the input is not
173
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
174
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
175
+ end
176
+ elsif !attributes[self.class.attribute_map[key]].nil?
177
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
178
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
179
+ end
180
+
181
+ self
182
+ end
183
+
184
+ # Deserializes the data based on type
185
+ # @param string type Data type
186
+ # @param string value Value to be deserialized
187
+ # @return [Object] Deserialized data
188
+ def _deserialize(type, value)
189
+ case type.to_sym
190
+ when :DateTime
191
+ DateTime.parse(value)
192
+ when :Date
193
+ Date.parse(value)
194
+ when :String
195
+ value.to_s
196
+ when :Integer
197
+ value.to_i
198
+ when :Float
199
+ value.to_f
200
+ when :BOOLEAN
201
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
202
+ true
203
+ else
204
+ false
89
205
  end
206
+ when :Object
207
+ # generic object (usually a Hash), return directly
208
+ value
209
+ when /\AArray<(?<inner_type>.+)>\z/
210
+ inner_type = Regexp.last_match[:inner_type]
211
+ value.map { |v| _deserialize(inner_type, v) }
212
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
213
+ k_type = Regexp.last_match[:k_type]
214
+ v_type = Regexp.last_match[:v_type]
215
+ {}.tap do |hash|
216
+ value.each do |k, v|
217
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
218
+ end
219
+ end
220
+ else # model
221
+ temp_model = AsposePdfCloud.const_get(type).new
222
+ temp_model.build_from_hash(value)
223
+ end
224
+ end
225
+
226
+ # Returns the string representation of the object
227
+ # @return [String] String presentation of the object
228
+ def to_s
229
+ to_hash.to_s
230
+ end
231
+
232
+ # to_body is an alias to to_hash (backward compatibility)
233
+ # @return [Hash] Returns the object in the form of hash
234
+ def to_body
235
+ to_hash
236
+ end
237
+
238
+ # Returns the object in the form of hash
239
+ # @return [Hash] Returns the object in the form of hash
240
+ def to_hash
241
+ hash = {}
242
+ self.class.attribute_map.each_pair do |attr, param|
243
+ value = self.send(attr)
244
+ next if value.nil?
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map{ |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
90
265
  end
91
-
92
266
  end
93
267
 
94
268
  end
269
+
95
270
  end
@@ -1,61 +1,222 @@
1
- module AsposePDFCloud
2
- #
3
- class AttachmentResponse < BaseObject
4
- attr_accessor :attachment, :status, :code
5
- # attribute mapping from ruby-style variable name to JSON key
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
+
26
+ class AttachmentResponse
27
+ # Response status code.
28
+ attr_accessor :code
29
+
30
+ # Response status.
31
+ attr_accessor :status
32
+
33
+ attr_accessor :attachment
34
+
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
6
37
  def self.attribute_map
7
38
  {
8
-
9
- #
10
- :'attachment' => :'Attachment',
11
-
12
- #
39
+ :'code' => :'Code',
13
40
  :'status' => :'Status',
14
-
15
- #
16
- :'code' => :'Code'
17
-
41
+ :'attachment' => :'Attachment'
18
42
  }
19
43
  end
20
44
 
21
- # attribute type
45
+ # Attribute type mapping.
22
46
  def self.swagger_types
23
47
  {
24
- :'attachment' => :'Attachment',
48
+ :'code' => :'HttpStatusCode',
25
49
  :'status' => :'String',
26
- :'code' => :'String'
27
-
50
+ :'attachment' => :'Attachment'
28
51
  }
29
52
  end
30
53
 
54
+ # Initializes the object
55
+ # @param [Hash] attributes Model attributes in the form of hash
31
56
  def initialize(attributes = {})
32
- return if !attributes.is_a?(Hash) || attributes.empty?
57
+ return unless attributes.is_a?(Hash)
33
58
 
34
59
  # convert string to symbol for hash key
35
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
60
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
36
61
 
37
-
38
- if attributes[:'Attachment']
39
- self.attachment = attributes[:'Attachment']
62
+ if attributes.has_key?(:'Code')
63
+ self.code = attributes[:'Code']
40
64
  end
41
-
42
- if attributes[:'Status']
65
+
66
+ if attributes.has_key?(:'Status')
43
67
  self.status = attributes[:'Status']
44
68
  end
45
-
46
- if attributes[:'Code']
47
- self.code = attributes[:'Code']
69
+
70
+ if attributes.has_key?(:'Attachment')
71
+ self.attachment = attributes[:'Attachment']
48
72
  end
49
-
73
+
50
74
  end
51
75
 
52
- def status=(status)
53
- allowed_values = ["Continue", "SwitchingProtocols", "OK", "Created", "Accepted", "NonAuthoritativeInformation", "NoContent", "ResetContent", "PartialContent", "MultipleChoices", "Ambiguous", "MovedPermanently", "Moved", "Found", "Redirect", "SeeOther", "RedirectMethod", "NotModified", "UseProxy", "Unused", "TemporaryRedirect", "RedirectKeepVerb", "BadRequest", "Unauthorized", "PaymentRequired", "Forbidden", "NotFound", "MethodNotAllowed", "NotAcceptable", "ProxyAuthenticationRequired", "RequestTimeout", "Conflict", "Gone", "LengthRequired", "PreconditionFailed", "RequestEntityTooLarge", "RequestUriTooLong", "UnsupportedMediaType", "RequestedRangeNotSatisfiable", "ExpectationFailed", "UpgradeRequired", "InternalServerError", "NotImplemented", "BadGateway", "ServiceUnavailable", "GatewayTimeout", "HttpVersionNotSupported"]
54
- if status && !allowed_values.include?(status)
55
- fail "invalid value for 'status', must be one of #{allowed_values}"
76
+ # Show invalid properties with the reasons. Usually used together with valid?
77
+ # @return Array for valid properies with the reasons
78
+ def list_invalid_properties
79
+ invalid_properties = Array.new
80
+ if @code.nil?
81
+ invalid_properties.push("invalid value for 'code', code cannot be nil.")
82
+ end
83
+
84
+ return invalid_properties
85
+ end
86
+
87
+ # Check to see if the all the properties in the model are valid
88
+ # @return true if the model is valid
89
+ def valid?
90
+ return false if @code.nil?
91
+ return true
92
+ end
93
+
94
+ # Checks equality by comparing each attribute.
95
+ # @param [Object] Object to be compared
96
+ def ==(o)
97
+ return true if self.equal?(o)
98
+ self.class == o.class &&
99
+ code == o.code &&
100
+ status == o.status &&
101
+ attachment == o.attachment
102
+ end
103
+
104
+ # @see the `==` method
105
+ # @param [Object] Object to be compared
106
+ def eql?(o)
107
+ self == o
108
+ end
109
+
110
+ # Calculates hash code according to all attributes.
111
+ # @return [Fixnum] Hash code
112
+ def hash
113
+ [code, status, attachment].hash
114
+ end
115
+
116
+ # Builds the object from hash
117
+ # @param [Hash] attributes Model attributes in the form of hash
118
+ # @return [Object] Returns the model itself
119
+ def build_from_hash(attributes)
120
+ return nil unless attributes.is_a?(Hash)
121
+ self.class.swagger_types.each_pair do |key, type|
122
+ if type =~ /\AArray<(.*)>/i
123
+ # check to ensure the input is an array given that the the attribute
124
+ # is documented as an array but the input is not
125
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
126
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
127
+ end
128
+ elsif !attributes[self.class.attribute_map[key]].nil?
129
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
130
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
131
+ end
132
+
133
+ self
134
+ end
135
+
136
+ # Deserializes the data based on type
137
+ # @param string type Data type
138
+ # @param string value Value to be deserialized
139
+ # @return [Object] Deserialized data
140
+ def _deserialize(type, value)
141
+ case type.to_sym
142
+ when :DateTime
143
+ DateTime.parse(value)
144
+ when :Date
145
+ Date.parse(value)
146
+ when :String
147
+ value.to_s
148
+ when :Integer
149
+ value.to_i
150
+ when :Float
151
+ value.to_f
152
+ when :BOOLEAN
153
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
154
+ true
155
+ else
156
+ false
157
+ end
158
+ when :Object
159
+ # generic object (usually a Hash), return directly
160
+ value
161
+ when /\AArray<(?<inner_type>.+)>\z/
162
+ inner_type = Regexp.last_match[:inner_type]
163
+ value.map { |v| _deserialize(inner_type, v) }
164
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
165
+ k_type = Regexp.last_match[:k_type]
166
+ v_type = Regexp.last_match[:v_type]
167
+ {}.tap do |hash|
168
+ value.each do |k, v|
169
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
170
+ end
171
+ end
172
+ else # model
173
+ temp_model = AsposePdfCloud.const_get(type).new
174
+ temp_model.build_from_hash(value)
175
+ end
176
+ end
177
+
178
+ # Returns the string representation of the object
179
+ # @return [String] String presentation of the object
180
+ def to_s
181
+ to_hash.to_s
182
+ end
183
+
184
+ # to_body is an alias to to_hash (backward compatibility)
185
+ # @return [Hash] Returns the object in the form of hash
186
+ def to_body
187
+ to_hash
188
+ end
189
+
190
+ # Returns the object in the form of hash
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_hash
193
+ hash = {}
194
+ self.class.attribute_map.each_pair do |attr, param|
195
+ value = self.send(attr)
196
+ next if value.nil?
197
+ hash[param] = _to_hash(value)
198
+ end
199
+ hash
200
+ end
201
+
202
+ # Outputs non-array value in the form of hash
203
+ # For object, use to_hash. Otherwise, just return the value
204
+ # @param [Object] value Any valid value
205
+ # @return [Hash] Returns the value in the form of hash
206
+ def _to_hash(value)
207
+ if value.is_a?(Array)
208
+ value.compact.map{ |v| _to_hash(v) }
209
+ elsif value.is_a?(Hash)
210
+ {}.tap do |hash|
211
+ value.each { |k, v| hash[k] = _to_hash(v) }
212
+ end
213
+ elsif value.respond_to? :to_hash
214
+ value.to_hash
215
+ else
216
+ value
56
217
  end
57
- @status = status
58
218
  end
59
219
 
60
220
  end
221
+
61
222
  end