Class: Fog::Vcloud::Compute::Organizations

Inherits:
Fog::Vcloud::Collection show all
Defined in:
lib/rackspace-fog/vcloud/models/compute/organizations.rb

Instance Attribute Summary

Attributes inherited from Collection

#connection

Instance Method Summary collapse

Methods inherited from Fog::Vcloud::Collection

#check_href!, #load

Methods inherited from Collection

#clear, #create, #destroy, #initialize, #inspect, #load, model, #model, #new, #reload, #table, #to_json

Methods included from Attributes::ClassMethods

#_load, #aliases, #attribute, #attributes, #identity, #ignore_attributes, #ignored_attributes

Methods included from Attributes::InstanceMethods

#_dump, #attributes, #dup, #identity, #identity=, #merge_attributes, #new_record?, #requires, #requires_one

Constructor Details

This class inherits a constructor from Fog::Collection

Instance Method Details

#allObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/rackspace-fog/vcloud/models/compute/organizations.rb', line 13

def all
  raw_orgs = if connection.version == '1.0'
    connection.
  else
    connection.request(connection.basic_request_params("#{connection.base_path_url}/org/"))
  end
  data = raw_orgs.body[:Org].select { |org| org[:type] == "application/vnd.vmware.vcloud.org+xml" }
  data.each { |org| org.delete_if { |key, value| [:rel].include?(key) } }
  load(data)
end

#get(uri) ⇒ Object



24
25
26
27
28
# File 'lib/rackspace-fog/vcloud/models/compute/organizations.rb', line 24

def get(uri)
  connection.get_organization(uri)
rescue Fog::Errors::NotFound
  nil
end