Sha256: 65192fdccd995b5e0e96ad85a67f5095c9a5650437297cf19bfe188faaeef8b0

Contents?: true

Size: 1.2 KB

Versions: 13

Compression:

Stored size: 1.2 KB

Contents

module Fog
  module Google
    class Pubsub
      class Real
        # Gets a list of all subscriptions for a given project.
        #
        # @param_name project [#to_s] Project path to list subscriptions under;
        #   must be a project url prefix (e.g. 'projects/my-project'). If nil,
        #   the project configured on the client is used.
        # @see https://cloud.google.com/pubsub/reference/rest/v1/projects.topics/list
        def list_subscriptions(project = nil)
          api_method = @pubsub.projects.subscriptions.list
          parameters = {
            "project" => (project.nil? ? "projects/#{@project}" : project.to_s)
          }

          request(api_method, parameters)
        end
      end

      class Mock
        def list_subscriptions(_project = nil)
          subs = data[:subscriptions].values.map do |sub|
            # Filter out any keys that aren't part of the response object
            sub.select do |k, _|
              %w(name topic pushConfig ackDeadlineSeconds).include?(k)
            end
          end

          body = {
            "subscriptions" => subs
          }
          status = 200
          build_excon_response(body, status)
        end
      end
    end
  end
end

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
fog-google-0.6.0 lib/fog/google/requests/pubsub/list_subscriptions.rb
fog-google-0.5.5 lib/fog/google/requests/pubsub/list_subscriptions.rb
fog-google-0.5.4 lib/fog/google/requests/pubsub/list_subscriptions.rb
fog-google-0.5.3 lib/fog/google/requests/pubsub/list_subscriptions.rb
fog-google-0.5.2 lib/fog/google/requests/pubsub/list_subscriptions.rb
fog-google-0.5.1 lib/fog/google/requests/pubsub/list_subscriptions.rb
fog-google-0.5.0 lib/fog/google/requests/pubsub/list_subscriptions.rb
fog-google-0.4.2 lib/fog/google/requests/pubsub/list_subscriptions.rb
fog-google-0.4.1 lib/fog/google/requests/pubsub/list_subscriptions.rb
fog-google-0.4.0 lib/fog/google/requests/pubsub/list_subscriptions.rb
fog-google-0.3.2 lib/fog/google/requests/pubsub/list_subscriptions.rb
fog-google-0.3.1 lib/fog/google/requests/pubsub/list_subscriptions.rb
fog-google-0.3.0 lib/fog/google/requests/pubsub/list_subscriptions.rb