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
- #details ⇒ Object
- #details! ⇒ Object
-
#initialize(project_slug, transifex_data) ⇒ Resource
constructor
A new instance of Resource.
- #stats ⇒ Object
- #stats! ⇒ 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
30 31 32 |
# File 'lib/transifex/resource.rb', line 30 def content client.get("/project/#{@project_slug}/resource/#{@slug}/content/") end |
#details ⇒ Object
14 15 16 |
# File 'lib/transifex/resource.rb', line 14 def details @details || details! end |
#details! ⇒ Object
18 19 20 |
# File 'lib/transifex/resource.rb', line 18 def details! @details = client.get("/project/#{@project_slug}/resource/#{@slug}?details") end |
#stats ⇒ Object
22 23 24 |
# File 'lib/transifex/resource.rb', line 22 def stats @stats || stats! end |
#stats! ⇒ Object
26 27 28 |
# File 'lib/transifex/resource.rb', line 26 def stats! @stats = client.get("/project/#{@project_slug}/resource/#{@slug}/stats/") end |
#translation(lang) ⇒ Object
34 35 36 |
# File 'lib/transifex/resource.rb', line 34 def translation(lang) client.get("/project/#{@project_slug}/resource/#{@slug}/translation/#{lang}/") end |