Class: Transifex::Resource
- Inherits:
-
Object
- Object
- Transifex::Resource
- Defined in:
- lib/transifex/resource.rb
Instance Attribute Summary collapse
-
#category ⇒ Object
Returns the value of attribute category.
-
#client ⇒ Object
Returns the value of attribute client.
-
#i18n_type ⇒ Object
Returns the value of attribute i18n_type.
-
#name ⇒ Object
Returns the value of attribute name.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#source_language_code ⇒ Object
Returns the value of attribute source_language_code.
Instance Method Summary collapse
- #content ⇒ Object
-
#initialize(project_slug, transifex_data) ⇒ Resource
constructor
A new instance of Resource.
- #stats(lang) ⇒ Object
- #translation(lang) ⇒ Object
Constructor Details
#initialize(project_slug, transifex_data) ⇒ Resource
Returns a new instance of Resource.
5 6 7 8 9 10 11 12 |
# File 'lib/transifex/resource.rb', line 5 def initialize(project_slug, transifex_data) @project_slug = project_slug @name = transifex_data[:name] @category = transifex_data[:category] @i18n_type = transifex_data[:i18n_type] @source_language_code = transifex_data[:source_language_code] @slug = transifex_data[:slug] end |
Instance Attribute Details
#category ⇒ Object
Returns the value of attribute category.
3 4 5 |
# File 'lib/transifex/resource.rb', line 3 def category @category end |
#client ⇒ Object
Returns the value of attribute client.
3 4 5 |
# File 'lib/transifex/resource.rb', line 3 def client @client end |
#i18n_type ⇒ Object
Returns the value of attribute i18n_type.
3 4 5 |
# File 'lib/transifex/resource.rb', line 3 def i18n_type @i18n_type end |
#name ⇒ Object
Returns the value of attribute name.
3 4 5 |
# File 'lib/transifex/resource.rb', line 3 def name @name end |
#slug ⇒ Object
Returns the value of attribute slug.
3 4 5 |
# File 'lib/transifex/resource.rb', line 3 def slug @slug end |
#source_language_code ⇒ Object
Returns the value of attribute source_language_code.
3 4 5 |
# File 'lib/transifex/resource.rb', line 3 def source_language_code @source_language_code end |
Instance Method Details
#content ⇒ Object
14 15 16 |
# File 'lib/transifex/resource.rb', line 14 def content client.get("/project/#{@project_slug}/resource/#{@slug}/content/") end |
#stats(lang) ⇒ Object
22 23 24 25 |
# File 'lib/transifex/resource.rb', line 22 def stats(lang) stats = client.get("/project/#{@project_slug}/resource/#{@slug}/stats/#{lang}") Transifex::Stats.new(stats).tap {|r| r.client = client } end |
#translation(lang) ⇒ Object
18 19 20 |
# File 'lib/transifex/resource.rb', line 18 def translation(lang) client.get("/project/#{@project_slug}/resource/#{@slug}/translation/#{lang}/") end |