Class: Colombo::Image

Inherits:
Object
  • Object
show all
Defined in:
lib/colombo/image.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, images, image_hash) ⇒ Image



7
8
9
10
11
12
# File 'lib/colombo/image.rb', line 7

def initialize(client, images, image_hash)
  @client   = client
  image_hash.each do |key, value|
    __send__("#{key}=", value) if self.respond_to?( key.to_sym )
  end
end

Instance Attribute Details

#distributionObject

Returns the value of attribute distribution.



5
6
7
# File 'lib/colombo/image.rb', line 5

def distribution
  @distribution
end

#idObject

Returns the value of attribute id.



5
6
7
# File 'lib/colombo/image.rb', line 5

def id
  @id
end

#nameObject

Returns the value of attribute name.



5
6
7
# File 'lib/colombo/image.rb', line 5

def name
  @name
end

Instance Method Details

#destroy(confirm = false) ⇒ Object



14
15
16
17
18
19
# File 'lib/colombo/image.rb', line 14

def destroy(confirm=false)
  return unless confirm
  @client.request(:get, "/images/#{self.id}/destroy/") do |response|
    return response['event_id']
  end
end