class Google::Cloud::PubSub::PublishResult

The result of a publish operation. The message object is available on {#message} and will have {#message_id} assigned by the API.

When the publish operation was successful the result will be marked {#succeeded?}. Otherwise, the result will be marked {#failed?} and the error raised will be availabe on {#error}.

Public Class Methods

from_error(msg_grpc, error) click to toggle source

@private Create an PublishResult object from a message protobuf and an error.

# File lib/google/cloud/pubsub/publish_result.rb, line 95
def self.from_error msg_grpc, error
  new Message.from_grpc(msg_grpc), error
end
from_grpc(msg_grpc) click to toggle source

@private Create an PublishResult object from a message protobuf.

# File lib/google/cloud/pubsub/publish_result.rb, line 88
def self.from_grpc msg_grpc
  new Message.from_grpc(msg_grpc)
end
new(message, error = nil) click to toggle source

@private Create an PublishResult object.

# File lib/google/cloud/pubsub/publish_result.rb, line 30
def initialize message, error = nil
  @message = message
  @error = error
end

Public Instance Methods

attributes() click to toggle source

The message's attributes.

# File lib/google/cloud/pubsub/publish_result.rb, line 50
def attributes
  message.attributes
end
data() click to toggle source

The message's data.

# File lib/google/cloud/pubsub/publish_result.rb, line 44
def data
  message.data
end
error() click to toggle source

The error that was raised when published, if any.

# File lib/google/cloud/pubsub/publish_result.rb, line 71
def error
  @error
end
failed?() click to toggle source

Whether the publish request failed.

# File lib/google/cloud/pubsub/publish_result.rb, line 82
def failed?
  !succeeded?
end
message() click to toggle source

The message.

# File lib/google/cloud/pubsub/publish_result.rb, line 37
def message
  @message
end
Also aliased as: msg
message_id() click to toggle source

The ID of the message, assigned by the server at publication time. Guaranteed to be unique within the topic.

# File lib/google/cloud/pubsub/publish_result.rb, line 57
def message_id
  message.message_id
end
Also aliased as: msg_id
msg()
Alias for: message
msg_id()
Alias for: message_id
publish_time()
Alias for: published_at
published_at() click to toggle source

The time at which the message was published.

# File lib/google/cloud/pubsub/publish_result.rb, line 64
def published_at
  message.published_at
end
Also aliased as: publish_time
succeeded?() click to toggle source

Whether the publish request was successful.

# File lib/google/cloud/pubsub/publish_result.rb, line 77
def succeeded?
  error.nil?
end