class Google::Cloud::Storage::Notification


notification = bucket.create_notification topic.name
bucket = storage.bucket “my-bucket”
end
“serviceAccount:#{storage.service_account_email}”
p.add “roles/pubsub.publisher”,
topic.policy do |p|
topic = pubsub.create_topic “my-topic”
storage = Google::Cloud::Storage.new
pubsub = Google::Cloud::Pubsub.new
require “google/cloud/storage”
require “google/cloud/pubsub”
@example
notification belongs.
@attr_reader [String] bucket The name of the {Bucket} to which this
Pub/Sub Notifications for Google Cloud
@see cloud.google.com/storage/docs/pubsub-notifications Cloud
{Bucket#notification}.
See {Bucket#create_notification}, {Bucket#notifications}, and
bucket.
Represents a Pub/Sub notification subscription for a Cloud Storage
# Notification
#

def self.from_gapi bucket_name, gapi, service, user_project: nil

Other tags:
    Private: - New Notification from a
def self.from_gapi bucket_name, gapi, service, user_project: nil
  new.tap do |f|
    f.instance_variable_set :@bucket, bucket_name
    f.gapi = gapi
    f.service = service
    f.user_project = user_project
  end
end

def api_url

Returns:
  • (String) -
def api_url
  @gapi.self_link
end

def custom_attrs

Returns:
  • (Hash(String => String)) -
def custom_attrs
  @gapi.custom_attributes
end

def delete

Returns:
  • (Boolean) - Returns `true` if the notification was deleted.
def delete
  ensure_service!
  @service.delete_notification bucket, id, user_project: @user_project
  true
end

def ensure_service!

Raise an error unless an active service is available.
#
def ensure_service!
  raise "Must have active connection" unless service
end

def event_types

Returns:
  • (Array) -
def event_types
  @gapi.event_types
end

def id

Returns:
  • (String) -
def id
  @gapi.id
end

def initialize

Other tags:
    Private: - Creates a Notification object.
def initialize
  @bucket = nil
  @service = nil
  @gapi = nil
  @user_project = nil
end

def kind

Returns:
  • (String) -
def kind
  @gapi.kind
end

def payload

Returns:
  • (String) -
def payload
  @gapi.payload_format
end

def prefix

Returns:
  • (String) -
def prefix
  @gapi.object_name_prefix
end

def topic

Returns:
  • (String) -
def topic
  @gapi.topic
end