Class: Transifex::Project

Inherits:
Object
  • Object
show all
Defined in:
lib/transifex/project.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(project_data, account) ⇒ Project

Returns a new instance of Project.



4
5
6
7
8
9
10
# File 'lib/transifex/project.rb', line 4

def initialize(project_data, )
  @name          = project_data.name
  @description   = project_data.description
  @slug          = project_data.slug
  @main_language = project_data.source_language_code
  @account       = 
end

Instance Attribute Details

#accountObject

Returns the value of attribute account.



3
4
5
# File 'lib/transifex/project.rb', line 3

def 
  @account
end

#descriptionObject

Returns the value of attribute description.



3
4
5
# File 'lib/transifex/project.rb', line 3

def description
  @description
end

#main_languageObject

Returns the value of attribute main_language.



3
4
5
# File 'lib/transifex/project.rb', line 3

def main_language
  @main_language
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/transifex/project.rb', line 3

def name
  @name
end

#slugObject

Returns the value of attribute slug.



3
4
5
# File 'lib/transifex/project.rb', line 3

def slug
  @slug
end

Instance Method Details

#languagesObject



22
23
24
# File 'lib/transifex/project.rb', line 22

def languages
  @languages ||= .get("#{base_path}/languages/").map(&:language_code)
end

#resource(resource_slug) ⇒ Object



16
17
18
19
20
# File 'lib/transifex/project.rb', line 16

def resource(resource_slug)
  resource_data = .get(resource_path(resource_slug))
  return if resource_data == 'Not Found'
  Resource.new(resource_data, self)
end

#resourcesObject



12
13
14
# File 'lib/transifex/project.rb', line 12

def resources
   @resources ||= initializ_resources(.get("#{base_path}/resources/"))
end

#translation(resource, language_code) ⇒ Object



26
27
28
29
30
# File 'lib/transifex/project.rb', line 26

def translation(resource, language_code)
  translation_data = .get("#{resource_path(resource.slug)}translation/#{language_code}/")
  return if translation_data == 'Not Found'
  Translation.new(translation_data, resource)
end