Class: Google4R::Checkout::CancelledSubscriptionNotification

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

Overview

CancelledSubscriptionNotification objects contain information about the cancellation of a subscription, including the item-ids, google order number, reason, and timestamp.

Instance Attribute Summary collapse

Attributes inherited from Notification

#frontend, #serial_number, #timestamp

Class Method Summary collapse

Methods inherited from Notification

#initialize

Constructor Details

This class inherits a constructor from Google4R::Checkout::Notification

Instance Attribute Details

#google_order_numberObject

The google order number of the subscription being cancelled



546
547
548
# File 'lib/google4r/checkout/notifications.rb', line 546

def google_order_number
  @google_order_number
end

#item_idsObject

The ids of the items being cancelled (Array of Strings)



543
544
545
# File 'lib/google4r/checkout/notifications.rb', line 543

def item_ids
  @item_ids
end

#reasonObject

The reason for the cancellation (String, can be nil.)



540
541
542
# File 'lib/google4r/checkout/notifications.rb', line 540

def reason
  @reason
end

Class Method Details

.create_from_element(element, frontend) ⇒ Object



548
549
550
551
552
553
554
555
556
557
558
# File 'lib/google4r/checkout/notifications.rb', line 548

def self.create_from_element(element, frontend)
  csn = CancelledSubscriptionNotification.new(frontend)
  
  csn.serial_number = element.attributes['serial-number']
  csn.timestamp = Time.parse(element.elements['timestamp'].text)
  csn.reason = element.elements['reason'].text rescue nil
  csn.item_ids = element.elements['item-ids/item-id/merchant-item-id'].collect {|i| i.text} rescue []
  csn.google_order_number = element.elements['google-order-number'].text
  
  return csn
end