Class: Google4R::Checkout::CommandXmlGenerator
- Inherits:
-
XmlGenerator
- Object
- XmlGenerator
- Google4R::Checkout::CommandXmlGenerator
- Defined in:
- lib/google4r/checkout/xml_generation.rb
Overview
Abstract super class for all CommandXmlGenerators It should never be instantiated directly
Direct Known Subclasses
AddMerchantOrderNumberCommandXmlGenerator, AddTrackingDataCommandXmlGenerator, ArchiveOrderCommandXmlGenerator, AuthorizeOrderCommandXmlGenerator, CancelOrderCommandXmlGenerator, ChargeAndShipOrderCommandXmlGenerator, ChargeOrderCommandXmlGenerator, CheckoutCommandXmlGenerator, DeliverOrderCommandXmlGenerator, ItemsCommandXmlGenerator, NotificationDataRequestCommandXmlGenerator, NotificationDataTokenRequestCommandXmlGenerator, NotificationHistoryReportCommandXmlGenerator, ProcessOrderCommandXmlGenerator, RefundOrderCommandXmlGenerator, ReturnOrderReportCommandXmlGenerator, SendBuyerMessageCommandXmlGenerator, UnarchiveOrderCommandXmlGenerator
Constant Summary collapse
- COMMAND_TO_TAG =
The list of command tag names
{ ChargeAndShipOrderCommand => "charge-and-ship-order", ChargeOrderCommand => 'charge-order', RefundOrderCommand => 'refund-order', CancelOrderCommand => 'cancel-order', AuthorizeOrderCommand => 'authorize-order', ProcessOrderCommand => 'process-order', AddMerchantOrderNumberCommand => 'add-merchant-order-number', DeliverOrderCommand => 'deliver-order', AddTrackingDataCommand => 'add-tracking-data', SendBuyerMessageCommand => 'send-buyer-message', ArchiveOrderCommand => 'archive-order', UnarchiveOrderCommand => 'unarchive-order', CreateOrderRecurrenceRequestCommand => 'create-order-recurrence-request', ShipItemsCommand => 'ship-items', BackorderItemsCommand => 'backorder-items', CancelItemsCommand => 'cancel-items', ReturnItemsCommand => 'return-items', ResetItemsShippingInformationCommand => 'reset-items-shipping-information', OrderReportCommand => 'order-list-request', NotificationHistoryRequestCommand => 'notification-history-request', NotificationDataTokenRequestCommand => 'notification-data-token-request', NotificationDataRequestCommand => 'notification-data-request' }
Instance Method Summary collapse
-
#generate ⇒ Object
Base method to generate the XML for a particular command.
-
#initialize(command) ⇒ CommandXmlGenerator
constructor
A new instance of CommandXmlGenerator.
- #tag_name_for_command(klass) ⇒ Object
Constructor Details
#initialize(command) ⇒ CommandXmlGenerator
Returns a new instance of CommandXmlGenerator.
84 85 86 87 88 89 90 |
# File 'lib/google4r/checkout/xml_generation.rb', line 84 def initialize(command) if COMMAND_TO_TAG.has_key?(command.class) @command = command else raise 'Cannot instantiate an abstract class.' end end |
Instance Method Details
#generate ⇒ Object
Base method to generate the XML for a particular command
93 94 95 96 97 98 99 |
# File 'lib/google4r/checkout/xml_generation.rb', line 93 def generate super self.process_command(@command) io = StringIO.new @document.write(io, -1) return io.string end |
#tag_name_for_command(klass) ⇒ Object
101 102 103 |
# File 'lib/google4r/checkout/xml_generation.rb', line 101 def tag_name_for_command(klass) COMMAND_TO_TAG[klass] end |