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
@@ -0,0 +1,43 @@
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
+ class LineSpacing
26
+
27
+ FONT_SIZE = "FontSize".freeze
28
+ FULL_SIZE = "FullSize".freeze
29
+
30
+ # Builds the enum from string
31
+ # @param [String] The enum value in the form of the string
32
+ # @return [String] The enum value
33
+ def build_from_hash(value)
34
+ # resolve issue with Concstant Name modification (ex: "FooName" to :FOO_NAME)
35
+ # consantValues = LineSpacing.constants.select{|c| c.to_s == value}
36
+ constantValues = LineSpacing.constants.select{ |const_name| LineSpacing.const_get(const_name) == value}
37
+
38
+ raise "Invalid ENUM value #{value} for class #LineSpacing" if constantValues.empty?
39
+ value
40
+ end
41
+ end
42
+
43
+ end
@@ -1,61 +1,228 @@
1
- module AsposePDFCloud
2
- #
3
- class Link < BaseObject
4
- attr_accessor :href, :rel, :type, :title
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 information for the object link. This is supposed to be an atom:link, therefore it should have all attributes specified here http://tools.ietf.org/html/rfc4287#section-4.2.7
26
+ class Link
27
+ # The \"href\" attribute contains the link's IRI. atom:link elements MUST have an href attribute, whose value MUST be a IRI reference
28
+ attr_accessor :href
29
+
30
+ # atom:link elements MAY have a \"rel\" attribute that indicates the link relation type. If the \"rel\" attribute is not present, the link element MUST be interpreted as if the link relation type is \"alternate\".
31
+ attr_accessor :rel
32
+
33
+ # On the link element, the \"type\" attribute's value is an advisory media type: it is a hint about the type of the representation that is expected to be returned when the value of the href attribute is dereferenced. Note that the type attribute does not override the actual media type returned with the representation.
34
+ attr_accessor :type
35
+
36
+ # The \"title\" attribute conveys human-readable information about the link. The content of the \"title\" attribute is Language-Sensitive.
37
+ attr_accessor :title
38
+
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
6
41
  def self.attribute_map
7
42
  {
8
-
9
- #
10
43
  :'href' => :'Href',
11
-
12
- #
13
44
  :'rel' => :'Rel',
14
-
15
- #
16
45
  :'type' => :'Type',
17
-
18
- #
19
46
  :'title' => :'Title'
20
-
21
47
  }
22
48
  end
23
49
 
24
- # attribute type
50
+ # Attribute type mapping.
25
51
  def self.swagger_types
26
52
  {
27
53
  :'href' => :'String',
28
54
  :'rel' => :'String',
29
55
  :'type' => :'String',
30
56
  :'title' => :'String'
31
-
32
57
  }
33
58
  end
34
59
 
60
+ # Initializes the object
61
+ # @param [Hash] attributes Model attributes in the form of hash
35
62
  def initialize(attributes = {})
36
- return if !attributes.is_a?(Hash) || attributes.empty?
63
+ return unless attributes.is_a?(Hash)
37
64
 
38
65
  # convert string to symbol for hash key
39
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
66
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
40
67
 
41
-
42
- if attributes[:'Href']
68
+ if attributes.has_key?(:'Href')
43
69
  self.href = attributes[:'Href']
44
70
  end
45
-
46
- if attributes[:'Rel']
71
+
72
+ if attributes.has_key?(:'Rel')
47
73
  self.rel = attributes[:'Rel']
48
74
  end
49
-
50
- if attributes[:'Type']
75
+
76
+ if attributes.has_key?(:'Type')
51
77
  self.type = attributes[:'Type']
52
78
  end
53
-
54
- if attributes[:'Title']
79
+
80
+ if attributes.has_key?(:'Title')
55
81
  self.title = attributes[:'Title']
56
82
  end
57
-
83
+
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properies with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ return invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ return true
97
+ end
98
+
99
+ # Checks equality by comparing each attribute.
100
+ # @param [Object] Object to be compared
101
+ def ==(o)
102
+ return true if self.equal?(o)
103
+ self.class == o.class &&
104
+ href == o.href &&
105
+ rel == o.rel &&
106
+ type == o.type &&
107
+ title == o.title
108
+ end
109
+
110
+ # @see the `==` method
111
+ # @param [Object] Object to be compared
112
+ def eql?(o)
113
+ self == o
114
+ end
115
+
116
+ # Calculates hash code according to all attributes.
117
+ # @return [Fixnum] Hash code
118
+ def hash
119
+ [href, rel, type, title].hash
120
+ end
121
+
122
+ # Builds the object from hash
123
+ # @param [Hash] attributes Model attributes in the form of hash
124
+ # @return [Object] Returns the model itself
125
+ def build_from_hash(attributes)
126
+ return nil unless attributes.is_a?(Hash)
127
+ self.class.swagger_types.each_pair do |key, type|
128
+ if type =~ /\AArray<(.*)>/i
129
+ # check to ensure the input is an array given that the the attribute
130
+ # is documented as an array but the input is not
131
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
132
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
133
+ end
134
+ elsif !attributes[self.class.attribute_map[key]].nil?
135
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
136
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
137
+ end
138
+
139
+ self
140
+ end
141
+
142
+ # Deserializes the data based on type
143
+ # @param string type Data type
144
+ # @param string value Value to be deserialized
145
+ # @return [Object] Deserialized data
146
+ def _deserialize(type, value)
147
+ case type.to_sym
148
+ when :DateTime
149
+ DateTime.parse(value)
150
+ when :Date
151
+ Date.parse(value)
152
+ when :String
153
+ value.to_s
154
+ when :Integer
155
+ value.to_i
156
+ when :Float
157
+ value.to_f
158
+ when :BOOLEAN
159
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
160
+ true
161
+ else
162
+ false
163
+ end
164
+ when :Object
165
+ # generic object (usually a Hash), return directly
166
+ value
167
+ when /\AArray<(?<inner_type>.+)>\z/
168
+ inner_type = Regexp.last_match[:inner_type]
169
+ value.map { |v| _deserialize(inner_type, v) }
170
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
171
+ k_type = Regexp.last_match[:k_type]
172
+ v_type = Regexp.last_match[:v_type]
173
+ {}.tap do |hash|
174
+ value.each do |k, v|
175
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
176
+ end
177
+ end
178
+ else # model
179
+ temp_model = AsposePdfCloud.const_get(type).new
180
+ temp_model.build_from_hash(value)
181
+ end
182
+ end
183
+
184
+ # Returns the string representation of the object
185
+ # @return [String] String presentation of the object
186
+ def to_s
187
+ to_hash.to_s
188
+ end
189
+
190
+ # to_body is an alias to to_hash (backward compatibility)
191
+ # @return [Hash] Returns the object in the form of hash
192
+ def to_body
193
+ to_hash
194
+ end
195
+
196
+ # Returns the object in the form of hash
197
+ # @return [Hash] Returns the object in the form of hash
198
+ def to_hash
199
+ hash = {}
200
+ self.class.attribute_map.each_pair do |attr, param|
201
+ value = self.send(attr)
202
+ next if value.nil?
203
+ hash[param] = _to_hash(value)
204
+ end
205
+ hash
206
+ end
207
+
208
+ # Outputs non-array value in the form of hash
209
+ # For object, use to_hash. Otherwise, just return the value
210
+ # @param [Object] value Any valid value
211
+ # @return [Hash] Returns the value in the form of hash
212
+ def _to_hash(value)
213
+ if value.is_a?(Array)
214
+ value.compact.map{ |v| _to_hash(v) }
215
+ elsif value.is_a?(Hash)
216
+ {}.tap do |hash|
217
+ value.each { |k, v| hash[k] = _to_hash(v) }
218
+ end
219
+ elsif value.respond_to? :to_hash
220
+ value.to_hash
221
+ else
222
+ value
223
+ end
58
224
  end
59
225
 
60
226
  end
227
+
61
228
  end
@@ -0,0 +1,46 @@
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
+ class LinkActionType
26
+
27
+ GO_TO_ACTION = 0.freeze
28
+ GO_TO_URI_ACTION = 1.freeze
29
+ JAVASCRIPT_ACTION = 2.freeze
30
+ LAUNCH_ACTION = 3.freeze
31
+ NAMED_ACTION = 4.freeze
32
+ SUBMIT_FORM_ACTION = 5.freeze
33
+
34
+ # Builds the enum from string
35
+ # @param [Fixnum] The enum value in the form of the string
36
+ # @return [Fixnum] The enum value
37
+ def build_from_hash(value)
38
+ constantValues = LinkActionType.constants.select{ |const_name| LinkActionType.const_get(const_name) == value}
39
+ raise "Invalid ENUM value #{value} for class #LinkActionType" if constantValues.empty?
40
+ value
41
+ #constantValues[0]
42
+ end
43
+
44
+ end
45
+
46
+ end
@@ -1,71 +1,236 @@
1
- module AsposePDFCloud
2
- #
3
- class LinkAnnotation < BaseObject
4
- attr_accessor :action_type, :action, :highlighting, :color, :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 linkAnnotation.
26
+ class LinkAnnotation
27
+ # Link to the document.
28
+ attr_accessor :links
29
+
30
+ attr_accessor :action_type
31
+
32
+ attr_accessor :action
33
+
34
+ attr_accessor :highlighting
35
+
36
+ attr_accessor :color
37
+
38
+
39
+ # Attribute mapping from ruby-style variable name to JSON key.
6
40
  def self.attribute_map
7
41
  {
8
-
9
- #
42
+ :'links' => :'Links',
10
43
  :'action_type' => :'ActionType',
11
-
12
- #
13
44
  :'action' => :'Action',
14
-
15
- #
16
45
  :'highlighting' => :'Highlighting',
17
-
18
- #
19
- :'color' => :'Color',
20
-
21
- #
22
- :'links' => :'Links'
23
-
46
+ :'color' => :'Color'
24
47
  }
25
48
  end
26
49
 
27
- # attribute type
50
+ # Attribute type mapping.
28
51
  def self.swagger_types
29
52
  {
30
- :'action_type' => :'String',
53
+ :'links' => :'Array<Link>',
54
+ :'action_type' => :'LinkActionType',
31
55
  :'action' => :'String',
32
- :'highlighting' => :'String',
33
- :'color' => :'Color',
34
- :'links' => :'Array<Link>'
35
-
56
+ :'highlighting' => :'LinkHighlightingMode',
57
+ :'color' => :'Color'
36
58
  }
37
59
  end
38
60
 
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
39
63
  def initialize(attributes = {})
40
- return if !attributes.is_a?(Hash) || attributes.empty?
64
+ return unless attributes.is_a?(Hash)
41
65
 
42
66
  # convert string to symbol for hash key
43
- attributes = attributes.inject({}){|memo,(k,v)| memo[k.to_sym] = v; memo}
67
+ attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
68
+
69
+ if attributes.has_key?(:'Links')
70
+ if (value = attributes[:'Links']).is_a?(Array)
71
+ self.links = value
72
+ end
73
+ end
44
74
 
45
-
46
- if attributes[:'ActionType']
75
+ if attributes.has_key?(:'ActionType')
47
76
  self.action_type = attributes[:'ActionType']
48
77
  end
49
-
50
- if attributes[:'Action']
78
+
79
+ if attributes.has_key?(:'Action')
51
80
  self.action = attributes[:'Action']
52
81
  end
53
-
54
- if attributes[:'Highlighting']
82
+
83
+ if attributes.has_key?(:'Highlighting')
55
84
  self.highlighting = attributes[:'Highlighting']
56
85
  end
57
-
58
- if attributes[:'Color']
86
+
87
+ if attributes.has_key?(:'Color')
59
88
  self.color = attributes[:'Color']
60
89
  end
61
-
62
- if attributes[:'Links']
63
- if (value = attributes[:'Links']).is_a?(Array)
64
- self.links = value
90
+
91
+ end
92
+
93
+ # Show invalid properties with the reasons. Usually used together with valid?
94
+ # @return Array for valid properies with the reasons
95
+ def list_invalid_properties
96
+ invalid_properties = Array.new
97
+ return invalid_properties
98
+ end
99
+
100
+ # Check to see if the all the properties in the model are valid
101
+ # @return true if the model is valid
102
+ def valid?
103
+ return true
104
+ end
105
+
106
+ # Checks equality by comparing each attribute.
107
+ # @param [Object] Object to be compared
108
+ def ==(o)
109
+ return true if self.equal?(o)
110
+ self.class == o.class &&
111
+ links == o.links &&
112
+ action_type == o.action_type &&
113
+ action == o.action &&
114
+ highlighting == o.highlighting &&
115
+ color == o.color
116
+ end
117
+
118
+ # @see the `==` method
119
+ # @param [Object] Object to be compared
120
+ def eql?(o)
121
+ self == o
122
+ end
123
+
124
+ # Calculates hash code according to all attributes.
125
+ # @return [Fixnum] Hash code
126
+ def hash
127
+ [links, action_type, action, highlighting, color].hash
128
+ end
129
+
130
+ # Builds the object from hash
131
+ # @param [Hash] attributes Model attributes in the form of hash
132
+ # @return [Object] Returns the model itself
133
+ def build_from_hash(attributes)
134
+ return nil unless attributes.is_a?(Hash)
135
+ self.class.swagger_types.each_pair do |key, type|
136
+ if type =~ /\AArray<(.*)>/i
137
+ # check to ensure the input is an array given that the the attribute
138
+ # is documented as an array but the input is not
139
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
140
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
141
+ end
142
+ elsif !attributes[self.class.attribute_map[key]].nil?
143
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
144
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
145
+ end
146
+
147
+ self
148
+ end
149
+
150
+ # Deserializes the data based on type
151
+ # @param string type Data type
152
+ # @param string value Value to be deserialized
153
+ # @return [Object] Deserialized data
154
+ def _deserialize(type, value)
155
+ case type.to_sym
156
+ when :DateTime
157
+ DateTime.parse(value)
158
+ when :Date
159
+ Date.parse(value)
160
+ when :String
161
+ value.to_s
162
+ when :Integer
163
+ value.to_i
164
+ when :Float
165
+ value.to_f
166
+ when :BOOLEAN
167
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
168
+ true
169
+ else
170
+ false
171
+ end
172
+ when :Object
173
+ # generic object (usually a Hash), return directly
174
+ value
175
+ when /\AArray<(?<inner_type>.+)>\z/
176
+ inner_type = Regexp.last_match[:inner_type]
177
+ value.map { |v| _deserialize(inner_type, v) }
178
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
179
+ k_type = Regexp.last_match[:k_type]
180
+ v_type = Regexp.last_match[:v_type]
181
+ {}.tap do |hash|
182
+ value.each do |k, v|
183
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
184
+ end
65
185
  end
186
+ else # model
187
+ temp_model = AsposePdfCloud.const_get(type).new
188
+ temp_model.build_from_hash(value)
189
+ end
190
+ end
191
+
192
+ # Returns the string representation of the object
193
+ # @return [String] String presentation of the object
194
+ def to_s
195
+ to_hash.to_s
196
+ end
197
+
198
+ # to_body is an alias to to_hash (backward compatibility)
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_body
201
+ to_hash
202
+ end
203
+
204
+ # Returns the object in the form of hash
205
+ # @return [Hash] Returns the object in the form of hash
206
+ def to_hash
207
+ hash = {}
208
+ self.class.attribute_map.each_pair do |attr, param|
209
+ value = self.send(attr)
210
+ next if value.nil?
211
+ hash[param] = _to_hash(value)
212
+ end
213
+ hash
214
+ end
215
+
216
+ # Outputs non-array value in the form of hash
217
+ # For object, use to_hash. Otherwise, just return the value
218
+ # @param [Object] value Any valid value
219
+ # @return [Hash] Returns the value in the form of hash
220
+ def _to_hash(value)
221
+ if value.is_a?(Array)
222
+ value.compact.map{ |v| _to_hash(v) }
223
+ elsif value.is_a?(Hash)
224
+ {}.tap do |hash|
225
+ value.each { |k, v| hash[k] = _to_hash(v) }
226
+ end
227
+ elsif value.respond_to? :to_hash
228
+ value.to_hash
229
+ else
230
+ value
66
231
  end
67
-
68
232
  end
69
233
 
70
234
  end
235
+
71
236
  end