Class: Transifex::Resource

Inherits:
Object
  • Object
show all
Includes:
CrudRequests::Delete, CrudRequests::Fetch, CrudRequests::Update
Defined in:
lib/transifex/resource.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from CrudRequests::Delete

included

Methods included from CrudRequests::Update

included

Methods included from CrudRequests::Fetch

included

Constructor Details

#initialize(project_slug = nil, resource_slug = nil) ⇒ Resource

Returns a new instance of Resource.



9
10
11
12
13
14
# File 'lib/transifex/resource.rb', line 9

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

Instance Attribute Details

#project_slugObject

Returns the value of attribute project_slug.



7
8
9
# File 'lib/transifex/resource.rb', line 7

def project_slug
  @project_slug
end

#resource_slugObject

Returns the value of attribute resource_slug.



7
8
9
# File 'lib/transifex/resource.rb', line 7

def resource_slug
  @resource_slug
end

Class Method Details

.authorsObject



16
17
18
# File 'lib/transifex/resource.rb', line 16

def self.authors
  [:project]      
end

Instance Method Details

#contentObject



25
26
27
# File 'lib/transifex/resource.rb', line 25

def content
  Transifex::ResourceComponents::Content.new(project_slug, resource_slug)
end

#fetch_with_detailsObject



20
21
22
23
# File 'lib/transifex/resource.rb', line 20

def fetch_with_details
  options = {:details => true}
  self.fetch(options)      
end

#source(key = nil, context = "") ⇒ Object



37
38
39
# File 'lib/transifex/resource.rb', line 37

def source(key = nil, context = "")          
  Transifex::ResourceComponents::Source.new(project_slug, resource_slug, key, context)
end

#statisticsObject



29
30
31
# File 'lib/transifex/resource.rb', line 29

def statistics
  Transifex::ResourceComponents::Stats.new(project_slug, resource_slug)
end

#translation(language_code = nil) ⇒ Object



33
34
35
# File 'lib/transifex/resource.rb', line 33

def translation(language_code = nil)      
  Transifex::ResourceComponents::Translation.new(project_slug, resource_slug, language_code)
end