Module: Crowdin::ApiResources::Storages
- Defined in:
- lib/crowdin-api/api_resources/storages.rb
Instance Method Summary collapse
- #add_storage(file = nil) ⇒ Object
- #delete_storage(storage_id = nil) ⇒ Object
- #get_storage(storage_id = nil) ⇒ Object
- #list_storages(query = {}) ⇒ Object
Instance Method Details
#add_storage(file = nil) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/crowdin-api/api_resources/storages.rb', line 22 def add_storage(file = nil) file || raise_parameter_is_required_error(:file) file = File.open(file, 'r') headers = { 'Content-Type' => 'application/octet-stream', 'Crowdin-API-FileName' => File.basename(file) } request = Web::Request.new( connection, :post, "#{config.target_api_url}/storages", { params: file, headers: headers } ) Web::SendRequest.new(request).perform end |
#delete_storage(storage_id = nil) ⇒ Object
54 55 56 57 58 59 60 61 62 63 |
# File 'lib/crowdin-api/api_resources/storages.rb', line 54 def delete_storage(storage_id = nil) storage_id || raise_parameter_is_required_error(:storage_id) request = Web::Request.new( connection, :delete, "#{config.target_api_url}/storages/#{storage_id}" ) Web::SendRequest.new(request).perform end |
#get_storage(storage_id = nil) ⇒ Object
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/crowdin-api/api_resources/storages.rb', line 40 def get_storage(storage_id = nil) storage_id || raise_parameter_is_required_error(:storage_id) request = Web::Request.new( connection, :get, "#{config.target_api_url}/storages/#{storage_id}" ) Web::SendRequest.new(request).perform end |