google-cloud-pubsub 0.20.1 → 0.21.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google-cloud-pubsub.rb +13 -26
- data/lib/google/cloud/pubsub.rb +106 -86
- data/lib/google/cloud/pubsub/message.rb +2 -3
- data/lib/google/cloud/pubsub/policy.rb +13 -17
- data/lib/google/cloud/pubsub/project.rb +52 -73
- data/lib/google/cloud/pubsub/received_message.rb +6 -9
- data/lib/google/cloud/pubsub/service.rb +172 -152
- data/lib/google/cloud/pubsub/subscription.rb +41 -60
- data/lib/google/cloud/pubsub/subscription/list.rb +10 -15
- data/lib/google/cloud/pubsub/topic.rb +44 -64
- data/lib/google/cloud/pubsub/topic/list.rb +10 -15
- data/lib/google/cloud/pubsub/topic/publisher.rb +2 -3
- data/lib/google/cloud/pubsub/v1/publisher_api.rb +232 -11
- data/lib/google/cloud/pubsub/v1/publisher_client_config.json +15 -0
- data/lib/google/cloud/pubsub/v1/subscriber_api.rb +249 -17
- data/lib/google/cloud/pubsub/v1/subscriber_client_config.json +15 -0
- data/lib/google/cloud/pubsub/version.rb +1 -1
- data/lib/google/pubsub/v1/pubsub_services_pb.rb +6 -4
- metadata +36 -11
- data/lib/google/iam/v1/iam_policy.rb +0 -33
- data/lib/google/iam/v1/iam_policy_services.rb +0 -30
- data/lib/google/iam/v1/policy.rb +0 -25
| @@ -27,10 +27,9 @@ module Google | |
| 27 27 | 
             
                  # specific {Topic}, to be delivered to the subscribing application.
         | 
| 28 28 | 
             
                  #
         | 
| 29 29 | 
             
                  # @example
         | 
| 30 | 
            -
                  #   require "google/cloud"
         | 
| 30 | 
            +
                  #   require "google/cloud/pubsub"
         | 
| 31 31 | 
             
                  #
         | 
| 32 | 
            -
                  #    | 
| 33 | 
            -
                  #   pubsub = gcloud.pubsub
         | 
| 32 | 
            +
                  #   pubsub = Google::Cloud::Pubsub.new
         | 
| 34 33 | 
             
                  #
         | 
| 35 34 | 
             
                  #   sub = pubsub.subscription "my-topic-sub"
         | 
| 36 35 | 
             
                  #   msgs = sub.pull
         | 
| @@ -38,7 +37,7 @@ module Google | |
| 38 37 | 
             
                  #
         | 
| 39 38 | 
             
                  class Subscription
         | 
| 40 39 | 
             
                    ##
         | 
| 41 | 
            -
                    # @private The  | 
| 40 | 
            +
                    # @private The Service object.
         | 
| 42 41 | 
             
                    attr_accessor :service
         | 
| 43 42 |  | 
| 44 43 | 
             
                    ##
         | 
| @@ -77,10 +76,9 @@ module Google | |
| 77 76 | 
             
                    # @return [Topic]
         | 
| 78 77 | 
             
                    #
         | 
| 79 78 | 
             
                    # @example
         | 
| 80 | 
            -
                    #   require "google/cloud"
         | 
| 79 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 81 80 | 
             
                    #
         | 
| 82 | 
            -
                    #    | 
| 83 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 81 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 84 82 | 
             
                    #
         | 
| 85 83 | 
             
                    #   sub = pubsub.subscription "my-topic-sub"
         | 
| 86 84 | 
             
                    #   sub.topic.name #=> "projects/my-project/topics/my-topic"
         | 
| @@ -122,10 +120,9 @@ module Google | |
| 122 120 | 
             
                    # Determines whether the subscription exists in the Pub/Sub service.
         | 
| 123 121 | 
             
                    #
         | 
| 124 122 | 
             
                    # @example
         | 
| 125 | 
            -
                    #   require "google/cloud"
         | 
| 123 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 126 124 | 
             
                    #
         | 
| 127 | 
            -
                    #    | 
| 128 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 125 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 129 126 | 
             
                    #
         | 
| 130 127 | 
             
                    #   sub = pubsub.subscription "my-topic-sub"
         | 
| 131 128 | 
             
                    #   sub.exists? #=> true
         | 
| @@ -147,10 +144,9 @@ module Google | |
| 147 144 | 
             
                    # HTTP call.
         | 
| 148 145 | 
             
                    #
         | 
| 149 146 | 
             
                    # @example
         | 
| 150 | 
            -
                    #   require "google/cloud"
         | 
| 147 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 151 148 | 
             
                    #
         | 
| 152 | 
            -
                    #    | 
| 153 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 149 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 154 150 | 
             
                    #
         | 
| 155 151 | 
             
                    #   sub = pubsub.get_subscription "my-topic-sub"
         | 
| 156 152 | 
             
                    #   sub.lazy? #=> false
         | 
| @@ -166,10 +162,9 @@ module Google | |
| 166 162 | 
             
                    # @return [Boolean] Returns `true` if the subscription was deleted.
         | 
| 167 163 | 
             
                    #
         | 
| 168 164 | 
             
                    # @example
         | 
| 169 | 
            -
                    #   require "google/cloud"
         | 
| 165 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 170 166 | 
             
                    #
         | 
| 171 | 
            -
                    #    | 
| 172 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 167 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 173 168 | 
             
                    #
         | 
| 174 169 | 
             
                    #   sub = pubsub.subscription "my-topic-sub"
         | 
| 175 170 | 
             
                    #   sub.delete
         | 
| @@ -200,28 +195,25 @@ module Google | |
| 200 195 | 
             
                    # @return [Array<Google::Cloud::Pubsub::ReceivedMessage>]
         | 
| 201 196 | 
             
                    #
         | 
| 202 197 | 
             
                    # @example
         | 
| 203 | 
            -
                    #   require "google/cloud"
         | 
| 198 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 204 199 | 
             
                    #
         | 
| 205 | 
            -
                    #    | 
| 206 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 200 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 207 201 | 
             
                    #
         | 
| 208 202 | 
             
                    #   sub = pubsub.subscription "my-topic-sub"
         | 
| 209 203 | 
             
                    #   sub.pull.each { |msg| msg.acknowledge! }
         | 
| 210 204 | 
             
                    #
         | 
| 211 205 | 
             
                    # @example A maximum number of messages returned can also be specified:
         | 
| 212 | 
            -
                    #   require "google/cloud"
         | 
| 206 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 213 207 | 
             
                    #
         | 
| 214 | 
            -
                    #    | 
| 215 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 208 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 216 209 | 
             
                    #
         | 
| 217 210 | 
             
                    #   sub = pubsub.subscription "my-topic-sub", max: 10
         | 
| 218 211 | 
             
                    #   sub.pull.each { |msg| msg.acknowledge! }
         | 
| 219 212 | 
             
                    #
         | 
| 220 213 | 
             
                    # @example The call can block until messages are available:
         | 
| 221 | 
            -
                    #   require "google/cloud"
         | 
| 214 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 222 215 | 
             
                    #
         | 
| 223 | 
            -
                    #    | 
| 224 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 216 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 225 217 | 
             
                    #
         | 
| 226 218 | 
             
                    #   sub = pubsub.subscription "my-topic-sub"
         | 
| 227 219 | 
             
                    #   msgs = sub.pull immediate: false
         | 
| @@ -255,10 +247,9 @@ module Google | |
| 255 247 | 
             
                    # @return [Array<Google::Cloud::Pubsub::ReceivedMessage>]
         | 
| 256 248 | 
             
                    #
         | 
| 257 249 | 
             
                    # @example
         | 
| 258 | 
            -
                    #   require "google/cloud"
         | 
| 250 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 259 251 | 
             
                    #
         | 
| 260 | 
            -
                    #    | 
| 261 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 252 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 262 253 | 
             
                    #
         | 
| 263 254 | 
             
                    #   sub = pubsub.subscription "my-topic-sub"
         | 
| 264 255 | 
             
                    #   msgs = sub.wait_for_messages
         | 
| @@ -285,10 +276,9 @@ module Google | |
| 285 276 | 
             
                    # @yieldparam [ReceivedMessage] msg the newly received message
         | 
| 286 277 | 
             
                    #
         | 
| 287 278 | 
             
                    # @example
         | 
| 288 | 
            -
                    #   require "google/cloud"
         | 
| 279 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 289 280 | 
             
                    #
         | 
| 290 | 
            -
                    #    | 
| 291 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 281 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 292 282 | 
             
                    #
         | 
| 293 283 | 
             
                    #   sub = pubsub.subscription "my-topic-sub"
         | 
| 294 284 | 
             
                    #   sub.listen do |msg|
         | 
| @@ -296,10 +286,9 @@ module Google | |
| 296 286 | 
             
                    #   end
         | 
| 297 287 | 
             
                    #
         | 
| 298 288 | 
             
                    # @example Limit number of messages pulled per API request with `max`:
         | 
| 299 | 
            -
                    #   require "google/cloud"
         | 
| 289 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 300 290 | 
             
                    #
         | 
| 301 | 
            -
                    #    | 
| 302 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 291 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 303 292 | 
             
                    #
         | 
| 304 293 | 
             
                    #   sub = pubsub.subscription "my-topic-sub"
         | 
| 305 294 | 
             
                    #   sub.listen max: 20 do |msg|
         | 
| @@ -307,10 +296,9 @@ module Google | |
| 307 296 | 
             
                    #   end
         | 
| 308 297 | 
             
                    #
         | 
| 309 298 | 
             
                    # @example Automatically acknowledge messages with `autoack`:
         | 
| 310 | 
            -
                    #   require "google/cloud"
         | 
| 299 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 311 300 | 
             
                    #
         | 
| 312 | 
            -
                    #    | 
| 313 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 301 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 314 302 | 
             
                    #
         | 
| 315 303 | 
             
                    #   sub = pubsub.subscription "my-topic-sub"
         | 
| 316 304 | 
             
                    #   sub.listen autoack: true do |msg|
         | 
| @@ -340,10 +328,9 @@ module Google | |
| 340 328 | 
             
                    #   {ReceivedMessage} objects or ack_id values.
         | 
| 341 329 | 
             
                    #
         | 
| 342 330 | 
             
                    # @example
         | 
| 343 | 
            -
                    #   require "google/cloud"
         | 
| 331 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 344 332 | 
             
                    #
         | 
| 345 | 
            -
                    #    | 
| 346 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 333 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 347 334 | 
             
                    #
         | 
| 348 335 | 
             
                    #   sub = pubsub.subscription "my-topic-sub"
         | 
| 349 336 | 
             
                    #   messages = sub.pull
         | 
| @@ -374,10 +361,9 @@ module Google | |
| 374 361 | 
             
                    #   {ReceivedMessage} objects or ack_id values.
         | 
| 375 362 | 
             
                    #
         | 
| 376 363 | 
             
                    # @example
         | 
| 377 | 
            -
                    #   require "google/cloud"
         | 
| 364 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 378 365 | 
             
                    #
         | 
| 379 | 
            -
                    #    | 
| 380 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 366 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 381 367 | 
             
                    #
         | 
| 382 368 | 
             
                    #   sub = pubsub.subscription "my-topic-sub"
         | 
| 383 369 | 
             
                    #   messages = sub.pull
         | 
| @@ -394,7 +380,7 @@ module Google | |
| 394 380 | 
             
                    # Gets the [Cloud IAM](https://cloud.google.com/iam/) access control
         | 
| 395 381 | 
             
                    # policy for this subscription.
         | 
| 396 382 | 
             
                    #
         | 
| 397 | 
            -
                    # @see https://cloud.google.com/pubsub/reference/rpc/google.iam.v1#iampolicy
         | 
| 383 | 
            +
                    # @see https://cloud.google.com/pubsub/docs/reference/rpc/google.iam.v1#iampolicy
         | 
| 398 384 | 
             
                    #   google.iam.v1.IAMPolicy
         | 
| 399 385 | 
             
                    #
         | 
| 400 386 | 
             
                    # @param [Boolean] force Force the latest policy to be retrieved from
         | 
| @@ -412,30 +398,27 @@ module Google | |
| 412 398 | 
             
                    # @return [Policy] the current Cloud IAM Policy for this subscription
         | 
| 413 399 | 
             
                    #
         | 
| 414 400 | 
             
                    # @example Policy values are memoized to reduce the number of API calls:
         | 
| 415 | 
            -
                    #   require "google/cloud"
         | 
| 401 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 416 402 | 
             
                    #
         | 
| 417 | 
            -
                    #    | 
| 418 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 403 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 419 404 | 
             
                    #   sub = pubsub.subscription "my-subscription"
         | 
| 420 405 | 
             
                    #
         | 
| 421 406 | 
             
                    #   policy = sub.policy # API call
         | 
| 422 407 | 
             
                    #   policy_2 = sub.policy # No API call
         | 
| 423 408 | 
             
                    #
         | 
| 424 409 | 
             
                    # @example Use `force` to retrieve the latest policy from the service:
         | 
| 425 | 
            -
                    #   require "google/cloud"
         | 
| 410 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 426 411 | 
             
                    #
         | 
| 427 | 
            -
                    #    | 
| 428 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 412 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 429 413 | 
             
                    #   sub = pubsub.subscription "my-subscription"
         | 
| 430 414 | 
             
                    #
         | 
| 431 415 | 
             
                    #   policy = sub.policy force: true # API call
         | 
| 432 416 | 
             
                    #   policy_2 = sub.policy force: true # API call
         | 
| 433 417 | 
             
                    #
         | 
| 434 418 | 
             
                    # @example Update the policy by passing a block:
         | 
| 435 | 
            -
                    #   require "google/cloud"
         | 
| 419 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 436 420 | 
             
                    #
         | 
| 437 | 
            -
                    #    | 
| 438 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 421 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 439 422 | 
             
                    #   sub = pubsub.subscription "my-subscription"
         | 
| 440 423 | 
             
                    #
         | 
| 441 424 | 
             
                    #   policy = sub.policy do |p|
         | 
| @@ -464,17 +447,16 @@ module Google | |
| 464 447 | 
             
                    # You can also update the policy by passing a block to {#policy}, which
         | 
| 465 448 | 
             
                    # will call this method internally after the block completes.
         | 
| 466 449 | 
             
                    #
         | 
| 467 | 
            -
                    # @see https://cloud.google.com/pubsub/reference/rpc/google.iam.v1#iampolicy
         | 
| 450 | 
            +
                    # @see https://cloud.google.com/pubsub/docs/reference/rpc/google.iam.v1#iampolicy
         | 
| 468 451 | 
             
                    #   google.iam.v1.IAMPolicy
         | 
| 469 452 | 
             
                    #
         | 
| 470 453 | 
             
                    # @param [Policy] new_policy a new or modified Cloud IAM Policy for this
         | 
| 471 454 | 
             
                    #   subscription
         | 
| 472 455 | 
             
                    #
         | 
| 473 456 | 
             
                    # @example
         | 
| 474 | 
            -
                    #   require "google/cloud"
         | 
| 457 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 475 458 | 
             
                    #
         | 
| 476 | 
            -
                    #    | 
| 477 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 459 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 478 460 | 
             
                    #   sub = pubsub.subscription "my-subscription"
         | 
| 479 461 | 
             
                    #
         | 
| 480 462 | 
             
                    #   policy = sub.policy # API call
         | 
| @@ -512,10 +494,9 @@ module Google | |
| 512 494 | 
             
                    # @return [Array<String>] The permissions that have access.
         | 
| 513 495 | 
             
                    #
         | 
| 514 496 | 
             
                    # @example
         | 
| 515 | 
            -
                    #   require "google/cloud"
         | 
| 497 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 516 498 | 
             
                    #
         | 
| 517 | 
            -
                    #    | 
| 518 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 499 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 519 500 | 
             
                    #   sub = pubsub.subscription "my-subscription"
         | 
| 520 501 | 
             
                    #   perms = sub.test_permissions "pubsub.subscriptions.get",
         | 
| 521 502 | 
             
                    #                                "pubsub.subscriptions.consume"
         | 
| @@ -44,10 +44,9 @@ module Google | |
| 44 44 | 
             
                      # @return [Boolean]
         | 
| 45 45 | 
             
                      #
         | 
| 46 46 | 
             
                      # @example
         | 
| 47 | 
            -
                      #   require "google/cloud"
         | 
| 47 | 
            +
                      #   require "google/cloud/pubsub"
         | 
| 48 48 | 
             
                      #
         | 
| 49 | 
            -
                      #    | 
| 50 | 
            -
                      #   pubsub = gcloud.pubsub
         | 
| 49 | 
            +
                      #   pubsub = Google::Cloud::Pubsub.new
         | 
| 51 50 | 
             
                      #
         | 
| 52 51 | 
             
                      #   subscriptions = pubsub.subscriptions
         | 
| 53 52 | 
             
                      #   if subscriptions.next?
         | 
| @@ -64,10 +63,9 @@ module Google | |
| 64 63 | 
             
                      # @return [Subscription::List]
         | 
| 65 64 | 
             
                      #
         | 
| 66 65 | 
             
                      # @example
         | 
| 67 | 
            -
                      #   require "google/cloud"
         | 
| 66 | 
            +
                      #   require "google/cloud/pubsub"
         | 
| 68 67 | 
             
                      #
         | 
| 69 | 
            -
                      #    | 
| 70 | 
            -
                      #   pubsub = gcloud.pubsub
         | 
| 68 | 
            +
                      #   pubsub = Google::Cloud::Pubsub.new
         | 
| 71 69 | 
             
                      #
         | 
| 72 70 | 
             
                      #   subscriptions = pubsub.subscriptions
         | 
| 73 71 | 
             
                      #   if subscriptions.next?
         | 
| @@ -103,10 +101,9 @@ module Google | |
| 103 101 | 
             
                      # @return [Enumerator]
         | 
| 104 102 | 
             
                      #
         | 
| 105 103 | 
             
                      # @example Iterating each subscription by passing a block:
         | 
| 106 | 
            -
                      #   require "google/cloud"
         | 
| 104 | 
            +
                      #   require "google/cloud/pubsub"
         | 
| 107 105 | 
             
                      #
         | 
| 108 | 
            -
                      #    | 
| 109 | 
            -
                      #   pubsub = gcloud.pubsub
         | 
| 106 | 
            +
                      #   pubsub = Google::Cloud::Pubsub.new
         | 
| 110 107 | 
             
                      #
         | 
| 111 108 | 
             
                      #   subscriptions = pubsub.subscriptions
         | 
| 112 109 | 
             
                      #   subscriptions.all do |subscription|
         | 
| @@ -114,10 +111,9 @@ module Google | |
| 114 111 | 
             
                      #   end
         | 
| 115 112 | 
             
                      #
         | 
| 116 113 | 
             
                      # @example Using the enumerator by not passing a block:
         | 
| 117 | 
            -
                      #   require "google/cloud"
         | 
| 114 | 
            +
                      #   require "google/cloud/pubsub"
         | 
| 118 115 | 
             
                      #
         | 
| 119 | 
            -
                      #    | 
| 120 | 
            -
                      #   pubsub = gcloud.pubsub
         | 
| 116 | 
            +
                      #   pubsub = Google::Cloud::Pubsub.new
         | 
| 121 117 | 
             
                      #
         | 
| 122 118 | 
             
                      #   subscriptions = pubsub.subscriptions
         | 
| 123 119 | 
             
                      #   all_names = subscriptions.all.map do |subscription|
         | 
| @@ -125,10 +121,9 @@ module Google | |
| 125 121 | 
             
                      #   end
         | 
| 126 122 | 
             
                      #
         | 
| 127 123 | 
             
                      # @example Limit the number of API calls made:
         | 
| 128 | 
            -
                      #   require "google/cloud"
         | 
| 124 | 
            +
                      #   require "google/cloud/pubsub"
         | 
| 129 125 | 
             
                      #
         | 
| 130 | 
            -
                      #    | 
| 131 | 
            -
                      #   pubsub = gcloud.pubsub
         | 
| 126 | 
            +
                      #   pubsub = Google::Cloud::Pubsub.new
         | 
| 132 127 | 
             
                      #
         | 
| 133 128 | 
             
                      #   subscriptions = pubsub.subscriptions
         | 
| 134 129 | 
             
                      #   subscriptions.all(request_limit: 10) do |subscription|
         | 
| @@ -28,21 +28,20 @@ module Google | |
| 28 28 | 
             
                  # A named resource to which messages are published.
         | 
| 29 29 | 
             
                  #
         | 
| 30 30 | 
             
                  # @example
         | 
| 31 | 
            -
                  #   require "google/cloud"
         | 
| 31 | 
            +
                  #   require "google/cloud/pubsub"
         | 
| 32 32 | 
             
                  #
         | 
| 33 | 
            -
                  #    | 
| 34 | 
            -
                  #   pubsub = gcloud.pubsub
         | 
| 33 | 
            +
                  #   pubsub = Google::Cloud::Pubsub.new
         | 
| 35 34 | 
             
                  #
         | 
| 36 35 | 
             
                  #   topic = pubsub.topic "my-topic"
         | 
| 37 36 | 
             
                  #   topic.publish "task completed"
         | 
| 38 37 | 
             
                  #
         | 
| 39 38 | 
             
                  class Topic
         | 
| 40 39 | 
             
                    ##
         | 
| 41 | 
            -
                    # @private The  | 
| 40 | 
            +
                    # @private The Service object.
         | 
| 42 41 | 
             
                    attr_accessor :service
         | 
| 43 42 |  | 
| 44 43 | 
             
                    ##
         | 
| 45 | 
            -
                    # @private The  | 
| 44 | 
            +
                    # @private The Google::Pubsub::V1::Topic object.
         | 
| 46 45 | 
             
                    attr_accessor :grpc
         | 
| 47 46 |  | 
| 48 47 | 
             
                    ##
         | 
| @@ -77,10 +76,9 @@ module Google | |
| 77 76 | 
             
                    # @return [Boolean] Returns `true` if the topic was deleted.
         | 
| 78 77 | 
             
                    #
         | 
| 79 78 | 
             
                    # @example
         | 
| 80 | 
            -
                    #   require "google/cloud"
         | 
| 79 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 81 80 | 
             
                    #
         | 
| 82 | 
            -
                    #    | 
| 83 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 81 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 84 82 | 
             
                    #
         | 
| 85 83 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 86 84 | 
             
                    #   topic.delete
         | 
| @@ -108,30 +106,27 @@ module Google | |
| 108 106 | 
             
                    # @return [Google::Cloud::Pubsub::Subscription]
         | 
| 109 107 | 
             
                    #
         | 
| 110 108 | 
             
                    # @example
         | 
| 111 | 
            -
                    #   require "google/cloud"
         | 
| 109 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 112 110 | 
             
                    #
         | 
| 113 | 
            -
                    #    | 
| 114 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 111 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 115 112 | 
             
                    #
         | 
| 116 113 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 117 114 | 
             
                    #   sub = topic.subscribe "my-topic-sub"
         | 
| 118 115 | 
             
                    #   puts sub.name # => "my-topic-sub"
         | 
| 119 116 | 
             
                    #
         | 
| 120 117 | 
             
                    # @example The name is optional, and will be generated if not given:
         | 
| 121 | 
            -
                    #   require "google/cloud"
         | 
| 118 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 122 119 | 
             
                    #
         | 
| 123 | 
            -
                    #    | 
| 124 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 120 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 125 121 | 
             
                    #
         | 
| 126 122 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 127 123 | 
             
                    #   sub = topic.subscribe "my-topic-sub"
         | 
| 128 124 | 
             
                    #   puts sub.name # => "generated-sub-name"
         | 
| 129 125 | 
             
                    #
         | 
| 130 126 | 
             
                    # @example Wait 2 minutes for acknowledgement and push all to endpoint:
         | 
| 131 | 
            -
                    #   require "google/cloud"
         | 
| 127 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 132 128 | 
             
                    #
         | 
| 133 | 
            -
                    #    | 
| 134 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 129 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 135 130 | 
             
                    #
         | 
| 136 131 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 137 132 | 
             
                    #   sub = topic.subscribe "my-topic-sub",
         | 
| @@ -160,20 +155,18 @@ module Google | |
| 160 155 | 
             
                    #   the subscription does not exist.
         | 
| 161 156 | 
             
                    #
         | 
| 162 157 | 
             
                    # @example
         | 
| 163 | 
            -
                    #   require "google/cloud"
         | 
| 158 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 164 159 | 
             
                    #
         | 
| 165 | 
            -
                    #    | 
| 166 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 160 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 167 161 | 
             
                    #
         | 
| 168 162 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 169 163 | 
             
                    #   subscription = topic.subscription "my-topic-subscription"
         | 
| 170 164 | 
             
                    #   puts subscription.name
         | 
| 171 165 | 
             
                    #
         | 
| 172 166 | 
             
                    # @example Skip the lookup against the service with `skip_lookup`:
         | 
| 173 | 
            -
                    #   require "google/cloud"
         | 
| 167 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 174 168 | 
             
                    #
         | 
| 175 | 
            -
                    #    | 
| 176 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 169 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 177 170 | 
             
                    #
         | 
| 178 171 | 
             
                    #   # No API call is made to retrieve the subscription information.
         | 
| 179 172 | 
             
                    #   subscription = pubsub.subscription "my-sub", skip_lookup: true
         | 
| @@ -201,10 +194,9 @@ module Google | |
| 201 194 | 
             
                    # @return [Array<Subscription>] (See {Subscription::List})
         | 
| 202 195 | 
             
                    #
         | 
| 203 196 | 
             
                    # @example
         | 
| 204 | 
            -
                    #   require "google/cloud"
         | 
| 197 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 205 198 | 
             
                    #
         | 
| 206 | 
            -
                    #    | 
| 207 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 199 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 208 200 | 
             
                    #
         | 
| 209 201 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 210 202 | 
             
                    #   subscription = topic.subscriptions
         | 
| @@ -213,10 +205,9 @@ module Google | |
| 213 205 | 
             
                    #   end
         | 
| 214 206 | 
             
                    #
         | 
| 215 207 | 
             
                    # @example Retrieve all subscriptions: (See {Subscription::List#all})
         | 
| 216 | 
            -
                    #   require "google/cloud"
         | 
| 208 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 217 209 | 
             
                    #
         | 
| 218 | 
            -
                    #    | 
| 219 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 210 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 220 211 | 
             
                    #
         | 
| 221 212 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 222 213 | 
             
                    #   subscription = topic.subscriptions
         | 
| @@ -247,28 +238,25 @@ module Google | |
| 247 238 | 
             
                    #   block.
         | 
| 248 239 | 
             
                    #
         | 
| 249 240 | 
             
                    # @example
         | 
| 250 | 
            -
                    #   require "google/cloud"
         | 
| 241 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 251 242 | 
             
                    #
         | 
| 252 | 
            -
                    #    | 
| 253 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 243 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 254 244 | 
             
                    #
         | 
| 255 245 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 256 246 | 
             
                    #   msg = topic.publish "new-message"
         | 
| 257 247 | 
             
                    #
         | 
| 258 248 | 
             
                    # @example A message can be published using a File object:
         | 
| 259 | 
            -
                    #   require "google/cloud"
         | 
| 249 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 260 250 | 
             
                    #
         | 
| 261 | 
            -
                    #    | 
| 262 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 251 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 263 252 | 
             
                    #
         | 
| 264 253 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 265 254 | 
             
                    #   msg = topic.publish File.open("message.txt")
         | 
| 266 255 | 
             
                    #
         | 
| 267 256 | 
             
                    # @example Additionally, a message can be published with attributes:
         | 
| 268 | 
            -
                    #   require "google/cloud"
         | 
| 257 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 269 258 | 
             
                    #
         | 
| 270 | 
            -
                    #    | 
| 271 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 259 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 272 260 | 
             
                    #
         | 
| 273 261 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 274 262 | 
             
                    #   msg = topic.publish "new-message",
         | 
| @@ -276,10 +264,9 @@ module Google | |
| 276 264 | 
             
                    #                       this: :that
         | 
| 277 265 | 
             
                    #
         | 
| 278 266 | 
             
                    # @example Multiple messages can be sent at the same time using a block:
         | 
| 279 | 
            -
                    #   require "google/cloud"
         | 
| 267 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 280 268 | 
             
                    #
         | 
| 281 | 
            -
                    #    | 
| 282 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 269 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 283 270 | 
             
                    #
         | 
| 284 271 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 285 272 | 
             
                    #   msgs = topic.publish do |t|
         | 
| @@ -300,7 +287,7 @@ module Google | |
| 300 287 | 
             
                    # Gets the [Cloud IAM](https://cloud.google.com/iam/) access control
         | 
| 301 288 | 
             
                    # policy for this topic.
         | 
| 302 289 | 
             
                    #
         | 
| 303 | 
            -
                    # @see https://cloud.google.com/pubsub/reference/rpc/google.iam.v1#iampolicy
         | 
| 290 | 
            +
                    # @see https://cloud.google.com/pubsub/docs/reference/rpc/google.iam.v1#iampolicy
         | 
| 304 291 | 
             
                    #   google.iam.v1.IAMPolicy
         | 
| 305 292 | 
             
                    #
         | 
| 306 293 | 
             
                    # @param [Boolean] force Force the latest policy to be retrieved from
         | 
| @@ -318,30 +305,27 @@ module Google | |
| 318 305 | 
             
                    # @return [Policy] the current Cloud IAM Policy for this topic
         | 
| 319 306 | 
             
                    #
         | 
| 320 307 | 
             
                    # @example Policy values are memoized to reduce the number of API calls:
         | 
| 321 | 
            -
                    #   require "google/cloud"
         | 
| 308 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 322 309 | 
             
                    #
         | 
| 323 | 
            -
                    #    | 
| 324 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 310 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 325 311 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 326 312 | 
             
                    #
         | 
| 327 313 | 
             
                    #   policy = topic.policy # API call
         | 
| 328 314 | 
             
                    #   policy_2 = topic.policy # No API call
         | 
| 329 315 | 
             
                    #
         | 
| 330 316 | 
             
                    # @example Use `force` to retrieve the latest policy from the service:
         | 
| 331 | 
            -
                    #   require "google/cloud"
         | 
| 317 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 332 318 | 
             
                    #
         | 
| 333 | 
            -
                    #    | 
| 334 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 319 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 335 320 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 336 321 | 
             
                    #
         | 
| 337 322 | 
             
                    #   policy = topic.policy force: true # API call
         | 
| 338 323 | 
             
                    #   policy_2 = topic.policy force: true # API call
         | 
| 339 324 | 
             
                    #
         | 
| 340 325 | 
             
                    # @example Update the policy by passing a block:
         | 
| 341 | 
            -
                    #   require "google/cloud"
         | 
| 326 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 342 327 | 
             
                    #
         | 
| 343 | 
            -
                    #    | 
| 344 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 328 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 345 329 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 346 330 | 
             
                    #
         | 
| 347 331 | 
             
                    #   policy = topic.policy do |p|
         | 
| @@ -370,17 +354,16 @@ module Google | |
| 370 354 | 
             
                    # You can also update the policy by passing a block to {#policy}, which
         | 
| 371 355 | 
             
                    # will call this method internally after the block completes.
         | 
| 372 356 | 
             
                    #
         | 
| 373 | 
            -
                    # @see https://cloud.google.com/pubsub/reference/rpc/google.iam.v1#iampolicy
         | 
| 357 | 
            +
                    # @see https://cloud.google.com/pubsub/docs/reference/rpc/google.iam.v1#iampolicy
         | 
| 374 358 | 
             
                    #   google.iam.v1.IAMPolicy
         | 
| 375 359 | 
             
                    #
         | 
| 376 360 | 
             
                    # @param [Policy] new_policy a new or modified Cloud IAM Policy for this
         | 
| 377 361 | 
             
                    #   topic
         | 
| 378 362 | 
             
                    #
         | 
| 379 363 | 
             
                    # @example
         | 
| 380 | 
            -
                    #   require "google/cloud"
         | 
| 364 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 381 365 | 
             
                    #
         | 
| 382 | 
            -
                    #    | 
| 383 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 366 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 384 367 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 385 368 | 
             
                    #
         | 
| 386 369 | 
             
                    #   policy = topic.policy # API call
         | 
| @@ -419,10 +402,9 @@ module Google | |
| 419 402 | 
             
                    # @return [Array<Strings>] The permissions that have access.
         | 
| 420 403 | 
             
                    #
         | 
| 421 404 | 
             
                    # @example
         | 
| 422 | 
            -
                    #   require "google/cloud"
         | 
| 405 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 423 406 | 
             
                    #
         | 
| 424 | 
            -
                    #    | 
| 425 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 407 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 426 408 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 427 409 | 
             
                    #   perms = topic.test_permissions "pubsub.topics.get",
         | 
| 428 410 | 
             
                    #                                  "pubsub.topics.publish"
         | 
| @@ -441,10 +423,9 @@ module Google | |
| 441 423 | 
             
                    # Determines whether the topic exists in the Pub/Sub service.
         | 
| 442 424 | 
             
                    #
         | 
| 443 425 | 
             
                    # @example
         | 
| 444 | 
            -
                    #   require "google/cloud"
         | 
| 426 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 445 427 | 
             
                    #
         | 
| 446 | 
            -
                    #    | 
| 447 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 428 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 448 429 | 
             
                    #
         | 
| 449 430 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 450 431 | 
             
                    #   topic.exists? #=> true
         | 
| @@ -463,10 +444,9 @@ module Google | |
| 463 444 | 
             
                    # Determines whether the topic object was created with an HTTP call.
         | 
| 464 445 | 
             
                    #
         | 
| 465 446 | 
             
                    # @example
         | 
| 466 | 
            -
                    #   require "google/cloud"
         | 
| 447 | 
            +
                    #   require "google/cloud/pubsub"
         | 
| 467 448 | 
             
                    #
         | 
| 468 | 
            -
                    #    | 
| 469 | 
            -
                    #   pubsub = gcloud.pubsub
         | 
| 449 | 
            +
                    #   pubsub = Google::Cloud::Pubsub.new
         | 
| 470 450 | 
             
                    #
         | 
| 471 451 | 
             
                    #   topic = pubsub.topic "my-topic"
         | 
| 472 452 | 
             
                    #   topic.lazy? #=> false
         |