Skip to content

Commit b8f0dee

Browse files
Merge pull request #6 from kaferi/master
Updated to 18.6
2 parents b47b13f + 8d42fe8 commit b8f0dee

File tree

9 files changed

+4163
-1680
lines changed

9 files changed

+4163
-1680
lines changed

lib/aspose_pdf_cloud.rb

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,13 +43,17 @@
4343
require_relative 'aspose_pdf_cloud/models/html_document_type'
4444
require_relative 'aspose_pdf_cloud/models/html_markup_generation_modes'
4545
require_relative 'aspose_pdf_cloud/models/http_status_code'
46+
require_relative 'aspose_pdf_cloud/models/image_src_type'
47+
require_relative 'aspose_pdf_cloud/models/image_template'
48+
require_relative 'aspose_pdf_cloud/models/image_templates_request'
4649
require_relative 'aspose_pdf_cloud/models/images_list_request'
4750
require_relative 'aspose_pdf_cloud/models/letters_positioning_methods'
4851
require_relative 'aspose_pdf_cloud/models/line_spacing'
4952
require_relative 'aspose_pdf_cloud/models/link'
5053
require_relative 'aspose_pdf_cloud/models/link_action_type'
5154
require_relative 'aspose_pdf_cloud/models/link_element'
5255
require_relative 'aspose_pdf_cloud/models/link_highlighting_mode'
56+
require_relative 'aspose_pdf_cloud/models/margin_info'
5357
require_relative 'aspose_pdf_cloud/models/merge_documents'
5458
require_relative 'aspose_pdf_cloud/models/optimize_options'
5559
require_relative 'aspose_pdf_cloud/models/page_word_count'

lib/aspose_pdf_cloud/api/pdf_api.rb

Lines changed: 3094 additions & 1679 deletions
Large diffs are not rendered by default.
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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 ImageSrcType
26+
27+
COMMON = "Common".freeze
28+
EMF = "Emf".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 = ImageSrcType.constants.select{|c| c.to_s == value}
36+
constantValues = ImageSrcType.constants.select{ |const_name| ImageSrcType.const_get(const_name) == value}
37+
38+
raise "Invalid ENUM value #{value} for class #ImageSrcType" if constantValues.empty?
39+
value
40+
end
41+
end
42+
43+
end
Lines changed: 281 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,281 @@
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+
# Template of image.
26+
class ImageTemplate
27+
# A path for image.
28+
attr_accessor :image_path
29+
30+
# Image type.
31+
attr_accessor :image_src_type
32+
33+
attr_accessor :left_margin
34+
35+
attr_accessor :right_margin
36+
37+
attr_accessor :top_margin
38+
39+
attr_accessor :bottom_margin
40+
41+
attr_accessor :page_width
42+
43+
attr_accessor :page_height
44+
45+
attr_accessor :margin_info
46+
47+
48+
# Attribute mapping from ruby-style variable name to JSON key.
49+
def self.attribute_map
50+
{
51+
:'image_path' => :'ImagePath',
52+
:'image_src_type' => :'ImageSrcType',
53+
:'left_margin' => :'LeftMargin',
54+
:'right_margin' => :'RightMargin',
55+
:'top_margin' => :'TopMargin',
56+
:'bottom_margin' => :'BottomMargin',
57+
:'page_width' => :'PageWidth',
58+
:'page_height' => :'PageHeight',
59+
:'margin_info' => :'MarginInfo'
60+
}
61+
end
62+
63+
# Attribute type mapping.
64+
def self.swagger_types
65+
{
66+
:'image_path' => :'String',
67+
:'image_src_type' => :'ImageSrcType',
68+
:'left_margin' => :'Float',
69+
:'right_margin' => :'Float',
70+
:'top_margin' => :'Float',
71+
:'bottom_margin' => :'Float',
72+
:'page_width' => :'Float',
73+
:'page_height' => :'Float',
74+
:'margin_info' => :'MarginInfo'
75+
}
76+
end
77+
78+
# Initializes the object
79+
# @param [Hash] attributes Model attributes in the form of hash
80+
def initialize(attributes = {})
81+
return unless attributes.is_a?(Hash)
82+
83+
# convert string to symbol for hash key
84+
attributes = attributes.each_with_object({}){|(k,v), h| h[k.to_sym] = v}
85+
86+
if attributes.has_key?(:'ImagePath')
87+
self.image_path = attributes[:'ImagePath']
88+
end
89+
90+
if attributes.has_key?(:'ImageSrcType')
91+
self.image_src_type = attributes[:'ImageSrcType']
92+
end
93+
94+
if attributes.has_key?(:'LeftMargin')
95+
self.left_margin = attributes[:'LeftMargin']
96+
end
97+
98+
if attributes.has_key?(:'RightMargin')
99+
self.right_margin = attributes[:'RightMargin']
100+
end
101+
102+
if attributes.has_key?(:'TopMargin')
103+
self.top_margin = attributes[:'TopMargin']
104+
end
105+
106+
if attributes.has_key?(:'BottomMargin')
107+
self.bottom_margin = attributes[:'BottomMargin']
108+
end
109+
110+
if attributes.has_key?(:'PageWidth')
111+
self.page_width = attributes[:'PageWidth']
112+
end
113+
114+
if attributes.has_key?(:'PageHeight')
115+
self.page_height = attributes[:'PageHeight']
116+
end
117+
118+
if attributes.has_key?(:'MarginInfo')
119+
self.margin_info = attributes[:'MarginInfo']
120+
end
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+
if @image_path.nil?
129+
invalid_properties.push("invalid value for 'image_path', image_path cannot be nil.")
130+
end
131+
132+
if @image_src_type.nil?
133+
invalid_properties.push("invalid value for 'image_src_type', image_src_type cannot be nil.")
134+
end
135+
136+
return invalid_properties
137+
end
138+
139+
# Check to see if the all the properties in the model are valid
140+
# @return true if the model is valid
141+
def valid?
142+
return false if @image_path.nil?
143+
return false if @image_src_type.nil?
144+
return true
145+
end
146+
147+
# Checks equality by comparing each attribute.
148+
# @param [Object] Object to be compared
149+
def ==(o)
150+
return true if self.equal?(o)
151+
self.class == o.class &&
152+
image_path == o.image_path &&
153+
image_src_type == o.image_src_type &&
154+
left_margin == o.left_margin &&
155+
right_margin == o.right_margin &&
156+
top_margin == o.top_margin &&
157+
bottom_margin == o.bottom_margin &&
158+
page_width == o.page_width &&
159+
page_height == o.page_height &&
160+
margin_info == o.margin_info
161+
end
162+
163+
# @see the `==` method
164+
# @param [Object] Object to be compared
165+
def eql?(o)
166+
self == o
167+
end
168+
169+
# Calculates hash code according to all attributes.
170+
# @return [Fixnum] Hash code
171+
def hash
172+
[image_path, image_src_type, left_margin, right_margin, top_margin, bottom_margin, page_width, page_height, margin_info].hash
173+
end
174+
175+
# Builds the object from hash
176+
# @param [Hash] attributes Model attributes in the form of hash
177+
# @return [Object] Returns the model itself
178+
def build_from_hash(attributes)
179+
return nil unless attributes.is_a?(Hash)
180+
self.class.swagger_types.each_pair do |key, type|
181+
if type =~ /\AArray<(.*)>/i
182+
# check to ensure the input is an array given that the the attribute
183+
# is documented as an array but the input is not
184+
if attributes[self.class.attribute_map[key]].is_a?(Array)
185+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map{ |v| _deserialize($1, v) } )
186+
end
187+
elsif !attributes[self.class.attribute_map[key]].nil?
188+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
189+
end # or else data not found in attributes(hash), not an issue as the data can be optional
190+
end
191+
192+
self
193+
end
194+
195+
# Deserializes the data based on type
196+
# @param string type Data type
197+
# @param string value Value to be deserialized
198+
# @return [Object] Deserialized data
199+
def _deserialize(type, value)
200+
case type.to_sym
201+
when :DateTime
202+
DateTime.parse(value)
203+
when :Date
204+
Date.parse(value)
205+
when :String
206+
value.to_s
207+
when :Integer
208+
value.to_i
209+
when :Float
210+
value.to_f
211+
when :BOOLEAN
212+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
213+
true
214+
else
215+
false
216+
end
217+
when :Object
218+
# generic object (usually a Hash), return directly
219+
value
220+
when /\AArray<(?<inner_type>.+)>\z/
221+
inner_type = Regexp.last_match[:inner_type]
222+
value.map { |v| _deserialize(inner_type, v) }
223+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
224+
k_type = Regexp.last_match[:k_type]
225+
v_type = Regexp.last_match[:v_type]
226+
{}.tap do |hash|
227+
value.each do |k, v|
228+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
229+
end
230+
end
231+
else # model
232+
temp_model = AsposePdfCloud.const_get(type).new
233+
temp_model.build_from_hash(value)
234+
end
235+
end
236+
237+
# Returns the string representation of the object
238+
# @return [String] String presentation of the object
239+
def to_s
240+
to_hash.to_s
241+
end
242+
243+
# to_body is an alias to to_hash (backward compatibility)
244+
# @return [Hash] Returns the object in the form of hash
245+
def to_body
246+
to_hash
247+
end
248+
249+
# Returns the object in the form of hash
250+
# @return [Hash] Returns the object in the form of hash
251+
def to_hash
252+
hash = {}
253+
self.class.attribute_map.each_pair do |attr, param|
254+
value = self.send(attr)
255+
next if value.nil?
256+
hash[param] = _to_hash(value)
257+
end
258+
hash
259+
end
260+
261+
# Outputs non-array value in the form of hash
262+
# For object, use to_hash. Otherwise, just return the value
263+
# @param [Object] value Any valid value
264+
# @return [Hash] Returns the value in the form of hash
265+
def _to_hash(value)
266+
if value.is_a?(Array)
267+
value.compact.map{ |v| _to_hash(v) }
268+
elsif value.is_a?(Hash)
269+
{}.tap do |hash|
270+
value.each { |k, v| hash[k] = _to_hash(v) }
271+
end
272+
elsif value.respond_to? :to_hash
273+
value.to_hash
274+
else
275+
value
276+
end
277+
end
278+
279+
end
280+
281+
end

0 commit comments

Comments
 (0)