Module: Google::Cloud
- Defined in:
- lib/google-cloud-pubsub.rb,
lib/google/cloud/pubsub.rb,
lib/google/cloud/pubsub/topic.rb,
lib/google/cloud/pubsub/policy.rb,
lib/google/cloud/pubsub/message.rb,
lib/google/cloud/pubsub/project.rb,
lib/google/cloud/pubsub/service.rb,
lib/google/cloud/pubsub/version.rb,
lib/google/cloud/pubsub/topic/list.rb,
lib/google/cloud/pubsub/credentials.rb,
lib/google/cloud/pubsub/subscription.rb,
lib/google/cloud/pubsub/topic/publisher.rb,
lib/google/cloud/pubsub/received_message.rb,
lib/google/cloud/pubsub/subscription/list.rb
Defined Under Namespace
Modules: Pubsub
Class Method Summary collapse
-
.pubsub(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Google::Cloud::Pubsub::Project
Creates a new object for connecting to the Pub/Sub service.
Instance Method Summary collapse
-
#pubsub(scope: nil, retries: nil, timeout: nil) ⇒ Google::Cloud::Pubsub::Project
Creates a new object for connecting to the Pub/Sub service.
Class Method Details
.pubsub(project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil) ⇒ Google::Cloud::Pubsub::Project
Creates a new object for connecting to the Pub/Sub service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/google-cloud-pubsub.rb', line 101 def self.pubsub project = nil, keyfile = nil, scope: nil, retries: nil, timeout: nil require "google/cloud/pubsub" project ||= Google::Cloud::Pubsub::Project.default_project if ENV["PUBSUB_EMULATOR_HOST"] ps = Google::Cloud::Pubsub::Project.new( project, :this_channel_is_insecure) ps.service.host = ENV["PUBSUB_EMULATOR_HOST"] return ps end if keyfile.nil? credentials = Google::Cloud::Pubsub::Credentials.default scope: scope else credentials = Google::Cloud::Pubsub::Credentials.new( keyfile, scope: scope) end Google::Cloud::Pubsub::Project.new( Google::Cloud::Pubsub::Service.new( project, credentials, retries: retries, timeout: timeout)) end |
Instance Method Details
#pubsub(scope: nil, retries: nil, timeout: nil) ⇒ Google::Cloud::Pubsub::Project
Creates a new object for connecting to the Pub/Sub service. Each call creates a new connection.
For more information on connecting to Google Cloud see the [Authentication Guide](googlecloudplatform.github.io/google-cloud-ruby/#/docs/guides/authentication).
62 63 64 65 66 |
# File 'lib/google-cloud-pubsub.rb', line 62 def pubsub scope: nil, retries: nil, timeout: nil Google::Cloud.pubsub @project, @keyfile, scope: scope, retries: (retries || @retries), timeout: (timeout || @timeout) end |