Module: RubyLokaliseApi::Rest::Files
- Included in:
- RubyLokaliseApi::Rest
- Defined in:
- lib/ruby_lokalise_api/rest/files.rb
Instance Method Summary collapse
-
#destroy_file(project_id, file_id) ⇒ RubyLokaliseApi::Generics::DeletedResource
Deletes a single file from the project.
-
#download_files(project_id, req_params) ⇒ RubyLokaliseApi::Generics::DownloadBundle
Downloads translation files from the project.
-
#files(project_id, req_params = {}) ⇒ RubyLokaliseApi::Collections::Files
Returns project files.
-
#upload_file(project_id, req_params) ⇒ RubyLokaliseApi::Resources::QueuedProcess
Uploads translation file to the project in the background.
Instance Method Details
#destroy_file(project_id, file_id) ⇒ RubyLokaliseApi::Generics::DeletedResource
Deletes a single file from the project. Only the “Documents” projects are supported
60 61 62 63 64 65 66 |
# File 'lib/ruby_lokalise_api/rest/files.rb', line 60 def destroy_file(project_id, file_id) params = { query: [project_id, file_id] } data = endpoint(name: 'Files', params: params).do_delete RubyLokaliseApi::Generics::DeletedResource.new data.content end |
#download_files(project_id, req_params) ⇒ RubyLokaliseApi::Generics::DownloadBundle
Downloads translation files from the project
45 46 47 48 49 50 51 |
# File 'lib/ruby_lokalise_api/rest/files.rb', line 45 def download_files(project_id, req_params) params = { query: [project_id, :download], req: req_params } data = endpoint(name: 'Files', params: params).do_post RubyLokaliseApi::Generics::DownloadBundle.new data.content end |
#files(project_id, req_params = {}) ⇒ RubyLokaliseApi::Collections::Files
Returns project files
12 13 14 15 16 17 18 19 |
# File 'lib/ruby_lokalise_api/rest/files.rb', line 12 def files(project_id, req_params = {}) name = 'Files' params = { query: project_id, req: req_params } data = endpoint(name: name, params: params).do_get collection name, data end |
#upload_file(project_id, req_params) ⇒ RubyLokaliseApi::Resources::QueuedProcess
Uploads translation file to the project in the background
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/ruby_lokalise_api/rest/files.rb', line 27 def upload_file(project_id, req_params) params = { query: [project_id, :upload], req: req_params } response = endpoint(name: 'Files', params: params).do_post process_id = response.content.dig('process', 'process_id') response.patch_endpoint_with endpoint(name: 'QueuedProcesses', params: { query: [project_id, process_id] }) resource 'QueuedProcess', response end |