Class: Crowdin::Client

Inherits:
Object
  • Object
show all
Extended by:
Utils
Defined in:
lib/crowdin-api/client/client.rb,
lib/crowdin-api/client/version.rb

Overview

Example

require 'crowdin-api'

crowdin = Crowdin::Client.new do |config|
  config.api_token = 'YOUR_API_TOKEN'
end

crowdin.list_projects

Constant Summary collapse

API_RESOURCES_MODULES =

API Resources modules

%i[Storages Languages Projects Workflows SourceFiles Translations SourceStrings
StringTranslations StringComments Screenshots Glossaries TranslationMemory
MachineTranslationEngines Reports Tasks Users Teams Vendors Webhooks
Dictionaries Distributions Labels TranslationStatus].freeze
ERROR_RAISERS_MODULES =

Error Raisers modules

%i[ApiErrorsRaiser ClientErrorsRaiser].freeze
VERSION =
'1.2.0'

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Utils

fetch_module_full_name_from_string

Constructor Details

#initialize(&block) ⇒ Client

Returns a new instance of Client.



49
50
51
52
53
54
55
56
# File 'lib/crowdin-api/client/client.rb', line 49

def initialize(&block)
  build_configuration(&block)

  check_logger
  check_rest_client_proxy

  build_connection
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



44
45
46
# File 'lib/crowdin-api/client/client.rb', line 44

def config
  @config
end

#connectionObject (readonly)

Returns the value of attribute connection.



45
46
47
# File 'lib/crowdin-api/client/client.rb', line 45

def connection
  @connection
end

#loggerObject

Returns the value of attribute logger.



47
48
49
# File 'lib/crowdin-api/client/client.rb', line 47

def logger
  @logger
end

#optionsObject (readonly)

Returns the value of attribute options.



46
47
48
# File 'lib/crowdin-api/client/client.rb', line 46

def options
  @options
end

Instance Method Details

#log!(message) ⇒ Object



58
59
60
# File 'lib/crowdin-api/client/client.rb', line 58

def log!(message)
  !config.logger_enabled? || logger.debug(message)
end