# encoding: ascii
# api: powershell
# title: Get-DominosOrderStatus
# description: Gets the status of your Dominos pizza order. Your phone number is the only input parameter. This is the most important Psh module you’ll ever import.
# version: 0.1
# type: script
# author: xcud
# license: CC0
# function: Get-DominosOrderStatus
# x-poshcode-id: 1355
# x-archived: 2014-08-30T04:21:29
# x-published: 2010-09-30T12:51:00
#
#
# Get-DominosOrderStatus.psm1
# Author:       xcud.com
#
# Inspired by Dana Merrick's Dominos Pizza Script
# http://shakti.trincoll.edu/~dmerrick/dominos.html

function Get-DominosOrderStatus($phone_number) {
	$url = "http://trkweb.dominos.com/orderstorage/GetTrackerData?Phone=$phone_number"
	[xml]$content = (new-object System.Net.WebClient).DownloadString($url);
	$statii = select-xml -xml @($content) `
			   -Namespace @{dominos="http://www.dominos.com/message/"} `
			   -XPath descendant::dominos:OrderStatus
	if($statii.Count -gt 0) { $statii | %{ $_.Node } }
	else { "No orders" }
}

Export-ModuleMember Get-DominosOrderStatus
