groupdocs_metadata_cloud 26.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. checksums.yaml +7 -0
  2. data/lib/groupdocs_metadata_cloud/api/file_api.rb +729 -0
  3. data/lib/groupdocs_metadata_cloud/api/folder_api.rb +694 -0
  4. data/lib/groupdocs_metadata_cloud/api/info_api.rb +363 -0
  5. data/lib/groupdocs_metadata_cloud/api/metadata_api.rb +508 -0
  6. data/lib/groupdocs_metadata_cloud/api/storage_api.rb +541 -0
  7. data/lib/groupdocs_metadata_cloud/api_client.rb +379 -0
  8. data/lib/groupdocs_metadata_cloud/api_client_error.rb +71 -0
  9. data/lib/groupdocs_metadata_cloud/configuration.rb +95 -0
  10. data/lib/groupdocs_metadata_cloud/models/add_options.rb +236 -0
  11. data/lib/groupdocs_metadata_cloud/models/add_property.rb +234 -0
  12. data/lib/groupdocs_metadata_cloud/models/add_result.rb +239 -0
  13. data/lib/groupdocs_metadata_cloud/models/disc_usage.rb +234 -0
  14. data/lib/groupdocs_metadata_cloud/models/error.rb +244 -0
  15. data/lib/groupdocs_metadata_cloud/models/error_details.rb +229 -0
  16. data/lib/groupdocs_metadata_cloud/models/extract_options.rb +224 -0
  17. data/lib/groupdocs_metadata_cloud/models/extract_result.rb +226 -0
  18. data/lib/groupdocs_metadata_cloud/models/file_info.rb +224 -0
  19. data/lib/groupdocs_metadata_cloud/models/file_type.rb +234 -0
  20. data/lib/groupdocs_metadata_cloud/models/file_version.rb +289 -0
  21. data/lib/groupdocs_metadata_cloud/models/file_versions.rb +216 -0
  22. data/lib/groupdocs_metadata_cloud/models/files_list.rb +216 -0
  23. data/lib/groupdocs_metadata_cloud/models/files_upload_result.rb +228 -0
  24. data/lib/groupdocs_metadata_cloud/models/format.rb +224 -0
  25. data/lib/groupdocs_metadata_cloud/models/formats_result.rb +216 -0
  26. data/lib/groupdocs_metadata_cloud/models/info_options.rb +214 -0
  27. data/lib/groupdocs_metadata_cloud/models/info_result.rb +259 -0
  28. data/lib/groupdocs_metadata_cloud/models/match_options.rb +234 -0
  29. data/lib/groupdocs_metadata_cloud/models/metadata_package.rb +238 -0
  30. data/lib/groupdocs_metadata_cloud/models/metadata_property.rb +256 -0
  31. data/lib/groupdocs_metadata_cloud/models/name_options.rb +224 -0
  32. data/lib/groupdocs_metadata_cloud/models/object_exist.rb +234 -0
  33. data/lib/groupdocs_metadata_cloud/models/remove_options.rb +234 -0
  34. data/lib/groupdocs_metadata_cloud/models/remove_result.rb +239 -0
  35. data/lib/groupdocs_metadata_cloud/models/search_criteria.rb +234 -0
  36. data/lib/groupdocs_metadata_cloud/models/search_criteria_without_value.rb +224 -0
  37. data/lib/groupdocs_metadata_cloud/models/set_options.rb +236 -0
  38. data/lib/groupdocs_metadata_cloud/models/set_property.rb +234 -0
  39. data/lib/groupdocs_metadata_cloud/models/set_result.rb +239 -0
  40. data/lib/groupdocs_metadata_cloud/models/storage_exist.rb +219 -0
  41. data/lib/groupdocs_metadata_cloud/models/storage_file.rb +264 -0
  42. data/lib/groupdocs_metadata_cloud/models/tag.rb +224 -0
  43. data/lib/groupdocs_metadata_cloud/models/tag_options.rb +224 -0
  44. data/lib/groupdocs_metadata_cloud/models/tags_options.rb +214 -0
  45. data/lib/groupdocs_metadata_cloud/models/tags_result.rb +214 -0
  46. data/lib/groupdocs_metadata_cloud/models/value_options.rb +224 -0
  47. data/lib/groupdocs_metadata_cloud/version.rb +29 -0
  48. data/lib/groupdocs_metadata_cloud.rb +76 -0
  49. metadata +144 -0
@@ -0,0 +1,379 @@
1
+ # -----------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="api_client.rb">
3
+ # Copyright (c) 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 'date'
27
+ require 'json'
28
+ require 'logger'
29
+ require 'tempfile'
30
+ require 'faraday'
31
+ require 'addressable'
32
+ require_relative 'version'
33
+ require_relative 'api_client_error'
34
+
35
+ module GroupDocsMetadataCloud
36
+ #
37
+ # api client is mainly responsible for making the HTTP call to the API backend.
38
+ #
39
+ class ApiClient
40
+ # The Configuration object holding settings to be used in the API client.
41
+ attr_accessor :config
42
+
43
+ # Defines the headers to be used in HTTP requests of all API calls by default.
44
+ #
45
+ # @return [Hash]
46
+ attr_accessor :default_headers
47
+
48
+ # Initializes the ApiClient
49
+ # @option config [Configuration] Configuration for initializing the object
50
+ def initialize(config)
51
+ @config = config
52
+ @default_headers = {
53
+ 'Content-Type' => config.api_version == '' ? "application/x-www-form-urlencoded" : "application/json",
54
+ 'x-groupdocs-client' => "ruby sdk",
55
+ 'x-groupdocs-version' => GroupDocsMetadataCloud::VERSION.to_s
56
+ }
57
+ end
58
+
59
+ # Call an API with given options.
60
+ #
61
+ # @return [Array<(Object, Fixnum, Hash)>] an array of 3 elements:
62
+ # the data deserialized from response body (could be nil), response status code and response headers.
63
+ def call_api(http_method, path, opts = {})
64
+ response = build_request(http_method, path, opts)
65
+ download_file response if opts[:return_type] == 'File'
66
+ if @config.debugging
67
+ @config.logger.debug "'HTTP' response body '~BEGIN~'\n #{response.body}\n'~END~'\n"
68
+ end
69
+
70
+ unless response.success?
71
+ raise ApiClientError.new(:code => response.status, :response_body => response.body)
72
+ end
73
+
74
+ data = deserialize(response, opts[:return_type]) if opts[:return_type]
75
+ [data, response.status, response.headers]
76
+ end
77
+
78
+ # Builds the HTTP request
79
+ #
80
+ # @param [String] http_method HTTP method/verb (e.g. POST)
81
+ # @param [String] path URL path (e.g. /account/new)
82
+ # @option opts [Hash] :header_params Header parameters
83
+ # @option opts [Hash] :query_params Query parameters
84
+ # @option opts [Hash] :form_params Query parameters
85
+ # @option opts [Object] :body HTTP body (JSON/XML)
86
+ # @return [Faraday::Response] A Faraday Response
87
+ def build_request(http_method, path, opts = {})
88
+ url = build_request_url(path)
89
+ http_method = http_method.to_sym.downcase
90
+
91
+ header_params = @default_headers.merge(opts[:header_params] || {})
92
+ query_params = opts[:query_params] || {}
93
+ form_params = opts[:form_params] || {}
94
+ body = opts[:body] if opts[:body] || nil?
95
+
96
+ update_params_for_oauth! header_params, opts[:access_token]
97
+
98
+ req_opts = {
99
+ :method => http_method,
100
+ :headers => header_params,
101
+ :params => query_params,
102
+ :body => body
103
+ }
104
+
105
+ if [:post, :patch, :put, :delete].include?(http_method)
106
+ req_body = build_request_body(header_params, form_params, opts[:body])
107
+ req_opts.update :body => req_body
108
+ if @config.debugging
109
+ @config.logger.debug "HTTP request body param ~BEGIN~\n#{req_body}\n~END~\n"
110
+ end
111
+ end
112
+
113
+ conn = Faraday.new url, { :params => query_params, :headers => header_params } do |f|
114
+ f.request :multipart
115
+ f.request :url_encoded
116
+ f.adapter Faraday.default_adapter
117
+ end
118
+
119
+ case http_method
120
+ when :post
121
+ return conn.post url, req_opts[:body]
122
+ when :put
123
+ return conn.put url, req_opts[:body]
124
+ when :get
125
+ return conn.get url, req_opts[:body]
126
+ else
127
+ return conn.delete url do |c|
128
+ c.body = req_opts[:body]
129
+ end
130
+ end
131
+ end
132
+
133
+ # Check if the given MIME is a JSON MIME.
134
+ # JSON MIME examples:
135
+ # application/json
136
+ # application/json; charset=UTF8
137
+ # APPLICATION/JSON
138
+ # */*
139
+ # @param [String] mime MIME
140
+ # @return [Boolean] True if the MIME is application/json
141
+ def json_mime?(mime)
142
+ (mime == "*/*") || !(mime =~ /Application\/.*json(?!p)(;.*)?/i).nil?
143
+ end
144
+
145
+ # Deserialize the response to the given return type.
146
+ #
147
+ # @param [Response] response HTTP response
148
+ # @param [String] return_type some examples: "User", "Array[User]", "Hash[String,Integer]"
149
+ def deserialize(response, return_type)
150
+ body = response.body
151
+
152
+ # handle file downloading - return the File instance processed in request callbacks
153
+ # note that response body is empty when the file is written in chunks in request on_body callback
154
+ return @tempfile if return_type == 'File'
155
+
156
+ return nil if body.nil? || body.empty?
157
+
158
+ # return response body directly for String return type
159
+ return body if return_type == 'String'
160
+
161
+ # ensuring a default content type
162
+ content_type = response.headers['Content-Type'] || 'application/json'
163
+
164
+ raise "Content-Type is not supported: #{content_type}" unless json_mime?(content_type)
165
+
166
+ begin
167
+ data = JSON.parse("[#{body}]", :symbolize_names => true)[0]
168
+ rescue JSON::MetadataError => e
169
+ if %w[String Date DateTime].include?(return_type)
170
+ data = body
171
+ else
172
+ raise e
173
+ end
174
+ end
175
+
176
+ convert_to_type data, return_type
177
+ end
178
+
179
+ # Convert data to the given return type.
180
+ # @param [Object] data Data to be converted
181
+ # @param [String] return_type Return type
182
+ # @return [Mixed] Data in a particular type
183
+ def convert_to_type(data, return_type)
184
+ return nil if data.nil?
185
+ case return_type
186
+ when 'String'
187
+ data.to_s
188
+ when 'Integer'
189
+ data.to_i
190
+ when 'Float'
191
+ data.to_f
192
+ when 'BOOLEAN'
193
+ data == true
194
+ when 'DateTime'
195
+ # parse date time (expecting ISO 8601 format)
196
+ DateTime.parse data
197
+ when 'Date'
198
+ # parse date time (expecting ISO 8601 format)
199
+ Date.parse data
200
+ when 'Object'
201
+ # generic object (usually a Hash), return directly
202
+ data
203
+ when /\AArray<(.+)>\z/
204
+ # e.g. Array<Pet>
205
+ sub_type = $1
206
+ data.map {|item| convert_to_type(item, sub_type) }
207
+ when /\AHash\<String, (.+)\>\z/
208
+ # e.g. Hash<String, Integer>
209
+ sub_type = $1
210
+ {}.tap do |hash|
211
+ data.each {|k, v| hash[k] = convert_to_type(v, sub_type) }
212
+ end
213
+ else
214
+ # models, e.g. Pet
215
+ GroupDocsMetadataCloud.const_get(return_type).new.tap do |model|
216
+ model.build_from_hash data
217
+ end
218
+ end
219
+ end
220
+
221
+ # Save response body into a file in (the defined) temporary folder, using the filename
222
+ # from the "Content-Disposition" header if provided, otherwise a random filename.
223
+ # The response body is written to the file in chunks in order to handle files which
224
+ # size is larger than maximum Ruby String or even larger than the maximum memory a Ruby
225
+ # process can use.
226
+ #
227
+ # @see Configuration#temp_folder_path
228
+ def download_file(response)
229
+ tempfile = nil
230
+ encoding = nil
231
+ content_disposition = response.headers['Content-Disposition']
232
+ if content_disposition and content_disposition =~ /filename=/i
233
+ filename = content_disposition[/filename=['"]?([^'"\s]+)['"]?/, 1]
234
+ prefix = sanitize_filename(filename)
235
+ else
236
+ prefix = 'download-'
237
+ end
238
+ prefix += '-' unless prefix.end_with?('-')
239
+ encoding = response.body.encoding
240
+ tempfile = Tempfile.open(prefix, @config.temp_folder_path, encoding: encoding)
241
+ @tempfile = tempfile
242
+ tempfile.write(response.body)
243
+ response.on_complete do |resp|
244
+ tempfile.close
245
+ @config.logger.info "Temp file written to #{tempfile.path}, please copy the file to a proper folder "\
246
+ "with e.g. `FileUtils.cp(tempfile.path, '/new/file/path')` otherwise the temp file "\
247
+ "will be deleted automatically with GC. It's also recommended to delete the temp file "\
248
+ "explicitly with `tempfile.delete`"
249
+ end
250
+ end
251
+
252
+ # Sanitize filename by removing path.
253
+ # e.g. ../../sun.gif becomes sun.gif
254
+ #
255
+ # @param [String] filename the filename to be sanitized
256
+ # @return [String] the sanitized filename
257
+ def sanitize_filename(filename)
258
+ filename.gsub(/.*[\/\\]/, '')
259
+ end
260
+
261
+ def build_request_url(path)
262
+ # Add leading and trailing slashes to path
263
+ path = "/#{path}".gsub(/\/+/, '/')
264
+ Addressable::URI.encode(@config.api_base_url + @config.api_version + path)
265
+ end
266
+
267
+ # Builds the HTTP request body
268
+ #
269
+ # @param [Hash] header_params Header parameters
270
+ # @param [Hash] form_params Query parameters
271
+ # @param [Object] body HTTP body (JSON/XML)
272
+ # @return [String] HTTP body data in the form of string
273
+ def build_request_body(header_params, form_params, body)
274
+ # http form
275
+ if body
276
+ data = body.is_a?(String) ? body : body.to_json
277
+ elsif header_params['Content-Type'] == 'application/x-www-form-urlencoded' ||
278
+ header_params['Content-Type'] == 'multipart/form-data'
279
+ data = {}
280
+ form_params.each do |key, value|
281
+ case value
282
+ when ::File
283
+ data[key] = Faraday::UploadIO.new(value.path, "application/octet-stream", key)
284
+ when ::Array, nil
285
+ data[key] = value
286
+ else
287
+ data[key] = value.to_s
288
+ end
289
+ end
290
+ else
291
+ data = nil
292
+ end
293
+ data
294
+ end
295
+
296
+ # Update hearder and query params based on authentication settings.
297
+ #
298
+ # @param [Hash] header_params Header parameters
299
+ # @param [String] access_token OAuth access token
300
+ def update_params_for_oauth!(header_params, access_token)
301
+ header_params["Authorization"] = "Bearer #{access_token}"
302
+ end
303
+
304
+ # Sets user agent in HTTP header
305
+ #
306
+ # @param [String] user_agent User agent (e.g. swagger-codegen/ruby/1.0.0)
307
+ def user_agent=(user_agent)
308
+ @user_agent = user_agent
309
+ @default_headers['User-Agent'] = @user_agent
310
+ end
311
+
312
+ # Return Accept header based on an array of accepts provided.
313
+ # @param [Array] accepts array for Accept
314
+ # @return [String] the Accept header (e.g. application/json)
315
+ def select_header_accept(accepts)
316
+ return nil if accepts.nil? || accepts.empty?
317
+ # use JSON when present, otherwise use all of the provided
318
+ json_accept = accepts.find { |s| json_mime?(s) }
319
+ return json_accept || accepts.join(',')
320
+ end
321
+
322
+ # Return Content-Type header based on an array of content types provided.
323
+ # @param [Array] content_types array for Content-Type
324
+ # @return [String] the Content-Type header (e.g. application/json)
325
+ def select_header_content_type(content_types)
326
+ # use application/json by default
327
+ return 'application/json' if content_types.nil? || content_types.empty?
328
+ # use JSON when present, otherwise use the first one
329
+ json_content_type = content_types.find { |s| json_mime?(s) }
330
+ return json_content_type || content_types.first
331
+ end
332
+
333
+ # Convert object (array, hash, object, etc) to JSON string.
334
+ # @param [Object] model object to be converted into JSON string
335
+ # @return [String] JSON string representation of the object
336
+ def object_to_http_body(model)
337
+ return '"' + model + '"' if model.is_a?(String)
338
+ return model if model.nil?
339
+ local_body = nil
340
+ if model.is_a?(Array)
341
+ local_body = model.map { |m| object_to_hash(m) }
342
+ else
343
+ local_body = object_to_hash(model)
344
+ end
345
+ local_body.to_json
346
+ end
347
+
348
+ # Convert object(non-array) to hash.
349
+ # @param [Object] obj object to be converted into JSON string
350
+ # @return [String] JSON string representation of the object
351
+ def object_to_hash(obj)
352
+ if obj.respond_to?(:to_hash)
353
+ obj.to_hash
354
+ else
355
+ obj
356
+ end
357
+ end
358
+
359
+ # Build parameter value according to the given collection format.
360
+ # @param [String] collection_format one of :csv, :ssv, :tsv, :pipes and :multi
361
+ def build_collection_param(param, collection_format)
362
+ case collection_format
363
+ when :csv
364
+ param.join(',')
365
+ when :ssv
366
+ param.join(' ')
367
+ when :tsv
368
+ param.join("\t")
369
+ when :pipes
370
+ param.join('|')
371
+ when :multi
372
+ # return the array directly as faraday will handle it as expected
373
+ param
374
+ else
375
+ raise "unknown collection format: #{collection_format.inspect}"
376
+ end
377
+ end
378
+ end
379
+ end
@@ -0,0 +1,71 @@
1
+ # -----------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="api_error.rb">
3
+ # Copyright (c) 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
+ module GroupDocsMetadataCloud
27
+ #
28
+ # ApiClientError class for error handling
29
+ #
30
+ class ApiClientError < StandardError
31
+ attr_reader :code
32
+ attr_reader :message
33
+
34
+ # Usage examples:
35
+ # ApiClientError.new
36
+ # ApiClientError.new(:code => 500, :response_body => "")
37
+ def initialize(arg = nil)
38
+ if arg.is_a? Hash
39
+
40
+ if arg.key?(:response_body) then
41
+ data = JSON.parse(arg[:response_body], :symbolize_names => true)
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
59
+ end
60
+ end
61
+
62
+ if arg.key?(:arg) then
63
+ @code = arg[:Code]
64
+ end
65
+
66
+ else
67
+ super arg
68
+ end
69
+ end
70
+ end
71
+ end
@@ -0,0 +1,95 @@
1
+ # ------------------------------------------------------------------------------------
2
+ # <copyright company="Aspose Pty Ltd" file="configuration.rb">
3
+ # Copyright (c) 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
+ module GroupDocsMetadataCloud
27
+ #
28
+ # Class for storing API configuration info
29
+ #
30
+ class Configuration
31
+
32
+ # Api base url, default is 'https://api.groupdocs.cloud'
33
+ #
34
+ # @return [String] Api base url
35
+ attr_accessor :api_base_url
36
+
37
+ # Api version, default is '/v1.0'
38
+ #
39
+ # @return [String] Api version
40
+ attr_accessor :api_version
41
+
42
+ # Application identifier (App SID)
43
+ #
44
+ # @return [String] Application identifier (App SID)
45
+ attr_accessor :app_sid
46
+
47
+ # Application private key (App Key)
48
+ #
49
+ # @return [String] Application private key (App Key)
50
+ attr_accessor :app_key
51
+
52
+ # Set this to enable/disable debugging. When enabled (set to true), HTTP request/response
53
+ # details will be logged with `logger.debug` (see the `logger` attribute).
54
+ # Default value is false.
55
+ #
56
+ # @return [true, false]
57
+ attr_accessor :debugging
58
+
59
+ # Defines the logger used for debugging.
60
+ # Default to `Rails.logger` (when in Rails) or logging to STDOUT.
61
+ #
62
+ # @return [#logger]
63
+ attr_accessor :logger
64
+
65
+ # Defines the temporary folder to store downloaded files
66
+ # (for API endpoints that have file response).
67
+ # System temporary folder is used by default.
68
+ #
69
+ # @return [String]
70
+ attr_accessor :temp_folder_path
71
+
72
+ # Set this to false to skip client side validation in the operation.
73
+ # Default to true.
74
+ # @return [true, false]
75
+ attr_accessor :client_side_validation
76
+
77
+ # Initializes new instance of Configuration
78
+ #
79
+ # @param [app_sid] Application identifier (App SID)
80
+ # @param [app_key] Application private key (App Key)
81
+ # @return [Configuration] New instance of Configuration
82
+ def initialize(app_sid, app_key)
83
+ @api_base_url = "https://api.groupdocs.cloud"
84
+ @api_version = '/v1.0'
85
+ @app_sid = app_sid
86
+ @app_key = app_key
87
+ @client_side_validation = true
88
+ @debugging = false
89
+ @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT)
90
+
91
+ yield(self) if block_given?
92
+ end
93
+
94
+ end
95
+ end