Cloud Pub/Sub API - Class Google::Cloud::PubSub::Credentials (v2.16.0)

Reference documentation and code samples for the Cloud Pub/Sub API class Google::Cloud::PubSub::Credentials.

Credentials

Represents the authentication and authorization used to connect to the Pub/Sub API.

Inherits

  • Google::Cloud::PubSub::V1::Publisher::Credentials

Example

require "google/cloud/pubsub"

keyfile = "/path/to/keyfile.json"
creds = Google::Cloud::PubSub::Credentials.new keyfile

pubsub = Google::Cloud::PubSub.new(
  project_id: "my-project",
  credentials: creds
)

pubsub.project_id #=> "my-project"