Class: Vra::Resources

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Resources

Returns a new instance of Resources.



25
26
27
# File 'lib/vra/resources.rb', line 25

def initialize(client)
  @client = client
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



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

def client
  @client
end

Class Method Details

.all(client) ⇒ Array[Vra::Resource]

Returns - returns an array of all the resources owned by the user.

Parameters:

Returns:

  • (Array[Vra::Resource])
    • returns an array of all the resources owned by the user



31
32
33
34
# File 'lib/vra/resources.rb', line 31

def self.all(client)
  items = client.http_get_paginated_array!("/catalog-service/api/consumer/resources")
  items.map { |item| Vra::Resource.new(client, data: item) }
end

Instance Method Details

#all_resourcesArray[Vra::Resource]

Returns - returns an array of all the resources owned by the user.

Returns:

  • (Array[Vra::Resource])
    • returns an array of all the resources owned by the user



37
38
39
# File 'lib/vra/resources.rb', line 37

def all_resources
  self.class.all(client)
end

#by_id(id) ⇒ Object



41
42
43
# File 'lib/vra/resources.rb', line 41

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