Class: Vcloud::Core::Entity

Inherits:
Object
  • Object
show all
Defined in:
lib/vcloud/core/entity.rb

Instance Method Summary collapse

Instance Method Details

#idObject



9
10
11
12
13
14
15
16
# File 'lib/vcloud/core/entity.rb', line 9

def id
  raise 'id not found' unless @vcloud_attributes && @vcloud_attributes[:href]
  extracted_id = @vcloud_attributes[:href].split('/').last
  unless extracted_id =~ /^#{id_prefix}-[-0-9a-f]+$/
    raise "#{id_prefix} id : #{extracted_id} is not in correct format"
  end
  extracted_id
end

#id_prefixObject



5
6
7
# File 'lib/vcloud/core/entity.rb', line 5

def id_prefix;
  raise 'id_prefix : method missing'
end

#nameObject



18
19
20
# File 'lib/vcloud/core/entity.rb', line 18

def name
  @vcloud_attributes[:name]
end