Class: LokaliseRails::TaskDefinition::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/lokalise_rails/task_definition/base.rb

Direct Known Subclasses

Exporter, Importer

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_clientLokalise::Client

Creates a Lokalise API client

Returns:

  • (Lokalise::Client)


15
16
17
# File 'lib/lokalise_rails/task_definition/base.rb', line 15

def api_client
  @api_client ||= ::Lokalise.client LokaliseRails.api_token, LokaliseRails.timeouts
end

Class Method Details

.opt_errorsObject

Checks task options

Returns:

  • Array



28
29
30
31
32
33
# File 'lib/lokalise_rails/task_definition/base.rb', line 28

def opt_errors
  errors = []
  errors << 'Project ID is not set! Aborting...' if LokaliseRails.project_id.nil? || LokaliseRails.project_id.empty?
  errors << 'Lokalise API token is not set! Aborting...' if LokaliseRails.api_token.nil? || LokaliseRails.api_token.empty?
  errors
end

.reset_api_client!Object

Resets API client



20
21
22
23
# File 'lib/lokalise_rails/task_definition/base.rb', line 20

def reset_api_client!
  Lokalise.reset_client!
  @api_client = nil
end