Class: Fog::Slicehost::Flavors

Inherits:
Collection show all
Defined in:
lib/fog/slicehost/models/flavors.rb

Instance Method Summary collapse

Methods inherited from Collection

#_dump, _load, aliases, attribute, attributes, #attributes, #connection, #connection=, #create, #initialize, #inspect, #merge_attributes, model, #model, #new, #reload

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#allObject



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/slicehost/models/flavors.rb', line 12

def all
  if @loaded
    clear
  end
  @loaded = true
  data = connection.get_flavors.body
  for flavor in data['flavors']
    self << new(flavor)
  end
  self
end

#get(flavor_id) ⇒ Object



24
25
26
27
28
# File 'lib/fog/slicehost/models/flavors.rb', line 24

def get(flavor_id)
  connection.get_flavor(flavor_id)
rescue Excon::Errors::Forbidden
  nil
end