Method: Toptranslation::Resource::Document#add_translation

Defined in:
lib/toptranslation/resource/document.rb

#add_translation(filepath, locale_code, options = {}) ⇒ Object



11
12
13
14
15
16
17
18
19
20
# File 'lib/toptranslation/resource/document.rb', line 11

def add_translation(filepath, locale_code, options = {})
  upload = Upload.new(@connection).upload(filepath)

  response = @connection.post("/documents/#{@identifier}/translations", options.merge(
                                                                          document_store_id: upload.document_store_id,
                                                                          document_token: upload.document_token,
                                                                          locale_code: locale_code,
                                                                          sha1: upload.sha1
                                                                        ))
end