Class: Transifex::ResourceComponents::Translation
- Inherits:
-
Object
- Object
- Transifex::ResourceComponents::Translation
- Includes:
- CrudRequests::Fetch, CrudRequests::Update
- Defined in:
- lib/transifex/resource_components/translation.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.
-
#translation_slug ⇒ Object
Returns the value of attribute translation_slug.
Class Method Summary collapse
Instance Method Summary collapse
- #fetch(options = {}) ⇒ Object
- #fetch_with_file(options = {}) ⇒ Object
-
#initialize(project_slug = nil, resource_slug = nil, translation_slug = nil) ⇒ Translation
constructor
A new instance of Translation.
- #string(key = nil, context = "") ⇒ Object
- #strings ⇒ Object
Methods included from CrudRequests::Update
Methods included from CrudRequests::Fetch
Constructor Details
#initialize(project_slug = nil, resource_slug = nil, translation_slug = nil) ⇒ Translation
Returns a new instance of Translation.
9 10 11 12 13 14 15 16 |
# File 'lib/transifex/resource_components/translation.rb', line 9 def initialize(project_slug = nil, resource_slug = nil, translation_slug = nil) raise MissingParametersError.new(["project_slug"]) if project_slug.nil? raise MissingParametersError.new(["resource_slug"]) if resource_slug.nil? raise MissingParametersError.new(["translation_slug"]) if translation_slug.nil? @project_slug = project_slug @resource_slug = resource_slug @translation_slug = translation_slug end |
Instance Attribute Details
#project_slug ⇒ Object
Returns the value of attribute project_slug.
7 8 9 |
# File 'lib/transifex/resource_components/translation.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_components/translation.rb', line 7 def resource_slug @resource_slug end |
#translation_slug ⇒ Object
Returns the value of attribute translation_slug.
7 8 9 |
# File 'lib/transifex/resource_components/translation.rb', line 7 def translation_slug @translation_slug end |
Class Method Details
.authors ⇒ Object
18 19 20 |
# File 'lib/transifex/resource_components/translation.rb', line 18 def self. [:project, :resource] end |
Instance Method Details
#fetch(options = {}) ⇒ Object
22 23 24 |
# File 'lib/transifex/resource_components/translation.rb', line 22 def fetch( = {}) super end |
#fetch_with_file(options = {}) ⇒ Object
26 27 28 29 30 31 32 |
# File 'lib/transifex/resource_components/translation.rb', line 26 def fetch_with_file( = {}) raise MissingParametersError.new(["path_to_file"]) if [:path_to_file].nil? path_to_file = .delete(:path_to_file) [:file] = true file_body = fetch() write_to_file(path_to_file, file_body) end |
#string(key = nil, context = "") ⇒ Object
38 39 40 41 42 |
# File 'lib/transifex/resource_components/translation.rb', line 38 def string(key = nil , context = "") raise MissingParametersError.new(["key"]) if key.nil? raise MissingParametersError.new(["context"]) if context.nil? Transifex::ResourceComponents::TranslationComponents::String.new(@project_slug, @resource_slug, @translation_slug, key, context) end |
#strings ⇒ Object
34 35 36 |
# File 'lib/transifex/resource_components/translation.rb', line 34 def strings Transifex::ResourceComponents::TranslationComponents::Strings.new(@project_slug, @resource_slug, @translation_slug) end |