Class: Transifex::ProjectComponents::LanguageComponents::Reviewers

Inherits:
Object
  • Object
show all
Includes:
CrudRequests::Fetch, CrudRequests::Update
Defined in:
lib/tx-ruby/project_components/language_components/reviewers.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) ⇒ Reviewers

Returns a new instance of Reviewers.



10
11
12
13
14
15
# File 'lib/tx-ruby/project_components/language_components/reviewers.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/tx-ruby/project_components/language_components/reviewers.rb', line 8

def language_slug
  @language_slug
end

#project_slugObject

Returns the value of attribute project_slug.



8
9
10
# File 'lib/tx-ruby/project_components/language_components/reviewers.rb', line 8

def project_slug
  @project_slug
end

Class Method Details

.parentsObject



17
18
19
# File 'lib/tx-ruby/project_components/language_components/reviewers.rb', line 17

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

Instance Method Details

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



21
22
23
24
25
26
27
28
29
# File 'lib/tx-ruby/project_components/language_components/reviewers.rb', line 21

def update(reviewers_list = {}, 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.
  fetched_language_infos = Transifex::Project.new(@project_slug).language(@language_slug).fetch
  params = {}
  params[:coordinators] = fetched_language_infos["coordinators"]          
  params[:reviewers] = reviewers_list
  super(params, options)
end