Class: Transifex::Resource
- Inherits:
-
Object
- Object
- Transifex::Resource
- Defined in:
- lib/transifex/resource.rb
Instance Attribute Summary collapse
-
#project_slug ⇒ Object
Returns the value of attribute project_slug.
-
#resource_slug ⇒ Object
Returns the value of attribute resource_slug.
Class Method Summary collapse
Instance Method Summary collapse
- #content ⇒ Object
- #fetch_with_details ⇒ Object
-
#initialize(project_slug = nil, resource_slug = nil) ⇒ Resource
constructor
A new instance of Resource.
- #source(key = nil, context = "") ⇒ Object
- #statistics ⇒ Object
- #translation(language_code = nil) ⇒ Object
Methods included from CrudRequests::Delete
Methods included from CrudRequests::Update
Methods included from CrudRequests::Fetch
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_slug ⇒ Object
Returns the value of attribute project_slug.
7 8 9 |
# File 'lib/transifex/resource.rb', line 7 def project_slug @project_slug end |
#resource_slug ⇒ Object
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
.authors ⇒ Object
16 17 18 |
# File 'lib/transifex/resource.rb', line 16 def self. [:project] end |
Instance Method Details
#content ⇒ Object
25 26 27 |
# File 'lib/transifex/resource.rb', line 25 def content Transifex::ResourceComponents::Content.new(project_slug, resource_slug) end |
#fetch_with_details ⇒ Object
20 21 22 23 |
# File 'lib/transifex/resource.rb', line 20 def fetch_with_details = {:details => true} self.fetch() 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 |
#statistics ⇒ Object
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 |