Class: CFoundry::V1::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/appfog-vmc-plugin/cfoundry/v1/base.rb

Instance Method Summary collapse

Instance Method Details

#upload_app(name, zipfile, resources = []) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/appfog-vmc-plugin/cfoundry/v1/base.rb', line 4

def upload_app(name, zipfile, resources = [])
  payload = {
    :_method => "put",
    :application =>
      UploadIO.new(
        if zipfile.is_a? File
          zipfile
        elsif zipfile.is_a? String
          File.new(zipfile, "rb")
        end,
        "application/zip"),
    :resources => MultiJson.dump(resources)
  }
  # Accept type overrided for compatibility with old api proxy, should just be '*/*'
  post("apps", name, "application", :payload => payload, :multipart => true, :accept => '*/*; q=0.5, application/xml')
rescue EOFError
  retry
end