Class: Vra::Catalog

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ Catalog

Returns a new instance of Catalog.



23
24
25
# File 'lib/vra/catalog.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/catalog.rb', line 21

def client
  @client
end

Instance Method Details

#all_itemsObject



27
28
29
30
# File 'lib/vra/catalog.rb', line 27

def all_items
  client.http_get_paginated_array!('/catalog-service/api/consumer/catalogItems')
    .map! { |x| Vra::CatalogItem.new(client, data: x) }
end

#entitled_itemsObject



32
33
34
35
# File 'lib/vra/catalog.rb', line 32

def entitled_items
  client.http_get_paginated_array!('/catalog-service/api/consumer/entitledCatalogItems')
    .map! { |x| Vra::CatalogItem.new(client, data: x['catalogItem']) }
end

#request(*args) ⇒ Object



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

def request(*args)
  Vra::CatalogRequest.new(@client, *args)
end