Class: Shoppe::DeliveryService

Inherits:
ActiveRecord::Base
  • Object
show all
Defined in:
app/models/shoppe/delivery_service.rb

Instance Method Summary collapse

Instance Method Details

#tracking_url_for(order) ⇒ String

Returns a tracking URL for the passed order


23
24
25
26
27
28
29
30
# File 'app/models/shoppe/delivery_service.rb', line 23

def tracking_url_for(order)
  return nil if self.tracking_url.blank?
  tracking_url = self.tracking_url.dup
  tracking_url.gsub!("{{consignment_number}}", CGI.escape(order.consignment_number.to_s))
  tracking_url.gsub!("{{delivery_postcode}}", CGI.escape(order.delivery_postcode.to_s))
  tracking_url.gsub!("{{billing_postcode}}", CGI.escape(order.billing_postcode.to_s))
  tracking_url
end