Class: Gcloud::Pubsub::Subscription::List

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

Overview

Subscription::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 Subscription::List with an array of values.



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

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

Instance Attribute Details

#tokenObject

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



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

def token
  @token
end

Class Method Details

.from_grpc(grpc_list, service) ⇒ Object

Google::Pubsub::V1::ListSubscriptionsRequest object.



41
42
43
44
45
46
47
48
49
50
# File 'lib/gcloud/pubsub/subscription/list.rb', line 41

def self.from_grpc grpc_list, service
  subs = Array(grpc_list.subscriptions).map do |grpc|
    if grpc.is_a? String
      Subscription.new_lazy grpc, service
    else
      Subscription.from_grpc grpc, service
    end
  end
  new subs, grpc_list.next_page_token
end