Class: Transifex::ProjectComponents::LanguageComponents::Translators

Inherits:
Object
  • Object
show all
Includes:
CrudRequests::Fetch, CrudRequests::Update
Defined in:
lib/transifex/project_components/language_components/translators.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CrudRequests::Update

included

Methods included from CrudRequests::Fetch

included

Constructor Details

#initialize(project_slug = nil, language_code = nil) ⇒ Translators

Returns a new instance of Translators.



10
11
12
13
14
15
# File 'lib/transifex/project_components/language_components/translators.rb', line 10

def initialize(project_slug = nil, language_code = nil)
  raise MissingParametersError.new(["project_slug"]) if project_slug.nil?
  raise MissingParametersError.new(["language_code"]) if language_code.nil?
  @project_slug = project_slug
  @language_slug = language_code
end

Instance Attribute Details

#language_slugObject

Returns the value of attribute language_slug.



8
9
10
# File 'lib/transifex/project_components/language_components/translators.rb', line 8

def language_slug
  @language_slug
end

#project_slugObject

Returns the value of attribute project_slug.



8
9
10
# File 'lib/transifex/project_components/language_components/translators.rb', line 8

def project_slug
  @project_slug
end

Class Method Details

.authorsObject



17
18
19
# File 'lib/transifex/project_components/language_components/translators.rb', line 17

def self.authors
  [:project, :language]
end

Instance Method Details

#update(translators = {}, options = {}) ⇒ Object



21
22
23
24
25
26
# File 'lib/transifex/project_components/language_components/translators.rb', line 21

def update(translators = {}, options = {})
  # Transifex needs coordinators list to be passed also when updating reviewers list. Strange
  # Fetch the current coordinators list and add it to the params as a workaround.
  coordinators = Transifex::Project.new(@project_slug).language(@language_slug).coordinators.fetch
  super(coordinators.merge({"translators" => translators}), options)
end