Class: GoogleCheckout::DeliverOrder

Inherits:
OrderCommand show all
Defined in:
lib/google-checkout/command.rb

Overview

Tells Google that the order has shipped.

Constant Summary

Constants inherited from Command

Command::PRODUCTION_REQUEST_URL, Command::SANDBOX_REQUEST_URL

Instance Attribute Summary

Attributes inherited from OrderCommand

#amount, #google_order_number

Attributes inherited from Command

#currency, #merchant_id, #merchant_key

Instance Method Summary collapse

Methods inherited from Command

#post, #url, x509_store

Constructor Details

#initialize(merchant_id, merchant_key, google_order_number, carrier, tracking_number, send_email = false) ⇒ DeliverOrder

Returns a new instance of DeliverOrder.



136
137
138
139
140
141
142
143
# File 'lib/google-checkout/command.rb', line 136

def initialize(merchant_id, merchant_key, google_order_number, carrier, tracking_number, send_email = false)
  raise "Unknown carrier. Valid values are DHL, FedEx, UPS, USPS, and Other." unless ["DHL","FedEx","UPS","USPS","Other"].include? carrier

  @carrier = carrier
  @tracking_number = tracking_number
  @send_email = send_email
  super(merchant_id, merchant_key, google_order_number)
end

Instance Method Details

#to_xmlObject



145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# File 'lib/google-checkout/command.rb', line 145

def to_xml

  xml = Builder::XmlMarkup.new
  xml.instruct!
  @xml = xml.tag!('deliver-order', {
    :xmlns => "http://checkout.google.com/schema/2",
    "google-order-number" => @google_order_number
  }) do
    xml.tag!('tracking-data') do
      xml.tag!('carrier', @carrier)
      xml.tag!('tracking-number', @tracking_number)
    end
    xml.tag!("send-email", @send_email)
  end
  @xml
end