lib/google/cloud/pubsub/snapshot/list.rb in google-cloud-pubsub-0.33.2 vs lib/google/cloud/pubsub/snapshot/list.rb in google-cloud-pubsub-0.34.0
- old
+ new
@@ -15,19 +15,19 @@
require "delegate"
module Google
module Cloud
- module Pubsub
+ module PubSub
class Snapshot
##
# Snapshot::List is a special case Array with additional values.
class List < DelegateClass(::Array)
##
# If not empty, indicates that there are more snapshots
# that match the request and this value should be passed to
- # the next {Google::Cloud::Pubsub::Project#snapshots} to continue.
+ # the next {Google::Cloud::PubSub::Project#snapshots} to continue.
attr_accessor :token
##
# @private Create a new Snapshot::List with an array of values.
def initialize arr = []
@@ -43,11 +43,11 @@
# @return [Boolean]
#
# @example
# require "google/cloud/pubsub"
#
- # pubsub = Google::Cloud::Pubsub.new
+ # pubsub = Google::Cloud::PubSub.new
#
# snapshots = pubsub.snapshots
# if snapshots.next?
# next_snapshots = snapshots.next
# end
@@ -62,11 +62,11 @@
# @return [Snapshot::List]
#
# @example
# require "google/cloud/pubsub"
#
- # pubsub = Google::Cloud::Pubsub.new
+ # pubsub = Google::Cloud::PubSub.new
#
# snapshots = pubsub.snapshots
# if snapshots.next?
# next_snapshots = snapshots.next
# end
@@ -96,31 +96,31 @@
# @return [Enumerator]
#
# @example Iterating each snapshot by passing a block:
# require "google/cloud/pubsub"
#
- # pubsub = Google::Cloud::Pubsub.new
+ # pubsub = Google::Cloud::PubSub.new
#
# snapshots = pubsub.snapshots
# snapshots.all do |snapshot|
# puts snapshot.name
# end
#
# @example Using the enumerator by not passing a block:
# require "google/cloud/pubsub"
#
- # pubsub = Google::Cloud::Pubsub.new
+ # pubsub = Google::Cloud::PubSub.new
#
# snapshots = pubsub.snapshots
# all_names = snapshots.all.map do |snapshot|
# snapshot.name
# end
#
# @example Limit the number of API calls made:
# require "google/cloud/pubsub"
#
- # pubsub = Google::Cloud::Pubsub.new
+ # pubsub = Google::Cloud::PubSub.new
#
# snapshots = pubsub.snapshots
# snapshots.all(request_limit: 10) do |snapshot|
# puts snapshot.name
# end
@@ -142,11 +142,11 @@
end
end
##
# @private New Snapshots::List from a
- # Google::Pubsub::V1::ListSnapshotsRequest object.
+ # Google::Cloud::PubSub::V1::ListSnapshotsRequest object.
def self.from_grpc grpc_list, service, max = nil
subs = new(Array(grpc_list.snapshots).map do |grpc|
Snapshot.from_grpc grpc, service
end)
token = grpc_list.next_page_token
@@ -172,7 +172,9 @@
self.class.from_grpc grpc, @service, @max
end
end
end
end
+
+ Pubsub = PubSub unless const_defined? :Pubsub
end
end