File: acknowledge_subscription.rb

package info (click to toggle)
ruby-fog-google 1.19.0-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,568 kB
  • sloc: ruby: 16,775; makefile: 3
file content (29 lines) | stat: -rw-r--r-- 900 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
module Fog
  module Google
    class Pubsub
      class Real
        # Acknowledges a message received from a subscription.
        #
        # @see https://cloud.google.com/pubsub/reference/rest/v1/projects.subscriptions/acknowledge
        def acknowledge_subscription(subscription, ack_ids)
          # Previous behavior allowed passing a single ack_id without being wrapped in an Array,
          # this is for backwards compatibility.
          unless ack_ids.is_a?(Array)
            ack_ids = [ack_ids]
          end
          ack_request = ::Google::Apis::PubsubV1::AcknowledgeRequest.new(
            ack_ids: ack_ids
          )

          @pubsub.acknowledge_subscription(subscription, ack_request)
        end
      end

      class Mock
        def acknowledge_subscription(_subscription, _ack_ids)
          raise Fog::Errors::MockNotImplemented
        end
      end
    end
  end
end