Class: Vra::Resources

Inherits:
Object
  • Object
show all
Defined in:
lib/vra-restapi/resources.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Resources

Returns a new instance of Resources.



23
24
25
# File 'lib/vra-restapi/resources.rb', line 23

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



21
22
23
# File 'lib/vra-restapi/resources.rb', line 21

def client
  @client
end

Instance Method Details

#all_resourcesObject



27
28
29
30
31
32
33
34
35
36
# File 'lib/vra-restapi/resources.rb', line 27

def all_resources
  resources = []

  items = client.http_get_paginated_array!('/catalog-service/api/consumer/resources')
  items.each do |item|
    resources << Vra::Resource.new(client, data: item)
  end

  resources
end

#by_id(id) ⇒ Object



38
39
40
# File 'lib/vra-restapi/resources.rb', line 38

def by_id(id)
  Vra::Resource.new(client, id: id)
end