Module: RubyLokaliseApi::Rest::Files

Included in:
Client
Defined in:
lib/ruby_lokalise_api/rest/files.rb

Instance Method Summary collapse

Instance Method Details

#destroy_file(project_id, file_id) ⇒ Hash

Deletes a file and it’s associated keys from the project. File __unassigned__ cannot be deleted.

Parameters:

  • project_id (String)
  • params (Hash)

Returns:

  • (Hash)

See Also:



44
45
46
# File 'lib/ruby_lokalise_api/rest/files.rb', line 44

def destroy_file(project_id, file_id)
  c_r RubyLokaliseApi::Resources::File, :destroy, [project_id, file_id]
end

#download_files(project_id, params) ⇒ Hash

Exports translation files as .zip bundle, uploads them to Amazon S3 and returns a URL to the generated bundle. The URL is valid for a year

Parameters:

  • project_id (String)
  • params (Hash)

Returns:

  • (Hash)

See Also:



22
23
24
# File 'lib/ruby_lokalise_api/rest/files.rb', line 22

def download_files(project_id, params)
  c_r RubyLokaliseApi::Resources::File, :download, [project_id, 'download'], params
end

#files(project_id, params = {}) ⇒ RubyLokaliseApi::Collection::File<RubyLokaliseApi::Resources::File>

Returns all translation files for the given project

Parameters:

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

Returns:

See Also:



12
13
14
# File 'lib/ruby_lokalise_api/rest/files.rb', line 12

def files(project_id, params = {})
  c_r RubyLokaliseApi::Collections::File, :all, project_id, params
end

#upload_file(project_id, params) ⇒ Hash

Imports translation file to the given project. File data must base64-encoded. To encode your data in Base64, use ‘Base64.strict_encode64()` method.

Parameters:

  • project_id (String)
  • params (Hash)

Returns:

  • (Hash)

See Also:



33
34
35
# File 'lib/ruby_lokalise_api/rest/files.rb', line 33

def upload_file(project_id, params)
  c_r RubyLokaliseApi::Resources::File, :upload, [project_id, 'upload'], params
end