Skip to content

Instantly share code, notes, and snippets.

@timarnold
Last active August 29, 2015 14:07
Show Gist options
  • Save timarnold/90fa78a21b919b784bff to your computer and use it in GitHub Desktop.
Save timarnold/90fa78a21b919b784bff to your computer and use it in GitHub Desktop.
require 'rubygems'
require 'json'
require 'cgi'
require "net/http"
require "uri"
# Find your store here: http://www.ifoapplestore.com/store-number-list/
stores =
{
"Towson" => "R063",
"Columbia" => "R168",
}
# Find your model number here: http://leimobile.com/iphone-6-plus-model-numbers/
models = {
"t-mobile" => { "gray" => { "64" => "MGC52LL/A", "128" => "MGC22LL/A" },
"silver" => { "64" => "MGC62LL/A", "128" => "MGC32LL/A" },
"gold" => { "64" => "MGC72LL/A", "128" => "MGC42LL/A" } },
"att" => { "gray" => { "64" => "MGAU2LL/A", "128" => "MGAP2LL/A" },
"silver" => { "64" => "MGAV2LL/A", "128" => "MGAQ2LL/A" },
"gold" => { "64" => "MGAW2LL/A", "128" => "MGAR2LL/A" } },
"vzw" => { "gray" => { "64" => "MGCR2LL/A", "128" => "MGCN2LL/A" },
"silver" => { "64" => "MGCT2LL/A", "128" => "MGCP2LL/A" },
"gold" => { "64" => "MGCU2LL/A", "128" => "MGCQ2LL/A" } }
}
while true
p Time.new.inspect
stores.each do |store, store_code|
models.each do |carrier, colors|
colors.each do |color, capacities|
capacities.each do |capacity, model|
uri = URI.parse("http://store.apple.com/us/retailStore/availability?parts.0="+CGI.escapeHTML(model)+"&store="+store_code)
response = Net::HTTP.get_response(uri)
availability = JSON.parse(response.body)["body"]["stores"][0]["partsAvailability"][model]["pickupDisplay"]
if availability.eql? "available"
puts carrier + " " + color + " " + capacity + " IS AVAILABLE AT " + store + "!!!!"
end
end
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment