lib/cfoundry/v2/base.rb in cfoundry-0.5.0 vs lib/cfoundry/v2/base.rb in cfoundry-0.5.1.rc1

- old
+ new

@@ -11,21 +11,23 @@ def resource_match(fingerprints) put("v2", "resource_match", :content => :json, :accept => :json, :payload => fingerprints) end - def upload_app(guid, zipfile, resources = []) - payload = { - :resources => MultiJson.dump(resources), - :application => + def upload_app(guid, zipfile = nil, resources = []) + payload = {} + payload[:resources] = MultiJson.dump(resources) + + if zipfile + payload[:application] = UploadIO.new( if zipfile.is_a? File zipfile elsif zipfile.is_a? String File.new(zipfile, "rb") end, "application/zip") - } + end put("v2", "apps", guid, "bits", :payload => payload) rescue EOFError retry end