class IBM::Cloud::SDKHTTP::BaseInstance

Container that encapsulates the VPC API.

Attributes

connection[R]
endpoint[R]
logger[R]
token[R]

Public Class Methods

new(parent, data: {}, id_key: 'id', endpoint: nil) click to toggle source
# File lib/ibm/cloud/sdk_http/base_instance.rb, line 15
def initialize(parent, data: {}, id_key: 'id', endpoint: nil)
  @data = data

  endpoint ||= data[id_key.to_sym]
  @connection = parent.connection
  @token = parent.token
  @endpoint = parent.url(endpoint)
  @logger = parent.logger
end

Public Instance Methods

details() click to toggle source

Fetch the instance details for this resource. @return [SDKResponse] The HTTP response object.

# File lib/ibm/cloud/sdk_http/base_instance.rb, line 29
def details
  get.hash_response
end
refresh() click to toggle source

Fetch the instance details from the server. Clear current data and save the results. @return [BaseInstance] This instance for chaining.

# File lib/ibm/cloud/sdk_http/base_instance.rb, line 35
def refresh
  @data.replace(details)
  self
end
remove() click to toggle source

Send a delete request to the server for this resource.

# File lib/ibm/cloud/sdk_http/base_instance.rb, line 46
def remove
  delete
end
update(payload) click to toggle source

Send an update to the server for this resource.

# File lib/ibm/cloud/sdk_http/base_instance.rb, line 41
def update(payload)
  patch(payload: payload)
end