Method: Akamai::Netstorage#upload

Defined in:
lib/akamai/netstorage.rb

#upload(local_source, ns_destination, index_zip = false) ⇒ Object



211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
# File 'lib/akamai/netstorage.rb', line 211

def upload(local_source, ns_destination, index_zip=false)
    if File.file?(local_source) 
        if ns_destination.end_with?('/')
            ns_destination = "#{ns_destination}#{File.basename(local_source)}"
        end
    else
        raise NetstorageError, "[NetstorageError] #{ns_destination} doesn't exist or is directory"
    end
    action = "upload"
    if index_zip == true or index_zip.to_s.downcase == "true"
        action += "&index-zip=2"
    end

    return _request(action: action,
                    method: "PUT",
                    source: local_source,
                    path: ns_destination) 
end