Class: Gcloud::Pubsub::Topic::List

Inherits:
Array
  • Object
show all
Defined in:
lib/gcloud/pubsub/topic/list.rb

Overview

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arr = [], token = nil) ⇒ List

Create a new Topic::List with an array of values.



32
33
34
35
# File 'lib/gcloud/pubsub/topic/list.rb', line 32

def initialize arr = [], token = nil
  super arr
  @token = token
end

Instance Attribute Details

#tokenObject

If not empty, indicates that there are more topics that match the request and this value should be passed to the next Gcloud::PubSub::Project#topics to continue.



28
29
30
# File 'lib/gcloud/pubsub/topic/list.rb', line 28

def token
  @token
end

Class Method Details

.from_response(resp, conn) ⇒ Object

New Topic::List from a response object.



39
40
41
42
43
44
# File 'lib/gcloud/pubsub/topic/list.rb', line 39

def self.from_response resp, conn #:nodoc:
  topics = Array(resp.data["topics"]).map do |gapi_object|
    Topic.from_gapi gapi_object, conn
  end
  new topics, resp.data["nextPageToken"]
end