class EY::CloudClient::Recipes

Attributes

api[R]
environment[R]

Public Class Methods

new(api, environment) click to toggle source
# File lib/engineyard-cloud-client/models/recipes.rb, line 10
def initialize(api, environment)
  @api = api
  @environment = environment
end

Public Instance Methods

download() click to toggle source
# File lib/engineyard-cloud-client/models/recipes.rb, line 20
def download
  tmp = Tempfile.new("recipes")
  data = api.get("/environments/#{environment.id}/recipes")
  tmp.write(data)
  tmp.flush
  tmp.close
  tmp
end
run() click to toggle source
# File lib/engineyard-cloud-client/models/recipes.rb, line 15
def run
  api.put("/environments/#{environment.id}/run_custom_recipes")
  true
end
upload(file_to_upload) click to toggle source

Expects a File object opened for binary reading. i.e. upload(File.open(recipes_path, ‘rb’))

# File lib/engineyard-cloud-client/models/recipes.rb, line 40
def upload(file_to_upload)
  api.post("/environments/#{environment.id}/recipes", :file => file_to_upload)
  true
end
upload_path(recipes_path) click to toggle source
# File lib/engineyard-cloud-client/models/recipes.rb, line 29
def upload_path(recipes_path)
  recipes_path = Pathname.new(recipes_path)
  if recipes_path.exist?
    upload recipes_path.open('rb')
  else
    raise EY::CloudClient::Error, "Recipes file not found: #{recipes_path}"
  end
end