Skip to content

Commit f34b6df

Browse files
committed
Updated sources
1 parent fbfa395 commit f34b6df

9 files changed

Lines changed: 104 additions & 20 deletions

File tree

Gemfile.lock

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,9 @@
11
PATH
22
remote: .
33
specs:
4-
groupdocs_annotation_cloud (21.2)
4+
groupdocs_annotation_cloud (21.6)
55
addressable (~> 2.5.0, >= 2.5.0)
66
faraday (~> 0.14.0)
7-
mimemagic (~> 0.3.2)
87

98
GEM
109
remote: https://rubygems.org/
@@ -13,7 +12,6 @@ GEM
1312
public_suffix (>= 2.0.2, < 4.0)
1413
faraday (0.14.0)
1514
multipart-post (>= 1.2, < 3)
16-
mimemagic (0.3.5)
1715
minitest (5.11.3)
1816
multipart-post (2.1.1)
1917
public_suffix (3.1.1)

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ gem install groupdocs_annotation_cloud
1313
To add dependency to your app copy following into your Gemfile and run `bundle install`:
1414

1515
```
16-
gem "groupdocs_annotation_cloud", "~> 21.2"
16+
gem "groupdocs_annotation_cloud", "~> 21.6"
1717
```
1818

1919
## Getting Started

groupdocs_annotation_cloud.gemspec

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,6 @@ Gem::Specification.new do |s|
1313
s.metadata = { 'source_code_uri' => 'https://github.com/groupdocs-annotation-cloud/groupdocs-annotation-cloud-ruby' }
1414

1515
s.add_runtime_dependency 'faraday', '~> 0.14.0'
16-
s.add_runtime_dependency 'mimemagic', '~> 0.3.2'
1716
s.add_runtime_dependency 'addressable', '~> 2.5.0', '>= 2.5.0'
1817

1918
s.add_development_dependency 'minitest', '~> 5.11', '>= 5.11.3'

lib/groupdocs_annotation_cloud/api_error.rb

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -39,10 +39,23 @@ def initialize(arg = nil)
3939

4040
if arg.key?(:response_body) then
4141
data = JSON.parse(arg[:response_body], :symbolize_names => true)
42-
if !data.nil? && !data[:error].nil? then
43-
@message = data[:error]
44-
elsif !data.nil? && !data[:Error].nil? && !data[:Error][:Message].nil? then
45-
@message = data[:Error][:Message]
42+
if !data.nil? then
43+
if !data[:error].nil? then
44+
error = data[:error]
45+
if error.kind_of?(String) then
46+
@message = error
47+
else
48+
@message = error[:message]
49+
end
50+
else
51+
message = data[:message]
52+
if !message.nil? && message.kind_of?(String) then
53+
@message = message
54+
@code = data[:code]
55+
else
56+
@message = data
57+
end
58+
end
4659
end
4760
end
4861

lib/groupdocs_annotation_cloud/models/annotate_options.rb

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,9 @@ class AnnotateOptions
4949
# Path to output document in the cloud storage. Required for Add method. Not required if Annotate (with file result) method used.
5050
attr_accessor :output_path
5151

52+
# The path to directory containing custom fonts in storage
53+
attr_accessor :fonts_path
54+
5255
# Attribute mapping from ruby-style variable name to JSON key.
5356
def self.attribute_map
5457
{
@@ -57,7 +60,8 @@ def self.attribute_map
5760
:'first_page' => :'FirstPage',
5861
:'last_page' => :'LastPage',
5962
:'only_annotated_pages' => :'OnlyAnnotatedPages',
60-
:'output_path' => :'OutputPath'
63+
:'output_path' => :'OutputPath',
64+
:'fonts_path' => :'FontsPath'
6165
}
6266
end
6367

@@ -69,7 +73,8 @@ def self.swagger_types
6973
:'first_page' => :'Integer',
7074
:'last_page' => :'Integer',
7175
:'only_annotated_pages' => :'BOOLEAN',
72-
:'output_path' => :'String'
76+
:'output_path' => :'String',
77+
:'fonts_path' => :'String'
7378
}
7479
end
7580

@@ -107,6 +112,10 @@ def initialize(attributes = {})
107112
self.output_path = attributes[:'OutputPath']
108113
end
109114

115+
if attributes.key?(:'FontsPath')
116+
self.fonts_path = attributes[:'FontsPath']
117+
end
118+
110119
end
111120

112121
# Show invalid properties with the reasons. Usually used together with valid?
@@ -147,7 +156,8 @@ def ==(other)
147156
first_page == other.first_page &&
148157
last_page == other.last_page &&
149158
only_annotated_pages == other.only_annotated_pages &&
150-
output_path == other.output_path
159+
output_path == other.output_path &&
160+
fonts_path == other.fonts_path
151161
end
152162

153163
# @see the `==` method
@@ -159,7 +169,7 @@ def eql?(other)
159169
# Calculates hash code according to all attributes.
160170
# @return [Fixnum] Hash code
161171
def hash
162-
[file_info, annotations, first_page, last_page, only_annotated_pages, output_path].hash
172+
[file_info, annotations, first_page, last_page, only_annotated_pages, output_path, fonts_path].hash
163173
end
164174

165175
# Downcases first letter.

lib/groupdocs_annotation_cloud/models/annotation_info.rb

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ class AnnotationInfo
106106
# Gets or sets the watermark annotation's rotation angle
107107
attr_accessor :angle
108108

109+
# Gets or sets z-index. Default value is 0 The z-index property specifies the stack order of an element.
110+
attr_accessor :z_index
111+
109112
# Gets or sets annotation link url
110113
attr_accessor :url
111114

@@ -161,6 +164,7 @@ def self.attribute_map
161164
:'font_size' => :'FontSize',
162165
:'opacity' => :'Opacity',
163166
:'angle' => :'Angle',
167+
:'z_index' => :'ZIndex',
164168
:'url' => :'Url',
165169
:'image_path' => :'ImagePath'
166170
}
@@ -194,6 +198,7 @@ def self.swagger_types
194198
:'font_size' => :'Float',
195199
:'opacity' => :'Float',
196200
:'angle' => :'Float',
201+
:'z_index' => :'Integer',
197202
:'url' => :'String',
198203
:'image_path' => :'String'
199204
}
@@ -311,6 +316,10 @@ def initialize(attributes = {})
311316
self.angle = attributes[:'Angle']
312317
end
313318

319+
if attributes.key?(:'ZIndex')
320+
self.z_index = attributes[:'ZIndex']
321+
end
322+
314323
if attributes.key?(:'Url')
315324
self.url = attributes[:'Url']
316325
end
@@ -353,6 +362,10 @@ def list_invalid_properties
353362
invalid_properties.push("invalid value for 'created_on', created_on cannot be nil.")
354363
end
355364

365+
if @z_index.nil?
366+
invalid_properties.push("invalid value for 'z_index', z_index cannot be nil.")
367+
end
368+
356369
return invalid_properties
357370
end
358371

@@ -374,6 +387,7 @@ def valid?
374387
return false if @created_on.nil?
375388
pen_style_validator = EnumAttributeValidator.new('String', ["Solid", "Dash", "DashDot", "Dot", "LongDash", "DashDotDot"])
376389
return false unless pen_style_validator.valid?(@pen_style)
390+
return false if @z_index.nil?
377391
return true
378392
end
379393

@@ -467,6 +481,7 @@ def ==(other)
467481
font_size == other.font_size &&
468482
opacity == other.opacity &&
469483
angle == other.angle &&
484+
z_index == other.z_index &&
470485
url == other.url &&
471486
image_path == other.image_path
472487
end
@@ -480,7 +495,7 @@ def eql?(other)
480495
# Calculates hash code according to all attributes.
481496
# @return [Fixnum] Hash code
482497
def hash
483-
[id, text, text_to_replace, horizontal_alignment, vertical_alignment, creator_id, creator_name, creator_email, box, points, page_number, annotation_position, svg_path, type, replies, created_on, font_color, pen_color, pen_width, pen_style, background_color, font_family, font_size, opacity, angle, url, image_path].hash
498+
[id, text, text_to_replace, horizontal_alignment, vertical_alignment, creator_id, creator_name, creator_email, box, points, page_number, annotation_position, svg_path, type, replies, created_on, font_color, pen_color, pen_width, pen_style, background_color, font_family, font_size, opacity, angle, z_index, url, image_path].hash
484499
end
485500

486501
# Downcases first letter.

lib/groupdocs_annotation_cloud/models/preview_options.rb

Lines changed: 44 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,8 +46,17 @@ class PreviewOptions
4646
# Preview image height. Not required. Default width used if not specified or 0.
4747
attr_accessor :height
4848

49+
# Gets or sets the resolution for generated images, in dots per inch. The default value is 96.
50+
attr_accessor :resolution
51+
4952
# Render document comments. Default value is 'false'.
5053
attr_accessor :render_comments
54+
55+
# The property that controls whether annotations will be generated on the preview. Default State - true.
56+
attr_accessor :render_annotations
57+
58+
# The path to directory containing custom fonts in storage
59+
attr_accessor :fonts_path
5160
class EnumAttributeValidator
5261
attr_reader :datatype
5362
attr_reader :allowable_values
@@ -78,7 +87,10 @@ def self.attribute_map
7887
:'page_numbers' => :'PageNumbers',
7988
:'width' => :'Width',
8089
:'height' => :'Height',
81-
:'render_comments' => :'RenderComments'
90+
:'resolution' => :'Resolution',
91+
:'render_comments' => :'RenderComments',
92+
:'render_annotations' => :'RenderAnnotations',
93+
:'fonts_path' => :'FontsPath'
8294
}
8395
end
8496

@@ -90,7 +102,10 @@ def self.swagger_types
90102
:'page_numbers' => :'Array<Integer>',
91103
:'width' => :'Integer',
92104
:'height' => :'Integer',
93-
:'render_comments' => :'BOOLEAN'
105+
:'resolution' => :'Integer',
106+
:'render_comments' => :'BOOLEAN',
107+
:'render_annotations' => :'BOOLEAN',
108+
:'fonts_path' => :'String'
94109
}
95110
end
96111

@@ -124,10 +139,22 @@ def initialize(attributes = {})
124139
self.height = attributes[:'Height']
125140
end
126141

142+
if attributes.key?(:'Resolution')
143+
self.resolution = attributes[:'Resolution']
144+
end
145+
127146
if attributes.key?(:'RenderComments')
128147
self.render_comments = attributes[:'RenderComments']
129148
end
130149

150+
if attributes.key?(:'RenderAnnotations')
151+
self.render_annotations = attributes[:'RenderAnnotations']
152+
end
153+
154+
if attributes.key?(:'FontsPath')
155+
self.fonts_path = attributes[:'FontsPath']
156+
end
157+
131158
end
132159

133160
# Show invalid properties with the reasons. Usually used together with valid?
@@ -146,10 +173,18 @@ def list_invalid_properties
146173
invalid_properties.push("invalid value for 'height', height cannot be nil.")
147174
end
148175

176+
if @resolution.nil?
177+
invalid_properties.push("invalid value for 'resolution', resolution cannot be nil.")
178+
end
179+
149180
if @render_comments.nil?
150181
invalid_properties.push("invalid value for 'render_comments', render_comments cannot be nil.")
151182
end
152183

184+
if @render_annotations.nil?
185+
invalid_properties.push("invalid value for 'render_annotations', render_annotations cannot be nil.")
186+
end
187+
153188
return invalid_properties
154189
end
155190

@@ -161,7 +196,9 @@ def valid?
161196
return false unless format_validator.valid?(@format)
162197
return false if @width.nil?
163198
return false if @height.nil?
199+
return false if @resolution.nil?
164200
return false if @render_comments.nil?
201+
return false if @render_annotations.nil?
165202
return true
166203
end
167204

@@ -190,7 +227,10 @@ def ==(other)
190227
page_numbers == other.page_numbers &&
191228
width == other.width &&
192229
height == other.height &&
193-
render_comments == other.render_comments
230+
resolution == other.resolution &&
231+
render_comments == other.render_comments &&
232+
render_annotations == other.render_annotations &&
233+
fonts_path == other.fonts_path
194234
end
195235

196236
# @see the `==` method
@@ -202,7 +242,7 @@ def eql?(other)
202242
# Calculates hash code according to all attributes.
203243
# @return [Fixnum] Hash code
204244
def hash
205-
[file_info, format, page_numbers, width, height, render_comments].hash
245+
[file_info, format, page_numbers, width, height, resolution, render_comments, render_annotations, fonts_path].hash
206246
end
207247

208248
# Downcases first letter.

lib/groupdocs_annotation_cloud/version.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,5 +25,5 @@
2525
# --------------------------------------------------------------------------------------------------------------------
2626
#
2727
module GroupDocsAnnotationCloud
28-
VERSION = "21.2".freeze
28+
VERSION = "21.6".freeze
2929
end

test/api/test_info_api.rb

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,12 +46,21 @@ def test_get_info
4646
file_info = FileInfo.new()
4747
file_info.file_path = test_file.path
4848
file_info.password = test_file.password
49-
5049
request = GetInfoRequest.new(file_info)
5150
response = @info_api.get_info(request)
5251
assert_equal test_file.path, response.path
5352
end
5453
end
5554

55+
def test_get_info_file_not_found
56+
file_info = FileInfo.new()
57+
file_info.file_path = "some-folder\\NotExist.docx"
58+
request = GetInfoRequest.new(file_info)
59+
error = assert_raises ApiError do
60+
@info_api.get_info(request)
61+
end
62+
assert_equal "Specified file not found", error.message
63+
end
64+
5665
end
5766
end

0 commit comments

Comments
 (0)