Class: Google4R::Checkout::NotificationAcknowledgement

Inherits:
Object
  • Object
show all
Defined in:
lib/google4r/checkout/notifications.rb

Overview

Represents a notification acknowledgment to tell Google that the notification has been recieved and processed. Google guarantees not to resend any notification it has recieved an acknowledgment for.

For example, in a Rails app

# Let Google Checkout know we handled this notification with handshake
notification_acknowledgement = Google4R::Checkout::NotificationAcknowledgement.new(notification).to_xml
render :text => notification_acknowledgement, :status => 200

or

# Without handshake
notification_acknowledgement = Google4R::Checkout::NotificationAcknowledgement.new.to_xml
render :text => notification_acknowledgement, :status => 200

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(notification = nil) ⇒ NotificationAcknowledgement

Returns a new instance of NotificationAcknowledgement.



60
61
62
# File 'lib/google4r/checkout/notifications.rb', line 60

def initialize(notification=nil)
  @serial_number = notification.serial_number unless notification.nil?
end

Instance Attribute Details

#serial_numberObject (readonly)

Returns the value of attribute serial_number.



58
59
60
# File 'lib/google4r/checkout/notifications.rb', line 58

def serial_number
  @serial_number
end

Instance Method Details

#to_xmlObject



64
65
66
# File 'lib/google4r/checkout/notifications.rb', line 64

def to_xml
  NotificationAcknowledgementXmlGenerator.new(self).generate
end