1
0
Fork 0
mirror of https://github.com/fog/fog.git synced 2022-11-09 13:51:43 -05:00
fog--fog/tests/vcloud_director/requests/compute/helper.rb
Paul Thornthwaite ec8b940b2c Standardise on collection methods
Done with `rubocop --auto-correct --only CollectionMethods`
2014-05-26 16:22:07 +01:00

32 lines
838 B
Ruby

class VcloudDirector
module Compute
module Helper
def self.test_name
@test_name ||= 'fog-test-%x' % Time.now.to_i
end
def self.fixture(filename)
File.join(File.expand_path('../../../fixtures', __FILE__), filename)
end
def self.current_org(service)
service.get_organization(current_org_id(service)).body
end
def self.current_org_id(service)
session = service.get_current_session.body
link = session[:Link].find do |l|
l[:type] == 'application/vnd.vmware.vcloud.org+xml'
end
link[:href].split('/').last
end
def self.first_vdc_id(org)
link = org[:Link].find do |l|
l[:type] == 'application/vnd.vmware.vcloud.vdc+xml'
end
link[:href].split('/').last
end
end
end
end