Module: IBM::Cloud::SDKHTTP::ChildMixin

Defined in:
lib/ibm/cloud/sdk_http/has_child.rb

Overview

Access a specific instance by either id or name depending on API.

Instance Method Summary collapse

Instance Method Details

#first_instanceObject

Return the first_instance returned from a collection get.



17
18
19
# File 'lib/ibm/cloud/sdk_http/has_child.rb', line 17

def first_instance
  params(limit: 1).all.first
end

#instance(id) ⇒ Object

Get an instance of the collection object.

Parameters:

  • id (String)

    ID of Name to search on depending on API.

Returns:

  • [] The instance object.



12
13
14
# File 'lib/ibm/cloud/sdk_http/has_child.rb', line 12

def instance(id)
  @instance.new(self, endpoint: id).refresh
end