Class: Crowdin::Configuration
- Inherits:
-
Object
- Object
- Crowdin::Configuration
- Defined in:
- lib/crowdin-api/client/configuration.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#enable_logger ⇒ Object
Returns the value of attribute enable_logger.
-
#organization_domain ⇒ Object
Returns the value of attribute organization_domain.
-
#project_id ⇒ Object
Returns the value of attribute project_id.
-
#target_api_url ⇒ Object
readonly
Returns the value of attribute target_api_url.
Instance Method Summary collapse
- #base_url ⇒ Object
- #headers ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
- #logger_enabled? ⇒ Boolean
- #options ⇒ Object
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
12 13 14 |
# File 'lib/crowdin-api/client/configuration.rb', line 12 def initialize @target_api_url = '/api/v2' end |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
5 6 7 |
# File 'lib/crowdin-api/client/configuration.rb', line 5 def api_token @api_token end |
#enable_logger ⇒ Object
Returns the value of attribute enable_logger.
8 9 10 |
# File 'lib/crowdin-api/client/configuration.rb', line 8 def enable_logger @enable_logger end |
#organization_domain ⇒ Object
Returns the value of attribute organization_domain.
7 8 9 |
# File 'lib/crowdin-api/client/configuration.rb', line 7 def organization_domain @organization_domain end |
#project_id ⇒ Object
Returns the value of attribute project_id.
6 7 8 |
# File 'lib/crowdin-api/client/configuration.rb', line 6 def project_id @project_id end |
#target_api_url ⇒ Object (readonly)
Returns the value of attribute target_api_url.
10 11 12 |
# File 'lib/crowdin-api/client/configuration.rb', line 10 def target_api_url @target_api_url end |
Instance Method Details
#base_url ⇒ Object
33 34 35 |
# File 'lib/crowdin-api/client/configuration.rb', line 33 def base_url organization_domain ? "https://#{organization_domain}.api.crowdin.com" : 'https://api.crowdin.com' end |
#headers ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/crowdin-api/client/configuration.rb', line 24 def headers { 'Accept' => 'application/json', 'Authorization' => "Bearer #{api_token}", 'Content-Type' => 'application/json', 'User-Agent' => "crowdin-rb/#{Crowdin::Client::VERSION}/#{RUBY_VERSION}/#{RUBY_PLATFORM}" } end |
#logger_enabled? ⇒ Boolean
37 38 39 |
# File 'lib/crowdin-api/client/configuration.rb', line 37 def logger_enabled? enable_logger end |
#options ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/crowdin-api/client/configuration.rb', line 16 def { headers: {}, timeout: nil, json: true } end |