google-cloud-pubsub 0.33.2 → 0.34.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (46) hide show
  1. checksums.yaml +4 -4
  2. data/AUTHENTICATION.md +4 -4
  3. data/CHANGELOG.md +45 -0
  4. data/EMULATOR.md +2 -2
  5. data/OVERVIEW.md +81 -43
  6. data/lib/google-cloud-pubsub.rb +10 -7
  7. data/lib/google/cloud/pubsub.rb +38 -21
  8. data/lib/google/cloud/pubsub/async_publisher.rb +8 -6
  9. data/lib/google/cloud/pubsub/batch_publisher.rb +7 -5
  10. data/lib/google/cloud/pubsub/convert.rb +5 -3
  11. data/lib/google/cloud/pubsub/credentials.rb +6 -4
  12. data/lib/google/cloud/pubsub/message.rb +9 -6
  13. data/lib/google/cloud/pubsub/policy.rb +12 -10
  14. data/lib/google/cloud/pubsub/project.rb +30 -28
  15. data/lib/google/cloud/pubsub/publish_result.rb +3 -1
  16. data/lib/google/cloud/pubsub/received_message.rb +11 -10
  17. data/lib/google/cloud/pubsub/service.rb +47 -37
  18. data/lib/google/cloud/pubsub/snapshot.rb +11 -9
  19. data/lib/google/cloud/pubsub/snapshot/list.rb +10 -8
  20. data/lib/google/cloud/pubsub/subscriber.rb +32 -6
  21. data/lib/google/cloud/pubsub/subscriber/enumerator_queue.rb +3 -1
  22. data/lib/google/cloud/pubsub/subscriber/inventory.rb +4 -2
  23. data/lib/google/cloud/pubsub/subscriber/stream.rb +23 -43
  24. data/lib/google/cloud/pubsub/subscriber/timed_unary_buffer.rb +221 -0
  25. data/lib/google/cloud/pubsub/subscription.rb +157 -80
  26. data/lib/google/cloud/pubsub/subscription/list.rb +12 -10
  27. data/lib/google/cloud/pubsub/topic.rb +79 -51
  28. data/lib/google/cloud/pubsub/topic/list.rb +10 -8
  29. data/lib/google/cloud/pubsub/v1/credentials.rb +4 -2
  30. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/iam_policy.rb +1 -43
  31. data/lib/google/cloud/pubsub/v1/doc/google/iam/v1/policy.rb +1 -108
  32. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/duration.rb +1 -1
  33. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/empty.rb +1 -1
  34. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/field_mask.rb +1 -1
  35. data/lib/google/cloud/pubsub/v1/doc/google/protobuf/timestamp.rb +1 -1
  36. data/lib/google/cloud/pubsub/v1/doc/google/pubsub/v1/pubsub.rb +107 -61
  37. data/lib/google/cloud/pubsub/v1/publisher_client.rb +58 -55
  38. data/lib/google/cloud/pubsub/v1/publisher_client_config.json +0 -4
  39. data/lib/google/cloud/pubsub/v1/subscriber_client.rb +177 -128
  40. data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +0 -4
  41. data/lib/google/cloud/pubsub/version.rb +4 -2
  42. data/lib/google/pubsub/v1/pubsub_pb.rb +48 -40
  43. data/lib/google/pubsub/v1/pubsub_services_pb.rb +201 -161
  44. metadata +6 -7
  45. data/lib/google/cloud/pubsub/subscriber/async_stream_pusher.rb +0 -223
  46. data/lib/google/cloud/pubsub/subscriber/async_unary_pusher.rb +0 -271
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: e93469ccb43f93262792fbcc7c58a076930f3655dc39c059ad2f323305cea78d
4
- data.tar.gz: f026ce8b7ca6054fc98c9904a0d4a400fc92f7076cb7c57b575b51f3646101c5
3
+ metadata.gz: 7e3e1d9e63979754089bd5108e56abee4648fa7cca2db8bd24c5b44b3608047c
4
+ data.tar.gz: dac86cdbc741948a11d052baa51c470096a49ed3d8fa2900785b70fa74910beb
5
5
  SHA512:
6
- metadata.gz: 552944e31e98a88fcdeff590ffca5b9a10bfe0150f74feb9c907b92b3597776e64bde50e29115072523f9df8acea495caad3ae61e964095bb8b44dfa9fafe968
7
- data.tar.gz: 19a1d398e0255684aa3c8c4269d857cee51c25be4c7e6828741fad86c040ce5de5994a7cc7565644c8610c1939bcbb98ab036349b54db693b843896531135ab9
6
+ metadata.gz: 0c9a754781fcb85633efcf1ef7fd4f6660f9faafb531e94f8bf9c0b82fcd385069d7ca8ba8cb845b5927b9c1c6d89205387fb877f1b28aa3e59da2eebd226824
7
+ data.tar.gz: 3b349b5b3aa431a143ba3091f849f21bdde791184d687cf51debf1ba85b44b7e6074b9cac3f7203e27006136b53d438a92a79d8b8db71ec0bc3bbcf211f3144b
@@ -78,7 +78,7 @@ The environment variables that Pub/Sub checks for project ID are:
78
78
  1. `PUBSUB_PROJECT`
79
79
  2. `GOOGLE_CLOUD_PROJECT`
80
80
 
81
- The environment variables that Pub/Sub checks for credentials are configured on {Google::Cloud::Pubsub::V1::Credentials}:
81
+ The environment variables that Pub/Sub checks for credentials are configured on {Google::Cloud::PubSub::V1::Credentials}:
82
82
 
83
83
  1. `PUBSUB_CREDENTIALS` - Path to JSON file, or JSON contents
84
84
  2. `PUBSUB_KEYFILE` - Path to JSON file, or JSON contents
@@ -92,7 +92,7 @@ require "google/cloud/pubsub"
92
92
  ENV["PUBSUB_PROJECT"] = "my-project-id"
93
93
  ENV["PUBSUB_CREDENTIALS"] = "path/to/keyfile.json"
94
94
 
95
- pubsub = Google::Cloud::Pubsub.new
95
+ pubsub = Google::Cloud::PubSub.new
96
96
  ```
97
97
 
98
98
  ### Configuration
@@ -102,12 +102,12 @@ The **Project ID** and **Credentials JSON** can be configured instead of placing
102
102
  ```ruby
103
103
  require "google/cloud/pubsub"
104
104
 
105
- Google::Cloud::Pubsub.configure do |config|
105
+ Google::Cloud::PubSub.configure do |config|
106
106
  config.project_id = "my-project-id"
107
107
  config.credentials = "path/to/keyfile.json"
108
108
  end
109
109
 
110
- pubsub = Google::Cloud::Pubsub.new
110
+ pubsub = Google::Cloud::PubSub.new
111
111
  ```
112
112
 
113
113
  ### Cloud SDK
@@ -1,5 +1,50 @@
1
1
  # Release History
2
2
 
3
+ ### 0.34.0 / 2019-02-01
4
+
5
+ * Switch to use Google::Cloud::PubSub namespace.
6
+ * Add PubSub on_error configuration.
7
+ * Major updates to Subscriber
8
+ * Add dependency on current-ruby.
9
+ * Updates are now made using unary API calls, not the gRPC stream.
10
+ * Update Subscriber inventory lease mechanics:
11
+ * This change will help avoid race conditions by ensuring that
12
+ inventory lease renewal actions don't override ack/nack/delay
13
+ actions made on a received message via the Subscriber callback.
14
+ * Changes to avoid potential race conditions in updates.
15
+ * Add reference?/resource? helper methods:
16
+ * Topic#reference?
17
+ * Topic#resource?
18
+ * Subscription#reference?
19
+ * Subscription#resource?
20
+ * Add documentation for methods that will make an API call
21
+ when called on a reference object.
22
+ * Topic#labels
23
+ * Subscription#topic
24
+ * Subscription#deadline
25
+ * Subscription#retain_acked
26
+ * Subscription#retention
27
+ * Subscription#endpoint
28
+ * Subscription#labels
29
+ * Subscription#exists?
30
+ * Subscription#listen (without deadline optional argument)
31
+ * Add example code for avoiding API calls to Overview guide.
32
+ * Remove the #delay alias for modify_ack_deadline.
33
+ * Users should use the modify_ack_deadline and modify_ack_deadline!
34
+ methods directly instead.
35
+ * Make use of Credentials#project_id
36
+ * Use Credentials#project_id
37
+ If a project_id is not provided, use the value on the Credentials object.
38
+ This value was added in googleauth 0.7.0.
39
+ * Loosen googleauth dependency
40
+ Allow for new releases up to 0.10.
41
+ The googleauth devs have committed to maintanining the current API
42
+ and will not make backwards compatible changes before 0.10.
43
+ * Update low level API
44
+ * Add expiration_policy field
45
+ * Numerous updates and fixes to the low-level documentation,
46
+ including fixes for some broken links.i
47
+
3
48
  ### 0.33.2 / 2018-10-29
4
49
 
5
50
  * Rename delay methods to modify_ack_deadline
@@ -17,7 +17,7 @@ require "google/cloud/pubsub"
17
17
  # Make Pub/Sub use the emulator
18
18
  ENV["PUBSUB_EMULATOR_HOST"] = "localhost:8918"
19
19
 
20
- pubsub = Google::Cloud::Pubsub.new "emulator-project-id"
20
+ pubsub = Google::Cloud::PubSub.new "emulator-project-id"
21
21
 
22
22
  # Get a topic in the current project
23
23
  my_topic = pubsub.new_topic "my-topic"
@@ -29,7 +29,7 @@ Or by providing the `emulator_host` argument:
29
29
  ```ruby
30
30
  require "google/cloud/pubsub"
31
31
 
32
- pubsub = Google::Cloud::Pubsub.new emulator_host: "localhost:8918"
32
+ pubsub = Google::Cloud::PubSub.new emulator_host: "localhost:8918"
33
33
 
34
34
  # Get a topic in the current project
35
35
  my_topic = pubsub.new_topic "my-topic"
@@ -17,7 +17,7 @@ Guide}.
17
17
  ```ruby
18
18
  require "google/cloud/pubsub"
19
19
 
20
- pubsub = Google::Cloud::Pubsub.new
20
+ pubsub = Google::Cloud::PubSub.new
21
21
 
22
22
  topic = pubsub.topic "my-topic"
23
23
  topic.publish "task completed"
@@ -29,24 +29,24 @@ To learn more about Pub/Sub, read the [Google Cloud Pub/Sub Overview
29
29
  ## Retrieving Topics
30
30
 
31
31
  A Topic is a named resource to which messages are sent by publishers. A Topic is
32
- found by its name. (See {Google::Cloud::Pubsub::Project#topic Project#topic})
32
+ found by its name. (See {Google::Cloud::PubSub::Project#topic Project#topic})
33
33
 
34
34
  ```ruby
35
35
  require "google/cloud/pubsub"
36
36
 
37
- pubsub = Google::Cloud::Pubsub.new
37
+ pubsub = Google::Cloud::PubSub.new
38
38
  topic = pubsub.topic "my-topic"
39
39
  ```
40
40
 
41
41
  ## Creating a Topic
42
42
 
43
43
  A Topic is created from a Project. (See
44
- {Google::Cloud::Pubsub::Project#create_topic Project#create_topic})
44
+ {Google::Cloud::PubSub::Project#create_topic Project#create_topic})
45
45
 
46
46
  ```ruby
47
47
  require "google/cloud/pubsub"
48
48
 
49
- pubsub = Google::Cloud::Pubsub.new
49
+ pubsub = Google::Cloud::PubSub.new
50
50
  topic = pubsub.create_topic "my-topic"
51
51
  ```
52
52
 
@@ -55,12 +55,12 @@ topic = pubsub.create_topic "my-topic"
55
55
  A Subscription is a named resource representing the stream of messages from a
56
56
  single, specific Topic, to be delivered to the subscribing application. A
57
57
  Subscription is found by its name. (See
58
- {Google::Cloud::Pubsub::Topic#subscription Topic#subscription})
58
+ {Google::Cloud::PubSub::Topic#subscription Topic#subscription})
59
59
 
60
60
  ```ruby
61
61
  require "google/cloud/pubsub"
62
62
 
63
- pubsub = Google::Cloud::Pubsub.new
63
+ pubsub = Google::Cloud::PubSub.new
64
64
 
65
65
  topic = pubsub.topic "my-topic"
66
66
  subscription = topic.subscription "my-topic-subscription"
@@ -70,12 +70,12 @@ puts subscription.name
70
70
  ## Creating a Subscription
71
71
 
72
72
  A Subscription is created from a Topic. (See
73
- {Google::Cloud::Pubsub::Topic#subscribe Topic#subscribe})
73
+ {Google::Cloud::PubSub::Topic#subscribe Topic#subscribe})
74
74
 
75
75
  ```ruby
76
76
  require "google/cloud/pubsub"
77
77
 
78
- pubsub = Google::Cloud::Pubsub.new
78
+ pubsub = Google::Cloud::PubSub.new
79
79
 
80
80
  topic = pubsub.topic "my-topic"
81
81
  sub = topic.subscribe "my-topic-sub"
@@ -88,7 +88,7 @@ be acknowledged as well as an endpoint URL to push the messages to:
88
88
  ```ruby
89
89
  require "google/cloud/pubsub"
90
90
 
91
- pubsub = Google::Cloud::Pubsub.new
91
+ pubsub = Google::Cloud::PubSub.new
92
92
 
93
93
  topic = pubsub.topic "my-topic"
94
94
  sub = topic.subscribe "my-topic-sub",
@@ -100,12 +100,12 @@ sub = topic.subscribe "my-topic-sub",
100
100
 
101
101
  Messages are published to a topic. Any message published to a topic without a
102
102
  subscription will be lost. Ensure the topic has a subscription before
103
- publishing. (See {Google::Cloud::Pubsub::Topic#publish Topic#publish})
103
+ publishing. (See {Google::Cloud::PubSub::Topic#publish Topic#publish})
104
104
 
105
105
  ```ruby
106
106
  require "google/cloud/pubsub"
107
107
 
108
- pubsub = Google::Cloud::Pubsub.new
108
+ pubsub = Google::Cloud::PubSub.new
109
109
 
110
110
  topic = pubsub.topic "my-topic"
111
111
  msg = topic.publish "task completed"
@@ -116,7 +116,7 @@ Messages can also be published with attributes:
116
116
  ```ruby
117
117
  require "google/cloud/pubsub"
118
118
 
119
- pubsub = Google::Cloud::Pubsub.new
119
+ pubsub = Google::Cloud::PubSub.new
120
120
 
121
121
  topic = pubsub.topic "my-topic"
122
122
  msg = topic.publish "task completed",
@@ -125,13 +125,13 @@ msg = topic.publish "task completed",
125
125
  ```
126
126
 
127
127
  Messages can also be published in batches asynchronously using `publish_async`.
128
- (See {Google::Cloud::Pubsub::Topic#publish_async Topic#publish_async} and
129
- {Google::Cloud::Pubsub::AsyncPublisher AsyncPublisher})
128
+ (See {Google::Cloud::PubSub::Topic#publish_async Topic#publish_async} and
129
+ {Google::Cloud::PubSub::AsyncPublisher AsyncPublisher})
130
130
 
131
131
  ```ruby
132
132
  require "google/cloud/pubsub"
133
133
 
134
- pubsub = Google::Cloud::Pubsub.new
134
+ pubsub = Google::Cloud::PubSub.new
135
135
 
136
136
  topic = pubsub.topic "my-topic"
137
137
  topic.publish_async "task completed" do |result|
@@ -146,12 +146,12 @@ topic.async_publisher.stop.wait!
146
146
  ```
147
147
 
148
148
  Or multiple messages can be published in batches at the same time by passing a
149
- block to `publish`. (See {Google::Cloud::Pubsub::BatchPublisher BatchPublisher})
149
+ block to `publish`. (See {Google::Cloud::PubSub::BatchPublisher BatchPublisher})
150
150
 
151
151
  ```ruby
152
152
  require "google/cloud/pubsub"
153
153
 
154
- pubsub = Google::Cloud::Pubsub.new
154
+ pubsub = Google::Cloud::PubSub.new
155
155
 
156
156
  topic = pubsub.topic "my-topic"
157
157
  msgs = topic.publish do |batch|
@@ -164,13 +164,13 @@ end
164
164
  ## Receiving messages
165
165
 
166
166
  Messages can be streamed from a subscription with a subscriber object that is
167
- created using `listen`. (See {Google::Cloud::Pubsub::Subscription#listen
168
- Subscription#listen} and {Google::Cloud::Pubsub::Subscriber Subscriber})
167
+ created using `listen`. (See {Google::Cloud::PubSub::Subscription#listen
168
+ Subscription#listen} and {Google::Cloud::PubSub::Subscriber Subscriber})
169
169
 
170
170
  ```ruby
171
171
  require "google/cloud/pubsub"
172
172
 
173
- pubsub = Google::Cloud::Pubsub.new
173
+ pubsub = Google::Cloud::PubSub.new
174
174
 
175
175
  sub = pubsub.subscription "my-topic-sub"
176
176
 
@@ -187,12 +187,12 @@ subscriber.stop.wait!
187
187
  ```
188
188
 
189
189
  Messages also can be pulled directly in a one-time operation. (See
190
- {Google::Cloud::Pubsub::Subscription#pull Subscription#pull})
190
+ {Google::Cloud::PubSub::Subscription#pull Subscription#pull})
191
191
 
192
192
  ```ruby
193
193
  require "google/cloud/pubsub"
194
194
 
195
- pubsub = Google::Cloud::Pubsub.new
195
+ pubsub = Google::Cloud::PubSub.new
196
196
 
197
197
  sub = pubsub.subscription "my-topic-sub"
198
198
  received_messages = sub.pull
@@ -203,7 +203,7 @@ A maximum number of messages to pull can be specified:
203
203
  ```ruby
204
204
  require "google/cloud/pubsub"
205
205
 
206
- pubsub = Google::Cloud::Pubsub.new
206
+ pubsub = Google::Cloud::PubSub.new
207
207
 
208
208
  sub = pubsub.subscription "my-topic-sub"
209
209
  received_messages = sub.pull max: 10
@@ -216,13 +216,13 @@ to be removed so it cannot be pulled again.
216
216
 
217
217
  A Message that can be acknowledged is called a ReceivedMessage. ReceivedMessages
218
218
  can be acknowledged one at a time: (See
219
- {Google::Cloud::Pubsub::ReceivedMessage#acknowledge!
219
+ {Google::Cloud::PubSub::ReceivedMessage#acknowledge!
220
220
  ReceivedMessage#acknowledge!})
221
221
 
222
222
  ```ruby
223
223
  require "google/cloud/pubsub"
224
224
 
225
- pubsub = Google::Cloud::Pubsub.new
225
+ pubsub = Google::Cloud::PubSub.new
226
226
 
227
227
  sub = pubsub.subscription "my-topic-sub"
228
228
 
@@ -239,12 +239,12 @@ subscriber.stop.wait!
239
239
  ```
240
240
 
241
241
  Or, multiple messages can be acknowledged in a single API call: (See
242
- {Google::Cloud::Pubsub::Subscription#acknowledge Subscription#acknowledge})
242
+ {Google::Cloud::PubSub::Subscription#acknowledge Subscription#acknowledge})
243
243
 
244
244
  ```ruby
245
245
  require "google/cloud/pubsub"
246
246
 
247
- pubsub = Google::Cloud::Pubsub.new
247
+ pubsub = Google::Cloud::PubSub.new
248
248
 
249
249
  sub = pubsub.subscription "my-topic-sub"
250
250
  received_messages = sub.pull
@@ -257,13 +257,13 @@ A message must be acknowledged after it is pulled, or Pub/Sub will mark the
257
257
  message for redelivery. The message acknowledgement deadline can delayed if more
258
258
  time is needed. This will allow more time to process the message before the
259
259
  message is marked for redelivery. (See
260
- {Google::Cloud::Pubsub::ReceivedMessage#modify_ack_deadline!
260
+ {Google::Cloud::PubSub::ReceivedMessage#modify_ack_deadline!
261
261
  ReceivedMessage#modify_ack_deadline!})
262
262
 
263
263
  ```ruby
264
264
  require "google/cloud/pubsub"
265
265
 
266
- pubsub = Google::Cloud::Pubsub.new
266
+ pubsub = Google::Cloud::PubSub.new
267
267
 
268
268
  sub = pubsub.subscription "my-topic-sub"
269
269
  subscriber = sub.listen do |received_message|
@@ -285,7 +285,7 @@ The message can also be made available for immediate redelivery:
285
285
  ```ruby
286
286
  require "google/cloud/pubsub"
287
287
 
288
- pubsub = Google::Cloud::Pubsub.new
288
+ pubsub = Google::Cloud::PubSub.new
289
289
 
290
290
  sub = pubsub.subscription "my-topic-sub"
291
291
  subscriber = sub.listen do |received_message|
@@ -303,19 +303,57 @@ subscriber.stop.wait!
303
303
  ```
304
304
 
305
305
  Multiple messages can be delayed or made available for immediate redelivery:
306
- (See {Google::Cloud::Pubsub::Subscription#modify_ack_deadline
306
+ (See {Google::Cloud::PubSub::Subscription#modify_ack_deadline
307
307
  Subscription#modify_ack_deadline})
308
308
 
309
309
  ```ruby
310
310
  require "google/cloud/pubsub"
311
311
 
312
- pubsub = Google::Cloud::Pubsub.new
312
+ pubsub = Google::Cloud::PubSub.new
313
313
 
314
314
  sub = pubsub.subscription "my-topic-sub"
315
315
  received_messages = sub.pull
316
316
  sub.modify_ack_deadline 120, received_messages
317
317
  ```
318
318
 
319
+ ## Minimizing API calls before receiving and acknowledging messages
320
+
321
+ A subscription object can be created without making any API calls by providing
322
+ the `skip_lookup` argument to {Google::Cloud::PubSub::Project#subscription
323
+ Project#subscription} or {Google::Cloud::PubSub::Topic#subscription
324
+ Topic#subscription}. A subscriber object can also be created without an API call
325
+ by providing the `deadline` optional argument to
326
+ {Google::Cloud::PubSub::Subscription#listen Subscription#listen}:
327
+
328
+ ```ruby
329
+ require "google/cloud/pubsub"
330
+
331
+ pubsub = Google::Cloud::PubSub.new
332
+
333
+ # No API call is made to retrieve the subscription resource.
334
+ sub = pubsub.subscription "my-topic-sub", skip_lookup: true
335
+
336
+ # No API call is made to retrieve the subscription deadline.
337
+ subscriber = sub.listen deadline: 60 do |received_message|
338
+ # process message
339
+ received_message.acknowledge!
340
+ end
341
+
342
+ # Start background threads that will call block passed to listen.
343
+ subscriber.start
344
+
345
+ # Shut down the subscriber when ready to stop receiving messages.
346
+ subscriber.stop.wait!
347
+ ```
348
+
349
+ Skipping API calls may be used to avoid `Google::Cloud::PermissionDeniedError`
350
+ if your account has limited access to the Pub/Sub API. In particular, the role
351
+ `roles/pubsub.subscriber` does not have the permission
352
+ `pubsub.subscriptions.get`, which is required to retrieve a subscription
353
+ resource. See [Access Control -
354
+ Roles](https://cloud.google.com/pubsub/docs/access-control#tbl_roles) for the
355
+ complete list of Pub/Sub roles and permissions.
356
+
319
357
  ## Creating a snapshot and using seek
320
358
 
321
359
  You can create a snapshot to retain the existing backlog on a subscription. The
@@ -325,14 +363,14 @@ operation.
325
363
 
326
364
  Later, you can use `seek` to reset the subscription's backlog to the snapshot.
327
365
 
328
- (See {Google::Cloud::Pubsub::Subscription#create_snapshot
329
- Subscription#create_snapshot} and {Google::Cloud::Pubsub::Subscription#seek
366
+ (See {Google::Cloud::PubSub::Subscription#create_snapshot
367
+ Subscription#create_snapshot} and {Google::Cloud::PubSub::Subscription#seek
330
368
  Subscription#seek})
331
369
 
332
370
  ```ruby
333
371
  require "google/cloud/pubsub"
334
372
 
335
- pubsub = Google::Cloud::Pubsub.new
373
+ pubsub = Google::Cloud::PubSub.new
336
374
 
337
375
  sub = pubsub.subscription "my-topic-sub"
338
376
 
@@ -348,13 +386,13 @@ sub.seek snapshot
348
386
 
349
387
  A subscriber object can be created using `listen`, which streams messages from
350
388
  the backend and processes them as they are received. (See
351
- {Google::Cloud::Pubsub::Subscription#listen Subscription#listen} and
352
- {Google::Cloud::Pubsub::Subscriber Subscriber})
389
+ {Google::Cloud::PubSub::Subscription#listen Subscription#listen} and
390
+ {Google::Cloud::PubSub::Subscriber Subscriber})
353
391
 
354
392
  ```ruby
355
393
  require "google/cloud/pubsub"
356
394
 
357
- pubsub = Google::Cloud::Pubsub.new
395
+ pubsub = Google::Cloud::PubSub.new
358
396
 
359
397
  sub = pubsub.subscription "my-topic-sub"
360
398
 
@@ -378,7 +416,7 @@ messages.
378
416
  ```ruby
379
417
  require "google/cloud/pubsub"
380
418
 
381
- pubsub = Google::Cloud::Pubsub.new
419
+ pubsub = Google::Cloud::PubSub.new
382
420
 
383
421
  sub = pubsub.subscription "my-topic-sub"
384
422
 
@@ -395,7 +433,7 @@ subscriber.start
395
433
  ## Working Across Projects
396
434
 
397
435
  All calls to the Pub/Sub service use the same project and credentials provided
398
- to the {Google::Cloud::Pubsub.new Pubsub.new} method. However, it is common to
436
+ to the {Google::Cloud::PubSub.new PubSub.new} method. However, it is common to
399
437
  reference topics or subscriptions in other projects, which can be achieved by
400
438
  using the `project` option. The main credentials must have permissions to the
401
439
  topics and subscriptions in other projects.
@@ -403,7 +441,7 @@ topics and subscriptions in other projects.
403
441
  ```ruby
404
442
  require "google/cloud/pubsub"
405
443
 
406
- pubsub = Google::Cloud::Pubsub.new # my-project
444
+ pubsub = Google::Cloud::PubSub.new # my-project
407
445
 
408
446
  # Get a topic in the current project
409
447
  my_topic = pubsub.topic "my-topic"
@@ -419,7 +457,7 @@ from a topic in another project:
419
457
  ```ruby
420
458
  require "google/cloud/pubsub"
421
459
 
422
- pubsub = Google::Cloud::Pubsub.new # my-project
460
+ pubsub = Google::Cloud::PubSub.new # my-project
423
461
 
424
462
  # Get a topic in another project
425
463
  topic = pubsub.topic "other-topic", project: "other-project-id"