Sha256: d3efb8634ad5a2b59efc94f9f8041e7a040fba8b635a9a7e7ed87263ae606ad4

Contents?: true

Size: 818 Bytes

Versions: 13

Compression:

Stored size: 818 Bytes

Contents

require "fog/core/collection"
require "fog/google/models/pubsub/topic"

module Fog
  module Google
    class Pubsub
      class Topics < Fog::Collection
        model Fog::Google::Pubsub::Topic

        # Lists all topics that exist on the project.
        #
        # @return [Array<Fog::Google::Pubsub::Topic>] list of topics
        def all
          data = service.list_topics.body["topics"] || []
          load(data)
        end

        # Retrieves a topic by name
        #
        # @param topic_name [String] name of topic to retrieve
        # @return [Fog::Google::Pubsub::Topic] topic found, or nil if not found
        def get(topic_name)
          topic = service.get_topic(topic_name).body
          new(topic)
        rescue Fog::Errors::NotFound
          nil
        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/models/pubsub/topics.rb
fog-google-0.5.5 lib/fog/google/models/pubsub/topics.rb
fog-google-0.5.4 lib/fog/google/models/pubsub/topics.rb
fog-google-0.5.3 lib/fog/google/models/pubsub/topics.rb
fog-google-0.5.2 lib/fog/google/models/pubsub/topics.rb
fog-google-0.5.1 lib/fog/google/models/pubsub/topics.rb
fog-google-0.5.0 lib/fog/google/models/pubsub/topics.rb
fog-google-0.4.2 lib/fog/google/models/pubsub/topics.rb
fog-google-0.4.1 lib/fog/google/models/pubsub/topics.rb
fog-google-0.4.0 lib/fog/google/models/pubsub/topics.rb
fog-google-0.3.2 lib/fog/google/models/pubsub/topics.rb
fog-google-0.3.1 lib/fog/google/models/pubsub/topics.rb
fog-google-0.3.0 lib/fog/google/models/pubsub/topics.rb