groupdocs_annotation_cloud 18.7 → 19.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/groupdocs_annotation_cloud.rb +23 -39
- data/lib/groupdocs_annotation_cloud/api/annotate_api.rb +664 -0
- data/lib/groupdocs_annotation_cloud/api/file_api.rb +729 -0
- data/lib/groupdocs_annotation_cloud/api/folder_api.rb +694 -0
- data/lib/groupdocs_annotation_cloud/api/{pdf_file_api.rb → info_api.rb} +101 -105
- data/lib/groupdocs_annotation_cloud/api/preview_api.rb +380 -0
- data/lib/groupdocs_annotation_cloud/api/storage_api.rb +541 -0
- data/lib/groupdocs_annotation_cloud/api_client.rb +7 -17
- data/lib/groupdocs_annotation_cloud/api_error.rb +5 -3
- data/lib/groupdocs_annotation_cloud/configuration.rb +3 -3
- data/lib/groupdocs_annotation_cloud/models/annotation_api_link.rb +24 -16
- data/lib/groupdocs_annotation_cloud/models/annotation_info.rb +97 -82
- data/lib/groupdocs_annotation_cloud/models/annotation_reply_info.rb +31 -23
- data/lib/groupdocs_annotation_cloud/models/disc_usage.rb +234 -0
- data/lib/groupdocs_annotation_cloud/models/document_info.rb +44 -22
- data/lib/groupdocs_annotation_cloud/models/error.rb +244 -0
- data/lib/groupdocs_annotation_cloud/models/error_details.rb +229 -0
- data/lib/groupdocs_annotation_cloud/models/file_version.rb +289 -0
- data/lib/groupdocs_annotation_cloud/models/{value_type.rb → file_versions.rb} +33 -13
- data/lib/groupdocs_annotation_cloud/models/files_list.rb +216 -0
- data/lib/groupdocs_annotation_cloud/models/files_upload_result.rb +228 -0
- data/lib/groupdocs_annotation_cloud/models/format.rb +224 -0
- data/lib/groupdocs_annotation_cloud/models/formats_result.rb +216 -0
- data/lib/groupdocs_annotation_cloud/models/link.rb +24 -16
- data/lib/groupdocs_annotation_cloud/models/link_element.rb +18 -10
- data/lib/groupdocs_annotation_cloud/models/object_exist.rb +234 -0
- data/lib/groupdocs_annotation_cloud/models/{image_page.rb → page_image.rb} +28 -13
- data/lib/groupdocs_annotation_cloud/models/{image_pages.rb → page_images.rb} +26 -14
- data/lib/groupdocs_annotation_cloud/models/page_info.rb +41 -23
- data/lib/groupdocs_annotation_cloud/models/point.rb +31 -13
- data/lib/groupdocs_annotation_cloud/models/rectangle.rb +45 -17
- data/lib/groupdocs_annotation_cloud/models/row_info.rb +38 -16
- data/lib/groupdocs_annotation_cloud/models/storage_exist.rb +219 -0
- data/lib/groupdocs_annotation_cloud/models/storage_file.rb +264 -0
- data/lib/groupdocs_annotation_cloud/version.rb +2 -2
- metadata +22 -39
- data/lib/groupdocs_annotation_cloud/api/annotation_api.rb +0 -344
- data/lib/groupdocs_annotation_cloud/api/image_info_api.rb +0 -218
- data/lib/groupdocs_annotation_cloud/api/image_pages_api.rb +0 -395
- data/lib/groupdocs_annotation_cloud/models/requests/delete_clean_document_request.rb +0 -53
- data/lib/groupdocs_annotation_cloud/models/requests/delete_pages_request.rb +0 -49
- data/lib/groupdocs_annotation_cloud/models/requests/get_import_request.rb +0 -53
- data/lib/groupdocs_annotation_cloud/models/requests/get_info_request.rb +0 -53
- data/lib/groupdocs_annotation_cloud/models/requests/get_page_request.rb +0 -53
- data/lib/groupdocs_annotation_cloud/models/requests/get_pages_request.rb +0 -49
- data/lib/groupdocs_annotation_cloud/models/requests/get_pdf_request.rb +0 -53
- data/lib/groupdocs_annotation_cloud/models/requests/get_pdf_stream_request.rb +0 -53
- data/lib/groupdocs_annotation_cloud/models/requests/post_pages_request.rb +0 -53
- data/lib/groupdocs_annotation_cloud/models/requests/put_export_request.rb +0 -57
@@ -1,7 +1,7 @@
|
|
1
1
|
#
|
2
2
|
# --------------------------------------------------------------------------------------------------------------------
|
3
3
|
# <copyright company="Aspose Pty Ltd" file="version.rb">
|
4
|
-
# Copyright (c) 2003-
|
4
|
+
# Copyright (c) 2003-2019 Aspose Pty Ltd
|
5
5
|
# </copyright>
|
6
6
|
# <summary>
|
7
7
|
# Permission is hereby granted, free of charge, to any person obtaining a copy
|
@@ -25,5 +25,5 @@
|
|
25
25
|
# --------------------------------------------------------------------------------------------------------------------
|
26
26
|
#
|
27
27
|
module GroupDocsAnnotationCloud
|
28
|
-
VERSION = "
|
28
|
+
VERSION = "19.5".freeze
|
29
29
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: groupdocs_annotation_cloud
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '
|
4
|
+
version: '19.5'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- GroupDocs
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2019-07-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -58,26 +58,6 @@ dependencies:
|
|
58
58
|
- - ">="
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: 2.5.0
|
61
|
-
- !ruby/object:Gem::Dependency
|
62
|
-
name: groupdocs_storage_cloud
|
63
|
-
requirement: !ruby/object:Gem::Requirement
|
64
|
-
requirements:
|
65
|
-
- - "~>"
|
66
|
-
- !ruby/object:Gem::Version
|
67
|
-
version: '18.6'
|
68
|
-
- - ">="
|
69
|
-
- !ruby/object:Gem::Version
|
70
|
-
version: '18.5'
|
71
|
-
type: :development
|
72
|
-
prerelease: false
|
73
|
-
version_requirements: !ruby/object:Gem::Requirement
|
74
|
-
requirements:
|
75
|
-
- - "~>"
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
version: '18.6'
|
78
|
-
- - ">="
|
79
|
-
- !ruby/object:Gem::Version
|
80
|
-
version: '18.5'
|
81
61
|
- !ruby/object:Gem::Dependency
|
82
62
|
name: minitest
|
83
63
|
requirement: !ruby/object:Gem::Requirement
|
@@ -105,36 +85,39 @@ extensions: []
|
|
105
85
|
extra_rdoc_files: []
|
106
86
|
files:
|
107
87
|
- lib/groupdocs_annotation_cloud.rb
|
108
|
-
- lib/groupdocs_annotation_cloud/api/
|
109
|
-
- lib/groupdocs_annotation_cloud/api/
|
110
|
-
- lib/groupdocs_annotation_cloud/api/
|
111
|
-
- lib/groupdocs_annotation_cloud/api/
|
88
|
+
- lib/groupdocs_annotation_cloud/api/annotate_api.rb
|
89
|
+
- lib/groupdocs_annotation_cloud/api/file_api.rb
|
90
|
+
- lib/groupdocs_annotation_cloud/api/folder_api.rb
|
91
|
+
- lib/groupdocs_annotation_cloud/api/info_api.rb
|
92
|
+
- lib/groupdocs_annotation_cloud/api/preview_api.rb
|
93
|
+
- lib/groupdocs_annotation_cloud/api/storage_api.rb
|
112
94
|
- lib/groupdocs_annotation_cloud/api_client.rb
|
113
95
|
- lib/groupdocs_annotation_cloud/api_error.rb
|
114
96
|
- lib/groupdocs_annotation_cloud/configuration.rb
|
115
97
|
- lib/groupdocs_annotation_cloud/models/annotation_api_link.rb
|
116
98
|
- lib/groupdocs_annotation_cloud/models/annotation_info.rb
|
117
99
|
- lib/groupdocs_annotation_cloud/models/annotation_reply_info.rb
|
100
|
+
- lib/groupdocs_annotation_cloud/models/disc_usage.rb
|
118
101
|
- lib/groupdocs_annotation_cloud/models/document_info.rb
|
119
|
-
- lib/groupdocs_annotation_cloud/models/
|
120
|
-
- lib/groupdocs_annotation_cloud/models/
|
102
|
+
- lib/groupdocs_annotation_cloud/models/error.rb
|
103
|
+
- lib/groupdocs_annotation_cloud/models/error_details.rb
|
104
|
+
- lib/groupdocs_annotation_cloud/models/file_version.rb
|
105
|
+
- lib/groupdocs_annotation_cloud/models/file_versions.rb
|
106
|
+
- lib/groupdocs_annotation_cloud/models/files_list.rb
|
107
|
+
- lib/groupdocs_annotation_cloud/models/files_upload_result.rb
|
108
|
+
- lib/groupdocs_annotation_cloud/models/format.rb
|
109
|
+
- lib/groupdocs_annotation_cloud/models/formats_result.rb
|
121
110
|
- lib/groupdocs_annotation_cloud/models/link.rb
|
122
111
|
- lib/groupdocs_annotation_cloud/models/link_element.rb
|
112
|
+
- lib/groupdocs_annotation_cloud/models/object_exist.rb
|
113
|
+
- lib/groupdocs_annotation_cloud/models/page_image.rb
|
114
|
+
- lib/groupdocs_annotation_cloud/models/page_images.rb
|
123
115
|
- lib/groupdocs_annotation_cloud/models/page_info.rb
|
124
116
|
- lib/groupdocs_annotation_cloud/models/point.rb
|
125
117
|
- lib/groupdocs_annotation_cloud/models/rectangle.rb
|
126
|
-
- lib/groupdocs_annotation_cloud/models/requests/delete_clean_document_request.rb
|
127
|
-
- lib/groupdocs_annotation_cloud/models/requests/delete_pages_request.rb
|
128
|
-
- lib/groupdocs_annotation_cloud/models/requests/get_import_request.rb
|
129
|
-
- lib/groupdocs_annotation_cloud/models/requests/get_info_request.rb
|
130
|
-
- lib/groupdocs_annotation_cloud/models/requests/get_page_request.rb
|
131
|
-
- lib/groupdocs_annotation_cloud/models/requests/get_pages_request.rb
|
132
|
-
- lib/groupdocs_annotation_cloud/models/requests/get_pdf_request.rb
|
133
|
-
- lib/groupdocs_annotation_cloud/models/requests/get_pdf_stream_request.rb
|
134
|
-
- lib/groupdocs_annotation_cloud/models/requests/post_pages_request.rb
|
135
|
-
- lib/groupdocs_annotation_cloud/models/requests/put_export_request.rb
|
136
118
|
- lib/groupdocs_annotation_cloud/models/row_info.rb
|
137
|
-
- lib/groupdocs_annotation_cloud/models/
|
119
|
+
- lib/groupdocs_annotation_cloud/models/storage_exist.rb
|
120
|
+
- lib/groupdocs_annotation_cloud/models/storage_file.rb
|
138
121
|
- lib/groupdocs_annotation_cloud/version.rb
|
139
122
|
homepage: https://products.groupdocs.cloud/annotation/ruby
|
140
123
|
licenses:
|
@@ -1,344 +0,0 @@
|
|
1
|
-
# -----------------------------------------------------------------------------------
|
2
|
-
# <copyright company="Aspose Pty Ltd" file="annotation.rb">
|
3
|
-
# Copyright (c) 2003-2018 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 AnnotationApi
|
34
|
-
attr_accessor :config
|
35
|
-
|
36
|
-
#make AnnotationApi.new private
|
37
|
-
private_class_method :new
|
38
|
-
|
39
|
-
# Initializes new instance of AnnotationApi
|
40
|
-
#
|
41
|
-
# @param [config] Configuration
|
42
|
-
# @return [AnnotationApi] New instance of AnnotationApi
|
43
|
-
def initialize(config)
|
44
|
-
@config = config
|
45
|
-
@api_client = ApiClient.new(config)
|
46
|
-
require_all '../models/requests'
|
47
|
-
|
48
|
-
@access_token = nil
|
49
|
-
end
|
50
|
-
|
51
|
-
# Initializes new instance of AnnotationApi
|
52
|
-
#
|
53
|
-
# @param [app_sid] Application identifier (App SID)
|
54
|
-
# @param [app_key] Application private key (App Key)
|
55
|
-
# @return [AnnotationApi] New instance of AnnotationApi
|
56
|
-
def self.from_keys(app_sid, app_key)
|
57
|
-
config = Configuration.new(app_sid, app_key)
|
58
|
-
return new(config)
|
59
|
-
end
|
60
|
-
|
61
|
-
# Initializes new instance of AnnotationApi
|
62
|
-
#
|
63
|
-
# @param [config] Configuration
|
64
|
-
# @return [AnnotationApi] New instance of AnnotationApi
|
65
|
-
def self.from_config(config)
|
66
|
-
return new(config)
|
67
|
-
end
|
68
|
-
|
69
|
-
# Removes annotations from document.
|
70
|
-
#
|
71
|
-
# @param request delete_clean_document_request
|
72
|
-
# @return [File]
|
73
|
-
def delete_clean_document(request)
|
74
|
-
data, _status_code, _headers = delete_clean_document_with_http_info(request)
|
75
|
-
data
|
76
|
-
end
|
77
|
-
|
78
|
-
# Removes annotations from document.
|
79
|
-
#
|
80
|
-
# @param request delete_clean_document_request
|
81
|
-
# @return [Array<(File, Fixnum, Hash)>]
|
82
|
-
# File data, response status code and response headers
|
83
|
-
def delete_clean_document_with_http_info(request)
|
84
|
-
raise ArgumentError, 'Incorrect request type' unless request.is_a? DeleteCleanDocumentRequest
|
85
|
-
|
86
|
-
@api_client.config.logger.debug 'Calling API: AnnotationApi.delete_clean_document ...' if @api_client.config.debugging
|
87
|
-
# verify the required parameter 'name' is set
|
88
|
-
raise ArgumentError, 'Missing the required parameter name when calling AnnotationApi.delete_clean_document' if @api_client.config.client_side_validation && request.name.nil?
|
89
|
-
# resource path
|
90
|
-
local_var_path = '/annotation/{name}/annotations'
|
91
|
-
local_var_path = local_var_path.sub('{' + downcase_first_letter('Name') + '}', request.name.to_s)
|
92
|
-
|
93
|
-
# query parameters
|
94
|
-
query_params = {}
|
95
|
-
if local_var_path.include? ('{' + downcase_first_letter('Folder') + '}')
|
96
|
-
local_var_path = local_var_path.sub('{' + downcase_first_letter('Folder') + '}', request.folder.to_s)
|
97
|
-
else
|
98
|
-
query_params[downcase_first_letter('Folder')] = request.folder unless request.folder.nil?
|
99
|
-
end
|
100
|
-
if local_var_path.include? ('{' + downcase_first_letter('Password') + '}')
|
101
|
-
local_var_path = local_var_path.sub('{' + downcase_first_letter('Password') + '}', request.password.to_s)
|
102
|
-
else
|
103
|
-
query_params[downcase_first_letter('Password')] = request.password unless request.password.nil?
|
104
|
-
end
|
105
|
-
|
106
|
-
# header parameters
|
107
|
-
header_params = {}
|
108
|
-
# HTTP header 'Accept' (if needed)
|
109
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
|
110
|
-
# HTTP header 'Content-Type'
|
111
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])
|
112
|
-
|
113
|
-
# form parameters
|
114
|
-
form_params = {}
|
115
|
-
|
116
|
-
# http body (model)
|
117
|
-
post_body = nil
|
118
|
-
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
119
|
-
header_params: header_params,
|
120
|
-
query_params: query_params,
|
121
|
-
form_params: form_params,
|
122
|
-
body: post_body,
|
123
|
-
access_token: get_access_token,
|
124
|
-
return_type: 'File')
|
125
|
-
if @api_client.config.debugging
|
126
|
-
@api_client.config.logger.debug "API called:
|
127
|
-
AnnotationApi#delete_clean_document\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
128
|
-
end
|
129
|
-
[data, status_code, headers]
|
130
|
-
end
|
131
|
-
|
132
|
-
# Extracts annotations from document.
|
133
|
-
#
|
134
|
-
# @param request get_import_request
|
135
|
-
# @return [Array<AnnotationInfo>]
|
136
|
-
def get_import(request)
|
137
|
-
data, _status_code, _headers = get_import_with_http_info(request)
|
138
|
-
data
|
139
|
-
end
|
140
|
-
|
141
|
-
# Extracts annotations from document.
|
142
|
-
#
|
143
|
-
# @param request get_import_request
|
144
|
-
# @return [Array<(Array<AnnotationInfo>, Fixnum, Hash)>]
|
145
|
-
# Array<AnnotationInfo> data, response status code and response headers
|
146
|
-
def get_import_with_http_info(request)
|
147
|
-
raise ArgumentError, 'Incorrect request type' unless request.is_a? GetImportRequest
|
148
|
-
|
149
|
-
@api_client.config.logger.debug 'Calling API: AnnotationApi.get_import ...' if @api_client.config.debugging
|
150
|
-
# verify the required parameter 'name' is set
|
151
|
-
raise ArgumentError, 'Missing the required parameter name when calling AnnotationApi.get_import' if @api_client.config.client_side_validation && request.name.nil?
|
152
|
-
# resource path
|
153
|
-
local_var_path = '/annotation/{name}/annotations'
|
154
|
-
local_var_path = local_var_path.sub('{' + downcase_first_letter('Name') + '}', request.name.to_s)
|
155
|
-
|
156
|
-
# query parameters
|
157
|
-
query_params = {}
|
158
|
-
if local_var_path.include? ('{' + downcase_first_letter('Folder') + '}')
|
159
|
-
local_var_path = local_var_path.sub('{' + downcase_first_letter('Folder') + '}', request.folder.to_s)
|
160
|
-
else
|
161
|
-
query_params[downcase_first_letter('Folder')] = request.folder unless request.folder.nil?
|
162
|
-
end
|
163
|
-
if local_var_path.include? ('{' + downcase_first_letter('Password') + '}')
|
164
|
-
local_var_path = local_var_path.sub('{' + downcase_first_letter('Password') + '}', request.password.to_s)
|
165
|
-
else
|
166
|
-
query_params[downcase_first_letter('Password')] = request.password unless request.password.nil?
|
167
|
-
end
|
168
|
-
|
169
|
-
# header parameters
|
170
|
-
header_params = {}
|
171
|
-
# HTTP header 'Accept' (if needed)
|
172
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
|
173
|
-
# HTTP header 'Content-Type'
|
174
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])
|
175
|
-
|
176
|
-
# form parameters
|
177
|
-
form_params = {}
|
178
|
-
|
179
|
-
# http body (model)
|
180
|
-
post_body = nil
|
181
|
-
data, status_code, headers = @api_client.call_api(:GET, local_var_path,
|
182
|
-
header_params: header_params,
|
183
|
-
query_params: query_params,
|
184
|
-
form_params: form_params,
|
185
|
-
body: post_body,
|
186
|
-
access_token: get_access_token,
|
187
|
-
return_type: 'Array<AnnotationInfo>')
|
188
|
-
if @api_client.config.debugging
|
189
|
-
@api_client.config.logger.debug "API called:
|
190
|
-
AnnotationApi#get_import\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
191
|
-
end
|
192
|
-
[data, status_code, headers]
|
193
|
-
end
|
194
|
-
|
195
|
-
# Adds annotations to the document.
|
196
|
-
#
|
197
|
-
# @param request put_export_request
|
198
|
-
# @return [File]
|
199
|
-
def put_export(request)
|
200
|
-
data, _status_code, _headers = put_export_with_http_info(request)
|
201
|
-
data
|
202
|
-
end
|
203
|
-
|
204
|
-
# Adds annotations to the document.
|
205
|
-
#
|
206
|
-
# @param request put_export_request
|
207
|
-
# @return [Array<(File, Fixnum, Hash)>]
|
208
|
-
# File data, response status code and response headers
|
209
|
-
def put_export_with_http_info(request)
|
210
|
-
raise ArgumentError, 'Incorrect request type' unless request.is_a? PutExportRequest
|
211
|
-
|
212
|
-
@api_client.config.logger.debug 'Calling API: AnnotationApi.put_export ...' if @api_client.config.debugging
|
213
|
-
# verify the required parameter 'name' is set
|
214
|
-
raise ArgumentError, 'Missing the required parameter name when calling AnnotationApi.put_export' if @api_client.config.client_side_validation && request.name.nil?
|
215
|
-
# resource path
|
216
|
-
local_var_path = '/annotation/{name}/annotations'
|
217
|
-
local_var_path = local_var_path.sub('{' + downcase_first_letter('Name') + '}', request.name.to_s)
|
218
|
-
|
219
|
-
# query parameters
|
220
|
-
query_params = {}
|
221
|
-
if local_var_path.include? ('{' + downcase_first_letter('Folder') + '}')
|
222
|
-
local_var_path = local_var_path.sub('{' + downcase_first_letter('Folder') + '}', request.folder.to_s)
|
223
|
-
else
|
224
|
-
query_params[downcase_first_letter('Folder')] = request.folder unless request.folder.nil?
|
225
|
-
end
|
226
|
-
if local_var_path.include? ('{' + downcase_first_letter('Password') + '}')
|
227
|
-
local_var_path = local_var_path.sub('{' + downcase_first_letter('Password') + '}', request.password.to_s)
|
228
|
-
else
|
229
|
-
query_params[downcase_first_letter('Password')] = request.password unless request.password.nil?
|
230
|
-
end
|
231
|
-
|
232
|
-
# header parameters
|
233
|
-
header_params = {}
|
234
|
-
# HTTP header 'Accept' (if needed)
|
235
|
-
header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml'])
|
236
|
-
# HTTP header 'Content-Type'
|
237
|
-
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])
|
238
|
-
|
239
|
-
# form parameters
|
240
|
-
form_params = {}
|
241
|
-
|
242
|
-
# http body (model)
|
243
|
-
post_body = @api_client.object_to_http_body(request.body)
|
244
|
-
data, status_code, headers = @api_client.call_api(:PUT, local_var_path,
|
245
|
-
header_params: header_params,
|
246
|
-
query_params: query_params,
|
247
|
-
form_params: form_params,
|
248
|
-
body: post_body,
|
249
|
-
access_token: get_access_token,
|
250
|
-
return_type: 'File')
|
251
|
-
if @api_client.config.debugging
|
252
|
-
@api_client.config.logger.debug "API called:
|
253
|
-
AnnotationApi#put_export\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
254
|
-
end
|
255
|
-
[data, status_code, headers]
|
256
|
-
end
|
257
|
-
|
258
|
-
#
|
259
|
-
# Helper method to convert first letter to downcase
|
260
|
-
#
|
261
|
-
private def downcase_first_letter(str)
|
262
|
-
value = str[0].downcase + str[1..-1]
|
263
|
-
value
|
264
|
-
end
|
265
|
-
|
266
|
-
#
|
267
|
-
# Retrieves access token
|
268
|
-
#
|
269
|
-
private def get_access_token
|
270
|
-
if @access_token.nil? then
|
271
|
-
request_access_token
|
272
|
-
else
|
273
|
-
access_token_expired = @access_token_expires_at < DateTime.now
|
274
|
-
if access_token_expired then
|
275
|
-
reset_access_token
|
276
|
-
end
|
277
|
-
end
|
278
|
-
|
279
|
-
@access_token
|
280
|
-
end
|
281
|
-
|
282
|
-
#
|
283
|
-
# Gets a access token from server
|
284
|
-
#
|
285
|
-
private def request_access_token
|
286
|
-
auth_config = Configuration.new(@config.app_sid, @config.app_key)
|
287
|
-
auth_config.api_base_url = @config.api_base_url
|
288
|
-
auth_config.debugging = @config.debugging
|
289
|
-
auth_config.logger = @config.logger
|
290
|
-
auth_config.temp_folder_path = @config.temp_folder_path
|
291
|
-
auth_config.client_side_validation = @config.client_side_validation
|
292
|
-
auth_config.api_version = ''
|
293
|
-
|
294
|
-
auth_api_client = ApiClient.new(auth_config)
|
295
|
-
|
296
|
-
request_url = "/oauth2/token"
|
297
|
-
post_data = "grant_type=client_credentials&client_id=#{@config.app_sid}&client_secret=#{@config.app_key}"
|
298
|
-
|
299
|
-
data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
|
300
|
-
|
301
|
-
@access_token = data[:access_token]
|
302
|
-
@refresh_token = data[:refresh_token]
|
303
|
-
|
304
|
-
expires_in_seconds = data[:expires_in].to_i - 5 * 60
|
305
|
-
expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
|
306
|
-
@access_token_expires_at = DateTime.now + expires_in_days
|
307
|
-
end
|
308
|
-
|
309
|
-
#
|
310
|
-
# Resets access token
|
311
|
-
#
|
312
|
-
private def reset_access_token
|
313
|
-
auth_config = Configuration.new(@config.app_sid, @config.app_key)
|
314
|
-
auth_config.api_base_url = @config.api_base_url
|
315
|
-
auth_config.debugging = @config.debugging
|
316
|
-
auth_config.logger = @config.logger
|
317
|
-
auth_config.temp_folder_path = @config.temp_folder_path
|
318
|
-
auth_config.client_side_validation = @config.client_side_validation
|
319
|
-
auth_config.api_version = ''
|
320
|
-
|
321
|
-
auth_api_client = ApiClient.new(auth_config)
|
322
|
-
|
323
|
-
request_url = "/oauth2/token"
|
324
|
-
post_data = "grant_type=refresh_token&refresh_token=#{@refresh_token}"
|
325
|
-
|
326
|
-
data, _status_code, _header = auth_api_client.call_api(:POST, request_url, :body => post_data, :return_type => 'Object')
|
327
|
-
|
328
|
-
@access_token = data[:access_token]
|
329
|
-
@refresh_token = data[:refresh_token]
|
330
|
-
|
331
|
-
expires_in_seconds = data[:expires_in].to_i - 5 * 60
|
332
|
-
expires_in_days = Rational(expires_in_seconds, 60 * 60 * 24)
|
333
|
-
@access_token_expires_at = DateTime.now + expires_in_days
|
334
|
-
end
|
335
|
-
|
336
|
-
# requires all files inside a directory from current dir
|
337
|
-
# @param _dir can be relative path like '/lib' or "../lib"
|
338
|
-
private def require_all(_dir)
|
339
|
-
Dir[File.expand_path(File.join(File.dirname(File.absolute_path(__FILE__)), _dir)) + "/*.rb"].each do |file|
|
340
|
-
require file
|
341
|
-
end
|
342
|
-
end
|
343
|
-
end
|
344
|
-
end
|