Sha256: e8c2ab0773c54de51bd42c42b02ddeb9461615031e1572ff97de6b1209f4c101

Contents?: true

Size: 1.15 KB

Versions: 6

Compression:

Stored size: 1.15 KB

Contents

# frozen_string_literal: true
#
# Author:: Chef Partner Engineering (<partnereng@chef.io>)
# Copyright:: Copyright (c) 2015 Chef Software, Inc.
# License:: Apache License, Version 2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

module Vra
  class Resources
    attr_reader :client

    def initialize(client)
      @client = client
    end

    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

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

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
vmware-vra-2.4.0 lib/vra/resources.rb
vmware-vra-2.3.0 lib/vra/resources.rb
vmware-vra-2.2.0 lib/vra/resources.rb
vmware-vra-2.1.3 lib/vra/resources.rb
vmware-vra-2.1.2 lib/vra/resources.rb
vmware-vra-2.1.1 lib/vra/resources.rb