class Fog::Google::Pubsub::ReceivedMessage

Represents a ReceivedMessage retrieved from a Google Pubsub subscription. Note that ReceivedMessages are immutable.

@see cloud.google.com/pubsub/reference/rest/v1/projects.subscriptions/pull#ReceivedMessage

Public Class Methods

new(new_attributes = {}) click to toggle source
Calls superclass method
# File lib/fog/google/models/pubsub/received_message.rb, line 15
def initialize(new_attributes = {})
  # Here we secretly store the subscription name we were received on
  # in order to support #acknowledge
  attributes = new_attributes.clone
  @subscription_name = attributes.delete(:subscription_name)
  super(attributes)
end

Public Instance Methods

acknowledge() click to toggle source

Acknowledges a message.

@see cloud.google.com/pubsub/reference/rest/v1/projects.subscriptions/acknowledge

# File lib/fog/google/models/pubsub/received_message.rb, line 26
def acknowledge
  requires :ack_id

  service.acknowledge_subscription(@subscription_name, [ack_id])
  nil
end
reload() click to toggle source
# File lib/fog/google/models/pubsub/received_message.rb, line 33
def reload
  # Message is immutable - do nothing
  Fog::Logger.warning("#reload called on immutable ReceivedMessage")
end