class ProfitBricks::Image

Image class

Public Class Methods

get(image_id) click to toggle source

Retrieve an image.

# File lib/profitbricks/image.rb, line 42
def get(image_id)
  response = ProfitBricks.request(
    method: :get,
    path: "/images/#{image_id}",
    expects: 200
  )
  instantiate_objects(response)
end
list(options = {}) click to toggle source

List all images.

# File lib/profitbricks/image.rb, line 30
def list(options = {})

  response = ProfitBricks.request(
    method: :get,
    path: '/images/',
    expects: 200,
    query: options
  )
  instantiate_objects(response)
end

Public Instance Methods

delete() click to toggle source

Delete the image.

# File lib/profitbricks/image.rb, line 5
def delete
  ProfitBricks.request(
    method: :delete,
    path: "/images/#{id}",
    expects: 202
  )
end
update(options = {}) click to toggle source

Update the image.

# File lib/profitbricks/image.rb, line 14
def update(options = {})
  response = ProfitBricks.request(
    method: :patch,
    path: "/images/#{id}",
    expects: 202,
    body: options.to_json
  )
  if response
    self.requestId = response['requestId']
    @properties = @properties.merge(response['properties'])
  end
  self
end