Class: AsposeWordsCloud::Configuration
- Inherits:
-
Object
- Object
- AsposeWordsCloud::Configuration
- Defined in:
- lib/aspose_words_cloud/configuration.rb
Overview
Class for storing API configuration info
Instance Attribute Summary collapse
-
#access_token ⇒ Object
Defines the access token (Bearer) used with OAuth2.
-
#baseUrl ⇒ Object
Defines base url.
-
#client_data ⇒ Hash
Defines API keys used with API Key authentications.
-
#client_data_prefix ⇒ Hash
Defines API key prefixes used with API Key authentications.
-
#client_side_validation ⇒ true, false
Set this to false to skip client side validation in the operation.
-
#debugging ⇒ true, false
Set this to enable/disable debugging.
-
#encryptor ⇒ Object
Defines encryptor.
-
#exponent ⇒ Object
Defines RSA key data.
-
#logger ⇒ #debug
Defines the logger used for debugging.
-
#modulus ⇒ Object
Returns the value of attribute modulus.
-
#password ⇒ String
Defines the password used with HTTP basic authentication.
-
#refresh_token ⇒ Object
Defines the refresh token (Bearer) used with OAuth2.
-
#temp_folder_path ⇒ String
Defines the temporary folder to store downloaded files (for API endpoints that have file response).
-
#timeout ⇒ Object
Defines request timeout.
-
#username ⇒ String
Defines the username used with HTTP basic authentication.
Class Method Summary collapse
-
.default ⇒ Object
The default Configuration object.
Instance Method Summary collapse
-
#auth_settings ⇒ Object
Returns Auth Settings hash for api client.
-
#basic_auth_token ⇒ Object
Gets Basic Auth token string.
-
#client_data_with_prefix(param_name) ⇒ Object
Gets API key (with prefix if set).
-
#configure {|_self| ... } ⇒ Object
yield self.
-
#getFullUrl(path, withoutVersion) ⇒ Object
returns base url.
-
#initialize {|_self| ... } ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize {|_self| ... } ⇒ Configuration
Returns a new instance of Configuration.
103 104 105 106 107 108 109 110 111 112 113 114 |
# 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 |
Instance Attribute Details
#access_token ⇒ Object
Defines the access token (Bearer) used with OAuth2.
63 64 65 |
# File 'lib/aspose_words_cloud/configuration.rb', line 63 def access_token @access_token end |
#baseUrl ⇒ Object
Defines base url
34 35 36 |
# File 'lib/aspose_words_cloud/configuration.rb', line 34 def baseUrl @baseUrl end |
#client_data ⇒ Hash
Defines API keys used with API Key authentications.
42 43 44 |
# File 'lib/aspose_words_cloud/configuration.rb', line 42 def client_data @client_data end |
#client_data_prefix ⇒ Hash
Defines API key prefixes used with API Key authentications.
50 51 52 |
# File 'lib/aspose_words_cloud/configuration.rb', line 50 def client_data_prefix @client_data_prefix end |
#client_side_validation ⇒ true, false
Set this to false to skip client side validation in the operation. Default to true.
91 92 93 |
# File 'lib/aspose_words_cloud/configuration.rb', line 91 def client_side_validation @client_side_validation end |
#debugging ⇒ 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.
73 74 75 |
# File 'lib/aspose_words_cloud/configuration.rb', line 73 def debugging @debugging end |
#encryptor ⇒ Object
Defines encryptor
98 99 100 |
# File 'lib/aspose_words_cloud/configuration.rb', line 98 def encryptor @encryptor end |
#exponent ⇒ Object
Defines RSA key data
94 95 96 |
# File 'lib/aspose_words_cloud/configuration.rb', line 94 def exponent @exponent end |
#logger ⇒ #debug
Defines the logger used for debugging. Default to ‘Rails.logger` (when in Rails) or logging to STDOUT.
79 80 81 |
# File 'lib/aspose_words_cloud/configuration.rb', line 79 def logger @logger end |
#modulus ⇒ Object
Returns the value of attribute modulus.
95 96 97 |
# File 'lib/aspose_words_cloud/configuration.rb', line 95 def modulus @modulus end |
#password ⇒ String
Defines the password used with HTTP basic authentication.
60 61 62 |
# File 'lib/aspose_words_cloud/configuration.rb', line 60 def password @password end |
#refresh_token ⇒ Object
Defines the refresh token (Bearer) used with OAuth2.
66 67 68 |
# File 'lib/aspose_words_cloud/configuration.rb', line 66 def refresh_token @refresh_token end |
#temp_folder_path ⇒ String
Defines the temporary folder to store downloaded files (for API endpoints that have file response). Default to use ‘Tempfile`.
86 87 88 |
# File 'lib/aspose_words_cloud/configuration.rb', line 86 def temp_folder_path @temp_folder_path end |
#timeout ⇒ Object
Defines request timeout
101 102 103 |
# File 'lib/aspose_words_cloud/configuration.rb', line 101 def timeout @timeout end |
#username ⇒ String
Defines the username used with HTTP basic authentication.
55 56 57 |
# File 'lib/aspose_words_cloud/configuration.rb', line 55 def username @username end |
Class Method Details
.default ⇒ Object
The default Configuration object.
117 118 119 |
# File 'lib/aspose_words_cloud/configuration.rb', line 117 def self.default @@default ||= Configuration.new end |
Instance Method Details
#auth_settings ⇒ Object
Returns Auth Settings hash for api client.
152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/aspose_words_cloud/configuration.rb', line 152 def auth_settings { 'JWT' => { type: 'oauth2', in: 'header', key: 'Authorization', value: "Bearer #{access_token}" }, } end |
#basic_auth_token ⇒ Object
Gets Basic Auth token string
147 148 149 |
# File 'lib/aspose_words_cloud/configuration.rb', line 147 def basic_auth_token 'Basic ' + ["#{username}:#{password}"].pack('m').delete("\r\n") end |
#client_data_with_prefix(param_name) ⇒ Object
Gets API key (with prefix if set).
138 139 140 141 142 143 144 |
# 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 |
#configure {|_self| ... } ⇒ Object
yield self
122 123 124 |
# File 'lib/aspose_words_cloud/configuration.rb', line 122 def configure yield(self) if block_given? end |
#getFullUrl(path, withoutVersion) ⇒ Object
returns base url
127 128 129 130 131 132 133 134 |
# 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 |