Class: LingotekClient::Resource::TranslationTarget

Inherits:
Base
  • Object
show all
Defined in:
lib/lingotek-client/resource/translation_target.rb

Constant Summary

Constants inherited from Base

Base::ERRORS, Base::FAIL, Base::RESULTS

Instance Attribute Summary collapse

Attributes inherited from Base

#data

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from Base

all, find, key

Constructor Details

#initialize(attrs) ⇒ TranslationTarget

Returns a new instance of TranslationTarget.



6
7
8
9
10
11
12
13
14
15
# File 'lib/lingotek-client/resource/translation_target.rb', line 6

def initialize(attrs)
  super(attrs)
  @id = attrs['id']
  @language = attrs['language']
  @due_date = attrs['due_date']
  @description = attrs['description']
  @match_sentences= attrs['matchSentneces']
  @match_words= attrs['matchWords']
  @phases = attrs['phases']
end

Instance Attribute Details

#descriptionObject

Returns the value of attribute description.



4
5
6
# File 'lib/lingotek-client/resource/translation_target.rb', line 4

def description
  @description
end

#due_dateObject

Returns the value of attribute due_date.



4
5
6
# File 'lib/lingotek-client/resource/translation_target.rb', line 4

def due_date
  @due_date
end

#idObject

Returns the value of attribute id.



4
5
6
# File 'lib/lingotek-client/resource/translation_target.rb', line 4

def id
  @id
end

#languageObject

Returns the value of attribute language.



4
5
6
# File 'lib/lingotek-client/resource/translation_target.rb', line 4

def language
  @language
end

#match_sentencesObject

Returns the value of attribute match_sentences.



4
5
6
# File 'lib/lingotek-client/resource/translation_target.rb', line 4

def match_sentences
  @match_sentences
end

#match_wordsObject

Returns the value of attribute match_words.



4
5
6
# File 'lib/lingotek-client/resource/translation_target.rb', line 4

def match_words
  @match_words
end

#phasesObject

Returns the value of attribute phases.



4
5
6
# File 'lib/lingotek-client/resource/translation_target.rb', line 4

def phases
  @phases
end

Class Method Details

.find_by_document_id(id) ⇒ Object



17
18
19
20
21
# File 'lib/lingotek-client/resource/translation_target.rb', line 17

def self.find_by_document_id(id)
  objects = JSON.parse(Lingotek::API::api.listTranslationTargets( documentId: id ) )
  objects = objects['translationTargets']
  objects.map { |obj| self.new obj }
end

Instance Method Details

#country_codeObject



27
28
29
# File 'lib/lingotek-client/resource/translation_target.rb', line 27

def country_code
  @language.split('_').last.downcase
end

#current_phaseObject



23
24
25
# File 'lib/lingotek-client/resource/translation_target.rb', line 23

def current_phase
   @phase.first  if @phase
end