Class: LokaliseManager::TaskDefinitions::Base
- Inherits:
-
Object
- Object
- LokaliseManager::TaskDefinitions::Base
- Defined in:
- lib/lokalise_manager/task_definitions/base.rb
Overview
Base class for LokaliseManager task definitions, providing common methods and logic for importer and exporter classes. Handles API client interactions and configuration merging.
Instance Attribute Summary collapse
-
#config ⇒ Object
Returns the value of attribute config.
Instance Method Summary collapse
-
#api_client ⇒ RubyLokaliseApi::Client
Retrieves or creates a Lokalise API client based on configuration.
-
#initialize(custom_opts = {}, global_config = LokaliseManager::GlobalConfig) ⇒ Base
constructor
Initializes a new task object by merging custom and global configurations.
-
#reset_api_client! ⇒ Object
Resets API client.
Constructor Details
#initialize(custom_opts = {}, global_config = LokaliseManager::GlobalConfig) ⇒ Base
Initializes a new task object by merging custom and global configurations.
19 20 21 22 |
# File 'lib/lokalise_manager/task_definitions/base.rb', line 19 def initialize(custom_opts = {}, global_config = LokaliseManager::GlobalConfig) merged_opts = merge_configs(global_config, custom_opts) @config = build_config_class(merged_opts) end |
Instance Attribute Details
#config ⇒ Object
Returns the value of attribute config.
13 14 15 |
# File 'lib/lokalise_manager/task_definitions/base.rb', line 13 def config @config end |
Instance Method Details
#api_client ⇒ RubyLokaliseApi::Client
Retrieves or creates a Lokalise API client based on configuration.
27 28 29 |
# File 'lib/lokalise_manager/task_definitions/base.rb', line 27 def api_client @api_client ||= create_api_client end |
#reset_api_client! ⇒ Object
Resets API client
32 33 34 35 36 |
# File 'lib/lokalise_manager/task_definitions/base.rb', line 32 def reset_api_client! ::RubyLokaliseApi.reset_client! ::RubyLokaliseApi.reset_oauth2_client! @api_client = nil end |