class AsposeWordsCloud::Configuration
Class for storing API configuration info
Attributes
Defines the access token (Bearer) used with OAuth2.
Defines base url
Defines API keys used with API Key authentications.
@return [Hash] key: parameter name, value: parameter value (API key)
@example parameter name is “ClientSecret”, client secret is “xxx” (e.g. “ClientSecret=xxx” in query string)
config.client_data['ClientSecret'] = 'xxx'
Defines API key prefixes used with API Key authentications.
@return [Hash] key: parameter name, value: API key prefix
@example parameter name is “Authorization”, API key prefix is “Token” (e.g. “Authorization: Token xxx” in headers)
config.client_data_prefix['client_secret'] = 'Token'
Set this to false to skip client side validation in the operation. Default to true. @return [true, false]
Set this to enable/disable debugging. When enabled (set to true), HTTP request/response details will be logged with ‘logger.debug` (see the `logger` attribute). Default to false.
@return [true, false]
Defines encryptor
Defines RSA key data
Defines the logger used for debugging. Default to ‘Rails.logger` (when in Rails) or logging to STDOUT.
@return [#debug]
Defines the password used with HTTP basic authentication.
@return [String]
Defines the refresh token (Bearer) used with OAuth2.
Defines the temporary folder to store downloaded files (for API endpoints that have file response). Default to use ‘Tempfile`.
@return [String]
Defines request timeout
Defines the username used with HTTP basic authentication.
@return [String]
Public Class Methods
Source
# File lib/aspose_words_cloud/configuration.rb, line 117 def self.default @@default ||= Configuration.new end
The default Configuration
object.
Source
# File lib/aspose_words_cloud/configuration.rb, line 103 def initialize @baseUrl = "https://api.aspose.cloud" @api_version = "/v4.0/" @client_data = {} @client_data_prefix = {} @client_side_validation = true @debugging = false @logger = defined?(Rails) ? Rails.logger : Logger.new(STDOUT) @timeout = 60 yield(self) if block_given? end
Public Instance Methods
Source
# File lib/aspose_words_cloud/configuration.rb, line 152 def auth_settings { 'JWT' => { type: 'oauth2', in: 'header', key: 'Authorization', value: "Bearer #{access_token}" }, } end
Returns Auth Settings hash for api client.
Source
# File lib/aspose_words_cloud/configuration.rb, line 147 def basic_auth_token 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") end
Gets Basic Auth token string
Source
# File lib/aspose_words_cloud/configuration.rb, line 138 def client_data_with_prefix(param_name) if @client_data_prefix[param_name] "#{@client_data_prefix[param_name]} #{@client_data[param_name]}" else @client_data[param_name] end end
Gets API key (with prefix if set). @param [String] param_name the parameter name of API key auth
Source
# File lib/aspose_words_cloud/configuration.rb, line 122 def configure yield(self) if block_given? end
yield self
Source
# File lib/aspose_words_cloud/configuration.rb, line 127 def getFullUrl(path, withoutVersion) if withoutVersion return URI.join(baseUrl, path).to_s end p = URI::Parser.new URI.join(baseUrl, "/v4.0/", p.escape(path)).to_s end
returns base url