Sha256: 45610fb48f32be11ba4385f8cad3c576148dea05c2dd316defa4b6b5a9df3091

Contents?: true

Size: 924 Bytes

Versions: 13

Compression:

Stored size: 924 Bytes

Contents

module Fog
  module Google
    class Pubsub
      class Real
        # Create a topic on the remote service.
        #
        # @param topic_name [#to_s] name of topic to create; note that it must
        #   obey the naming rules for a topic (e.g.
        #   'projects/myProject/topics/my_topic')
        # @see https://cloud.google.com/pubsub/reference/rest/v1/projects.topics/create
        def create_topic(topic_name)
          api_method = @pubsub.projects.topics.create
          parameters = {
            "name" => topic_name.to_s
          }

          request(api_method, parameters)
        end
      end

      class Mock
        def create_topic(topic_name)
          data = {
            "name" => topic_name
          }
          self.data[:topics][topic_name] = data

          body = data.clone
          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/create_topic.rb
fog-google-0.5.5 lib/fog/google/requests/pubsub/create_topic.rb
fog-google-0.5.4 lib/fog/google/requests/pubsub/create_topic.rb
fog-google-0.5.3 lib/fog/google/requests/pubsub/create_topic.rb
fog-google-0.5.2 lib/fog/google/requests/pubsub/create_topic.rb
fog-google-0.5.1 lib/fog/google/requests/pubsub/create_topic.rb
fog-google-0.5.0 lib/fog/google/requests/pubsub/create_topic.rb
fog-google-0.4.2 lib/fog/google/requests/pubsub/create_topic.rb
fog-google-0.4.1 lib/fog/google/requests/pubsub/create_topic.rb
fog-google-0.4.0 lib/fog/google/requests/pubsub/create_topic.rb
fog-google-0.3.2 lib/fog/google/requests/pubsub/create_topic.rb
fog-google-0.3.1 lib/fog/google/requests/pubsub/create_topic.rb
fog-google-0.3.0 lib/fog/google/requests/pubsub/create_topic.rb