Module: RubyLokaliseApi::Rest::Translations

Included in:
RubyLokaliseApi::Rest
Defined in:
lib/ruby_lokalise_api/rest/translations.rb

Instance Method Summary collapse

Instance Method Details

#translation(project_id, translation_id, req_params = {}) ⇒ RubyLokaliseApi::Resources::Translation

Returns a single translation

Parameters:

  • project_id (String)
  • translation_id (String)
  • req_params (Hash) (defaults to: {})

Returns:

See Also:



28
29
30
31
32
33
34
# File 'lib/ruby_lokalise_api/rest/translations.rb', line 28

def translation(project_id, translation_id, req_params = {})
  params = { query: [project_id, translation_id], req: req_params }

  data = endpoint(name: 'Translations', params: params).do_get

  resource 'Translation', data
end

#translations(project_id, req_params = {}) ⇒ RubyLokaliseApi::Collections::Translations

Returns translations

Parameters:

  • project_id (String)
  • req_params (Hash) (defaults to: {})

Returns:

See Also:



12
13
14
15
16
17
18
19
# File 'lib/ruby_lokalise_api/rest/translations.rb', line 12

def translations(project_id, req_params = {})
  name = 'Translations'
  params = { query: project_id, req: req_params }

  data = endpoint(name: name, params: params).do_get

  collection name, data
end

#update_translation(project_id, translation_id, req_params) ⇒ RubyLokaliseApi::Resources::Translation

Updates a translation

Parameters:

  • project_id (String)
  • translation_id (String)
  • req_params (Hash)

Returns:

See Also:



43
44
45
46
47
48
49
# File 'lib/ruby_lokalise_api/rest/translations.rb', line 43

def update_translation(project_id, translation_id, req_params)
  params = { query: [project_id, translation_id], req: req_params }

  data = endpoint(name: 'Translations', params: params).do_put

  resource 'Translation', data
end