Class: GroupDocsSignatureCloud::StorageApi

Inherits:
Object
  • Object
show all
Defined in:
lib/groupdocs_signature_cloud/api/storage_api.rb

Overview

GroupDocs.Signature Cloud API

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ StorageApi

Initializes new instance of StorageApi

Parameters:



43
44
45
46
47
# File 'lib/groupdocs_signature_cloud/api/storage_api.rb', line 43

def initialize(config)
  @config = config
  @api_client = ApiClient.new(config)
  @access_token = nil
end

Instance Attribute Details

#configObject

Returns the value of attribute config.



34
35
36
# File 'lib/groupdocs_signature_cloud/api/storage_api.rb', line 34

def config
  @config
end

Class Method Details

.from_config(config) ⇒ StorageApi

Initializes new instance of StorageApi

Parameters:

Returns:



63
64
65
# File 'lib/groupdocs_signature_cloud/api/storage_api.rb', line 63

def self.from_config(config)
  return new(config)
end

.from_keys(app_sid, app_key) ⇒ StorageApi

Initializes new instance of StorageApi

Parameters:

  • Application (app_sid)

    identifier (App SID)

  • Application (app_key)

    private key (App Key)

Returns:



54
55
56
57
# File 'lib/groupdocs_signature_cloud/api/storage_api.rb', line 54

def self.from_keys(app_sid, app_key)
  config = Configuration.new(app_sid, app_key)
  return new(config)
end

Instance Method Details

#get_disc_usage(request) ⇒ DiscUsage

Get disc usage

Parameters:

  • request

    get_disc_usage_request

Returns:



71
72
73
74
# File 'lib/groupdocs_signature_cloud/api/storage_api.rb', line 71

def get_disc_usage(request)
  data, _status_code, _headers = get_disc_usage_with_http_info(request)
  data
end

#get_disc_usage_with_http_info(request) ⇒ Array<(DiscUsage, Fixnum, Hash)>

Get disc usage

DiscUsage data, response status code and response headers

Parameters:

  • request

    get_disc_usage_request

Returns:

Raises:

  • (ArgumentError)


81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/groupdocs_signature_cloud/api/storage_api.rb', line 81

def get_disc_usage_with_http_info(request)
  raise ArgumentError, 'Incorrect request type' unless request.is_a? GetDiscUsageRequest

  @api_client.config.logger.debug 'Calling API: StorageApi.get_disc_usage ...' if @api_client.config.debugging
  # resource path
  local_var_path = '/signature/storage/disc'

  # query parameters
  query_params = {}
  if local_var_path.include? ('{' + downcase_first_letter('storageName') + '}')
    local_var_path = local_var_path.sub('{' + downcase_first_letter('storageName') + '}', request.storage_name.to_s)
  else
    query_params[downcase_first_letter('storageName')] = request.storage_name unless request.storage_name.nil?
  end

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
                                                    header_params: header_params,
                                                    query_params: query_params,
                                                    form_params: form_params,
                                                    body: post_body,
                                                    access_token: get_access_token,
                                                    return_type: 'DiscUsage')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called:
    StorageApi#get_disc_usage\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#get_file_versions(request) ⇒ FileVersions

Get file versions

Parameters:

  • request

    get_file_versions_request

Returns:



126
127
128
129
# File 'lib/groupdocs_signature_cloud/api/storage_api.rb', line 126

def get_file_versions(request)
  data, _status_code, _headers = get_file_versions_with_http_info(request)
  data
end

#get_file_versions_with_http_info(request) ⇒ Array<(FileVersions, Fixnum, Hash)>

Get file versions

FileVersions data, response status code and response headers

Parameters:

  • request

    get_file_versions_request

Returns:

Raises:

  • (ArgumentError)


136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
# File 'lib/groupdocs_signature_cloud/api/storage_api.rb', line 136

def get_file_versions_with_http_info(request)
  raise ArgumentError, 'Incorrect request type' unless request.is_a? GetFileVersionsRequest

  @api_client.config.logger.debug 'Calling API: StorageApi.get_file_versions ...' if @api_client.config.debugging
  # verify the required parameter 'path' is set
  raise ArgumentError, 'Missing the required parameter path when calling StorageApi.get_file_versions' if @api_client.config.client_side_validation && request.path.nil?
  # resource path
  local_var_path = '/signature/storage/version/{path}'
  escaped = request.path.to_s.sub("\\", "\\\\\\\\")
  local_var_path = local_var_path.sub('{' + downcase_first_letter('path') + '}', escaped)

  # query parameters
  query_params = {}
  if local_var_path.include? ('{' + downcase_first_letter('storageName') + '}')
    local_var_path = local_var_path.sub('{' + downcase_first_letter('storageName') + '}', request.storage_name.to_s)
  else
    query_params[downcase_first_letter('storageName')] = request.storage_name unless request.storage_name.nil?
  end

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
                                                    header_params: header_params,
                                                    query_params: query_params,
                                                    form_params: form_params,
                                                    body: post_body,
                                                    access_token: get_access_token,
                                                    return_type: 'FileVersions')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called:
    StorageApi#get_file_versions\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#object_exists(request) ⇒ ObjectExist

Check if file or folder exists

Parameters:

  • request

    object_exists_request

Returns:



185
186
187
188
# File 'lib/groupdocs_signature_cloud/api/storage_api.rb', line 185

def object_exists(request)
  data, _status_code, _headers = object_exists_with_http_info(request)
  data
end

#object_exists_with_http_info(request) ⇒ Array<(ObjectExist, Fixnum, Hash)>

Check if file or folder exists

ObjectExist data, response status code and response headers

Parameters:

  • request

    object_exists_request

Returns:

Raises:

  • (ArgumentError)


195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
# File 'lib/groupdocs_signature_cloud/api/storage_api.rb', line 195

def object_exists_with_http_info(request)
  raise ArgumentError, 'Incorrect request type' unless request.is_a? ObjectExistsRequest

  @api_client.config.logger.debug 'Calling API: StorageApi.object_exists ...' if @api_client.config.debugging
  # verify the required parameter 'path' is set
  raise ArgumentError, 'Missing the required parameter path when calling StorageApi.object_exists' if @api_client.config.client_side_validation && request.path.nil?
  # resource path
  local_var_path = '/signature/storage/exist/{path}'
  escaped = request.path.to_s.sub("\\", "\\\\\\\\")
  local_var_path = local_var_path.sub('{' + downcase_first_letter('path') + '}', escaped)

  # query parameters
  query_params = {}
  if local_var_path.include? ('{' + downcase_first_letter('storageName') + '}')
    local_var_path = local_var_path.sub('{' + downcase_first_letter('storageName') + '}', request.storage_name.to_s)
  else
    query_params[downcase_first_letter('storageName')] = request.storage_name unless request.storage_name.nil?
  end
  if local_var_path.include? ('{' + downcase_first_letter('versionId') + '}')
    local_var_path = local_var_path.sub('{' + downcase_first_letter('versionId') + '}', request.version_id.to_s)
  else
    query_params[downcase_first_letter('versionId')] = request.version_id unless request.version_id.nil?
  end

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
                                                    header_params: header_params,
                                                    query_params: query_params,
                                                    form_params: form_params,
                                                    body: post_body,
                                                    access_token: get_access_token,
                                                    return_type: 'ObjectExist')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called:
    StorageApi#object_exists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end

#storage_exists(request) ⇒ StorageExist

Check if storage exists

Parameters:

  • request

    storage_exists_request

Returns:



249
250
251
252
# File 'lib/groupdocs_signature_cloud/api/storage_api.rb', line 249

def storage_exists(request)
  data, _status_code, _headers = storage_exists_with_http_info(request)
  data
end

#storage_exists_with_http_info(request) ⇒ Array<(StorageExist, Fixnum, Hash)>

Check if storage exists

StorageExist data, response status code and response headers

Parameters:

  • request

    storage_exists_request

Returns:

Raises:

  • (ArgumentError)


259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
# File 'lib/groupdocs_signature_cloud/api/storage_api.rb', line 259

def storage_exists_with_http_info(request)
  raise ArgumentError, 'Incorrect request type' unless request.is_a? StorageExistsRequest

  @api_client.config.logger.debug 'Calling API: StorageApi.storage_exists ...' if @api_client.config.debugging
  # verify the required parameter 'storage_name' is set
  raise ArgumentError, 'Missing the required parameter storage_name when calling StorageApi.storage_exists' if @api_client.config.client_side_validation && request.storage_name.nil?
  # resource path
  local_var_path = '/signature/storage/{storageName}/exist'
  escaped = request.storage_name.to_s.sub("\\", "\\\\\\\\")
  local_var_path = local_var_path.sub('{' + downcase_first_letter('storageName') + '}', escaped)

  # query parameters
  query_params = {}

  # header parameters
  header_params = {}
  # HTTP header 'Accept' (if needed)
  header_params['Accept'] = @api_client.select_header_accept(['application/json'])
  # HTTP header 'Content-Type'
  header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])

  # form parameters
  form_params = {}

  # http body (model)
  post_body = nil
  data, status_code, headers = @api_client.call_api(:GET, local_var_path,
                                                    header_params: header_params,
                                                    query_params: query_params,
                                                    form_params: form_params,
                                                    body: post_body,
                                                    access_token: get_access_token,
                                                    return_type: 'StorageExist')
  if @api_client.config.debugging
    @api_client.config.logger.debug "API called:
    StorageApi#storage_exists\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
  end
  [data, status_code, headers]
end