Class: Gcloud::Logging::ResourceDescriptor::List

Inherits:
Array
  • Object
show all
Defined in:
lib/gcloud/logging/resource_descriptor/list.rb

Overview

ResourceDescriptor::List is a special case Array with additional values.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arr = []) ⇒ List

Create a new ResourceDescriptor::List with an array of ResourceDescriptor instances.


32
33
34
# File 'lib/gcloud/logging/resource_descriptor/list.rb', line 32

def initialize arr = []
  super arr
end

Instance Attribute Details

#tokenObject

If not empty, indicates that there are more records that match the request and this value should be passed to continue.


27
28
29
# File 'lib/gcloud/logging/resource_descriptor/list.rb', line 27

def token
  @token
end

Instance Method Details

#nextObject

Retrieve the next page of resource descriptors.


44
45
46
47
48
49
50
51
52
53
# File 'lib/gcloud/logging/resource_descriptor/list.rb', line 44

def next
  return nil unless next?
  ensure_connection!
  resp = @connection.list_resource_descriptors token: token
  if resp.success?
    self.class.from_response resp, @connection
  else
    fail ApiError.from_response(resp)
  end
end

#next?Boolean

Whether there a next page of resource descriptors.


38
39
40
# File 'lib/gcloud/logging/resource_descriptor/list.rb', line 38

def next?
  !token.nil?
end