Skip to content

Commit f27a58e

Browse files
committed
Updated sources
1 parent f34b6df commit f27a58e

9 files changed

Lines changed: 442 additions & 14 deletions

File tree

Gemfile.lock

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
PATH
22
remote: .
33
specs:
4-
groupdocs_annotation_cloud (21.6)
4+
groupdocs_annotation_cloud (22.2)
55
addressable (~> 2.5.0, >= 2.5.0)
66
faraday (~> 0.14.0)
77

@@ -12,10 +12,10 @@ GEM
1212
public_suffix (>= 2.0.2, < 4.0)
1313
faraday (0.14.0)
1414
multipart-post (>= 1.2, < 3)
15-
minitest (5.11.3)
15+
minitest (5.15.0)
1616
multipart-post (2.1.1)
1717
public_suffix (3.1.1)
18-
rake (13.0.1)
18+
rake (13.0.6)
1919

2020
PLATFORMS
2121
x64-mingw32

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.6"
16+
gem "groupdocs_annotation_cloud", "~> 22.2"
1717
```
1818

1919
## Getting Started

lib/groupdocs_annotation_cloud.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
require_relative 'groupdocs_annotation_cloud/models/annotate_options'
3434
require_relative 'groupdocs_annotation_cloud/models/annotation_info'
3535
require_relative 'groupdocs_annotation_cloud/models/annotation_reply_info'
36+
require_relative 'groupdocs_annotation_cloud/models/consumption_result'
3637
require_relative 'groupdocs_annotation_cloud/models/disc_usage'
3738
require_relative 'groupdocs_annotation_cloud/models/document_info'
3839
require_relative 'groupdocs_annotation_cloud/models/error'
@@ -63,5 +64,6 @@
6364
require_relative 'groupdocs_annotation_cloud/api/file_api'
6465
require_relative 'groupdocs_annotation_cloud/api/folder_api'
6566
require_relative 'groupdocs_annotation_cloud/api/info_api'
67+
require_relative 'groupdocs_annotation_cloud/api/license_api'
6668
require_relative 'groupdocs_annotation_cloud/api/preview_api'
6769
require_relative 'groupdocs_annotation_cloud/api/storage_api'
Lines changed: 169 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,169 @@
1+
# -----------------------------------------------------------------------------------
2+
# <copyright company="Aspose Pty Ltd" file="license.rb">
3+
# Copyright (c) 2003-2021 Aspose Pty Ltd
4+
# </copyright>
5+
# <summary>
6+
# Permission is hereby granted, free of charge, to any person obtaining a copy
7+
# of this software and associated documentation files (the "Software"), to deal
8+
# in the Software without restriction, including without limitation the rights
9+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10+
# copies of the Software, and to permit persons to whom the Software is
11+
# furnished to do so, subject to the following conditions:
12+
#
13+
# The above copyright notice and this permission notice shall be included in all
14+
# copies or substantial portions of the Software.
15+
#
16+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22+
# SOFTWARE.
23+
# </summary>
24+
# -----------------------------------------------------------------------------------
25+
26+
require 'uri'
27+
require 'date'
28+
29+
module GroupDocsAnnotationCloud
30+
#
31+
# GroupDocs.Annotation Cloud API
32+
#
33+
class LicenseApi
34+
attr_accessor :config
35+
36+
#make LicenseApi.new private
37+
private_class_method :new
38+
39+
# Initializes new instance of LicenseApi
40+
#
41+
# @param [config] Configuration
42+
# @return [LicenseApi] New instance of LicenseApi
43+
def initialize(config)
44+
@config = config
45+
@api_client = ApiClient.new(config)
46+
@access_token = nil
47+
end
48+
49+
# Initializes new instance of LicenseApi
50+
#
51+
# @param [app_sid] Application identifier (App SID)
52+
# @param [app_key] Application private key (App Key)
53+
# @return [LicenseApi] New instance of LicenseApi
54+
def self.from_keys(app_sid, app_key)
55+
config = Configuration.new(app_sid, app_key)
56+
return new(config)
57+
end
58+
59+
# Initializes new instance of LicenseApi
60+
#
61+
# @param [config] Configuration
62+
# @return [LicenseApi] New instance of LicenseApi
63+
def self.from_config(config)
64+
return new(config)
65+
end
66+
67+
# Get license consumption
68+
#
69+
# @return [ConsumptionResult]
70+
def get_consumption_credit()
71+
data, _status_code, _headers = get_consumption_credit_with_http_info()
72+
data
73+
end
74+
75+
# Get license consumption
76+
#
77+
78+
# @return [Array<(ConsumptionResult, Fixnum, Hash)>]
79+
# ConsumptionResult data, response status code and response headers
80+
def get_consumption_credit_with_http_info()
81+
82+
83+
@api_client.config.logger.debug 'Calling API: LicenseApi.get_consumption_credit ...' if @api_client.config.debugging
84+
# resource path
85+
local_var_path = '/annotation/consumption'
86+
87+
# query parameters
88+
query_params = {}
89+
90+
# header parameters
91+
header_params = {}
92+
# HTTP header 'Accept' (if needed)
93+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
94+
# HTTP header 'Content-Type'
95+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])
96+
97+
# form parameters
98+
form_params = {}
99+
100+
# http body (model)
101+
post_body = nil
102+
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
103+
header_params: header_params,
104+
query_params: query_params,
105+
form_params: form_params,
106+
body: post_body,
107+
access_token: get_access_token,
108+
return_type: 'ConsumptionResult')
109+
if @api_client.config.debugging
110+
@api_client.config.logger.debug "API called:
111+
LicenseApi#get_consumption_credit\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
112+
end
113+
[data, status_code, headers]
114+
end
115+
116+
#
117+
# Helper method to convert first letter to downcase
118+
#
119+
private def downcase_first_letter(str)
120+
value = str[0].downcase + str[1..-1]
121+
value
122+
end
123+
124+
#
125+
# Retrieves access token
126+
#
127+
private def get_access_token
128+
if @access_token.nil? then
129+
request_access_token
130+
end
131+
132+
@access_token
133+
end
134+
135+
#
136+
# Gets a access token from server
137+
#
138+
private def request_access_token
139+
auth_config = Configuration.new(@config.app_sid, @config.app_key)
140+
auth_config.api_base_url = @config.api_base_url
141+
auth_config.debugging = @config.debugging
142+
auth_config.logger = @config.logger
143+
auth_config.temp_folder_path = @config.temp_folder_path
144+
auth_config.client_side_validation = @config.client_side_validation
145+
auth_config.api_version = ''
146+
147+
auth_api_client = ApiClient.new(auth_config)
148+
149+
request_url = "/connect/token"
150+
post_data = "grant_type=client_credentials&client_id=#{@config.app_sid}&client_secret=#{@config.app_key}"
151+
152+
data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
153+
154+
@access_token = data[:access_token]
155+
156+
expires_in_seconds = data[:expires_in].to_i - 5 * 60
157+
expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
158+
@access_token_expires_at = DateTime.now + expires_in_days
159+
end
160+
161+
# requires all files inside a directory from current dir
162+
# @param _dir can be relative path like '/lib' or "../lib"
163+
private def require_all(_dir)
164+
Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), _dir)) + "/*.rb"].each do |file|
165+
require file
166+
end
167+
end
168+
end
169+
end

lib/groupdocs_annotation_cloud/models/annotation_info.rb

Lines changed: 31 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,9 @@ class AnnotationInfo
9494
# Gets or sets the annotation's background color
9595
attr_accessor :background_color
9696

97+
# Gets or sets annotation color
98+
attr_accessor :squiggly_color
99+
97100
# Gets or sets the annotation's font family
98101
attr_accessor :font_family
99102

@@ -114,6 +117,9 @@ class AnnotationInfo
114117

115118
# Gets or sets image file path in cloud storage, for Image annotations
116119
attr_accessor :image_path
120+
121+
# Sets auto scale for watermark annotation
122+
attr_accessor :auto_scale
117123
class EnumAttributeValidator
118124
attr_reader :datatype
119125
attr_reader :allowable_values
@@ -160,13 +166,15 @@ def self.attribute_map
160166
:'pen_width' => :'PenWidth',
161167
:'pen_style' => :'PenStyle',
162168
:'background_color' => :'BackgroundColor',
169+
:'squiggly_color' => :'SquigglyColor',
163170
:'font_family' => :'FontFamily',
164171
:'font_size' => :'FontSize',
165172
:'opacity' => :'Opacity',
166173
:'angle' => :'Angle',
167174
:'z_index' => :'ZIndex',
168175
:'url' => :'Url',
169-
:'image_path' => :'ImagePath'
176+
:'image_path' => :'ImagePath',
177+
:'auto_scale' => :'AutoScale'
170178
}
171179
end
172180

@@ -194,13 +202,15 @@ def self.swagger_types
194202
:'pen_width' => :'Integer',
195203
:'pen_style' => :'String',
196204
:'background_color' => :'Integer',
205+
:'squiggly_color' => :'Integer',
197206
:'font_family' => :'String',
198207
:'font_size' => :'Float',
199208
:'opacity' => :'Float',
200209
:'angle' => :'Float',
201210
:'z_index' => :'Integer',
202211
:'url' => :'String',
203-
:'image_path' => :'String'
212+
:'image_path' => :'String',
213+
:'auto_scale' => :'BOOLEAN'
204214
}
205215
end
206216

@@ -300,6 +310,10 @@ def initialize(attributes = {})
300310
self.background_color = attributes[:'BackgroundColor']
301311
end
302312

313+
if attributes.key?(:'SquigglyColor')
314+
self.squiggly_color = attributes[:'SquigglyColor']
315+
end
316+
303317
if attributes.key?(:'FontFamily')
304318
self.font_family = attributes[:'FontFamily']
305319
end
@@ -328,6 +342,10 @@ def initialize(attributes = {})
328342
self.image_path = attributes[:'ImagePath']
329343
end
330344

345+
if attributes.key?(:'AutoScale')
346+
self.auto_scale = attributes[:'AutoScale']
347+
end
348+
331349
end
332350

333351
# Show invalid properties with the reasons. Usually used together with valid?
@@ -366,6 +384,10 @@ def list_invalid_properties
366384
invalid_properties.push("invalid value for 'z_index', z_index cannot be nil.")
367385
end
368386

387+
if @auto_scale.nil?
388+
invalid_properties.push("invalid value for 'auto_scale', auto_scale cannot be nil.")
389+
end
390+
369391
return invalid_properties
370392
end
371393

@@ -382,12 +404,13 @@ def valid?
382404
return false if @creator_id.nil?
383405
return false if @box.nil?
384406
return false if @type.nil?
385-
type_validator = EnumAttributeValidator.new('String', ["None", "Area", "Arrow", "Distance", "Ellipse", "Link", "Point", "Polyline", "ResourcesRedaction", "TextField", "TextHighlight", "TextRedaction", "TextReplacement", "TextStrikeout", "TextUnderline", "Watermark", "Image"])
407+
type_validator = EnumAttributeValidator.new('String', ["None", "Area", "Arrow", "Distance", "Ellipse", "Link", "Point", "Polyline", "ResourcesRedaction", "TextField", "TextHighlight", "TextRedaction", "TextReplacement", "TextStrikeout", "TextUnderline", "Watermark", "Image", "TextSquiggly"])
386408
return false unless type_validator.valid?(@type)
387409
return false if @created_on.nil?
388410
pen_style_validator = EnumAttributeValidator.new('String', ["Solid", "Dash", "DashDot", "Dot", "LongDash", "DashDotDot"])
389411
return false unless pen_style_validator.valid?(@pen_style)
390412
return false if @z_index.nil?
413+
return false if @auto_scale.nil?
391414
return true
392415
end
393416

@@ -424,7 +447,7 @@ def vertical_alignment=(vertical_alignment)
424447
# Custom attribute writer method checking allowed values (enum).
425448
# @param [Object] type Object to be assigned
426449
def type=(type)
427-
validator = EnumAttributeValidator.new('String', ["None", "Area", "Arrow", "Distance", "Ellipse", "Link", "Point", "Polyline", "ResourcesRedaction", "TextField", "TextHighlight", "TextRedaction", "TextReplacement", "TextStrikeout", "TextUnderline", "Watermark", "Image"])
450+
validator = EnumAttributeValidator.new('String', ["None", "Area", "Arrow", "Distance", "Ellipse", "Link", "Point", "Polyline", "ResourcesRedaction", "TextField", "TextHighlight", "TextRedaction", "TextReplacement", "TextStrikeout", "TextUnderline", "Watermark", "Image", "TextSquiggly"])
428451
if type.to_i == 0
429452
unless validator.valid?(type)
430453
# raise ArgumentError, "invalid value for 'type', must be one of #{validator.allowable_values}."
@@ -477,13 +500,15 @@ def ==(other)
477500
pen_width == other.pen_width &&
478501
pen_style == other.pen_style &&
479502
background_color == other.background_color &&
503+
squiggly_color == other.squiggly_color &&
480504
font_family == other.font_family &&
481505
font_size == other.font_size &&
482506
opacity == other.opacity &&
483507
angle == other.angle &&
484508
z_index == other.z_index &&
485509
url == other.url &&
486-
image_path == other.image_path
510+
image_path == other.image_path &&
511+
auto_scale == other.auto_scale
487512
end
488513

489514
# @see the `==` method
@@ -495,7 +520,7 @@ def eql?(other)
495520
# Calculates hash code according to all attributes.
496521
# @return [Fixnum] Hash code
497522
def 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
523+
[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, squiggly_color, font_family, font_size, opacity, angle, z_index, url, image_path, auto_scale].hash
499524
end
500525

501526
# Downcases first letter.

0 commit comments

Comments
 (0)