Class: Fog::Compute::Ecloud::Associations

Inherits:
Ecloud::Collection show all
Defined in:
lib/fog/compute/ecloud/models/associations.rb

Instance Method Summary collapse

Methods inherited from Ecloud::Collection

#check_href!, #load

Instance Method Details

#allObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/fog/compute/ecloud/models/associations.rb', line 11

def all
  data = service.get_associations(href).body
  if data[:Associations]
    data = data[:Associations]
    if data.is_a?(String) && data.empty?
      data = []
    elsif data.is_a?(Hash)
      data = data[:Association]
    end
  end
  load(data)
end

#get(uri) ⇒ Object



24
25
26
27
28
29
30
31
# File 'lib/fog/compute/ecloud/models/associations.rb', line 24

def get(uri)
  if data = service.get_association(uri)
    new(data.body)
  end
rescue ServiceError => e
  raise e unless e.status_code == 404
  nil
end