Skip to content

Instantly share code, notes, and snippets.

@bkerley
Created September 24, 2014 17:23
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save bkerley/c44c69012eba894290de to your computer and use it in GitHub Desktop.
Save bkerley/c44c69012eba894290de to your computer and use it in GitHub Desktop.
# http://store.apple.com/us/retailStore/availabilitySearch?parts.0=MGAU2LL%2FA&zip=33175
# {
# "head":{"status":"200","data":{}},
# "body":{"zip":"33175","success":true,"stores":[
# {"address":{"postalCode":"33156","address":"Apple Store, Dadeland","address2":"7535 Dadeland Mall","address3":null},"state":"FL","country":"US","city":"Miami","storeNumber":"R312","storeName":"Dadeland","storeEmail":"dadeland@apple.com","storeDisplayName":"Apple Store, Dadeland","reservationUrl":"http://www.apple.com/retail/dadeland","hoursUrl":"http://www.apple.com/retail/dadeland","directionsUrl":"http://www.apple.com/retail/dadeland/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:30 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-7:00 PM"}]},
# "partsAvailability":{
# "MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Dadeland","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/dadeland/images/dadeland_hero_43.jpg","phoneNumber":"1-305-341 9812"},{"address":{"postalCode":"33176","address":"Apple Store, The Falls","address2":"8888 SW 136th Street","address3":null},"state":"FL","country":"US","city":"Miami","storeNumber":"R012","storeName":"The Falls","storeEmail":"thefalls@apple.com","storeDisplayName":"Apple Store, The Falls","reservationUrl":"http://www.apple.com/retail/thefalls","hoursUrl":"http://www.apple.com/retail/thefalls","directionsUrl":"http://www.apple.com/retail/thefalls/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-7:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, The Falls","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/thefalls/images/thefalls_hero_43.jpg","phoneNumber":"1-305-234 4565"},{"address":{"postalCode":"33139","address":"Apple Store, Lincoln Road","address2":"738 Lincoln Road","address3":null},"state":"FL","country":"US","city":"Miami Beach","storeNumber":"R115","storeName":"Lincoln Road","storeEmail":"lincolnroad@apple.com","storeDisplayName":"Apple Store, Lincoln Road","reservationUrl":"http://www.apple.com/retail/lincolnroad","hoursUrl":"http://www.apple.com/retail/lincolnroad","directionsUrl":"http://www.apple.com/retail/lincolnroad/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-11:00 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-10:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Lincoln Road","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/lincolnroad/images/lincolnroad_hero_43.jpg","phoneNumber":"1-305-421 0400"},{"address":{"postalCode":"33180","address":"Apple Store, Aventura","address2":"19501 Biscayne Boulevard","address3":null},"state":"FL","country":"US","city":"Aventura","storeNumber":"R087","storeName":"Aventura","storeEmail":"aventura@apple.com","storeDisplayName":"Apple Store, Aventura","reservationUrl":"http://www.apple.com/retail/aventura","hoursUrl":"http://www.apple.com/retail/aventura","directionsUrl":"http://www.apple.com/retail/aventura/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:30 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-8:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Aventura","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/aventura/images/aventura_hero_43.jpg","phoneNumber":"1-305-914 9826"},{"address":{"postalCode":"33304","address":"Apple Store, The Galleria","address2":"2388 E. Sunrise Boulevard","address3":null},"state":"FL","country":"US","city":"Fort Lauderdale","storeNumber":"R214","storeName":"The Galleria","storeEmail":"thegalleria@apple.com","storeDisplayName":"Apple Store, The Galleria","reservationUrl":"http://www.apple.com/retail/thegalleria","hoursUrl":"http://www.apple.com/retail/thegalleria","directionsUrl":"http://www.apple.com/retail/thegalleria/map","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, The Galleria","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/thegalleria/images/thegalleria_hero_43.jpg","phoneNumber":"1-954-331 4501"},{"address":{"postalCode":"33431","address":"Apple Store, Boca Raton","address2":"6000 West Glades Road","address3":null},"state":"FL","country":"US","city":"Boca Raton","storeNumber":"R074","storeName":"Boca Raton","storeEmail":"bocaraton@apple.com","storeDisplayName":"Apple Store, Boca Raton","reservationUrl":"http://www.apple.com/retail/bocaraton","hoursUrl":"http://www.apple.com/retail/bocaraton","directionsUrl":"http://www.apple.com/retail/bocaraton/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Boca Raton","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/bocaraton/images/bocaraton_hero_43.jpg","phoneNumber":"1-561-226 0270"},{"address":{"postalCode":"33414","address":"Apple Store, Wellington Green","address2":"10300 W. Forest Hill Boulevard","address3":null},"state":"FL","country":"US","city":"Wellington","storeNumber":"R024","storeName":"Wellington Green","storeEmail":"wellingtongreen@apple.com","storeDisplayName":"Apple Store, Wellington Green","reservationUrl":"http://www.apple.com/retail/wellingtongreen","hoursUrl":"http://www.apple.com/retail/wellingtongreen","directionsUrl":"http://www.apple.com/retail/wellingtongreen/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"11:00 AM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Wellington Green","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/images/store_photos/photo_wellingtongreen.jpg","phoneNumber":"1-561-273 2940"},{"address":{"postalCode":"33410","address":"Apple Store, The Gardens Mall","address2":"3101 PGA Boulevard","address3":null},"state":"FL","country":"US","city":"Palm Beach Gardens","storeNumber":"R127","storeName":"The Gardens Mall","storeEmail":"thegardensmall@apple.com","storeDisplayName":"Apple Store, The Gardens Mall","reservationUrl":"http://www.apple.com/retail/thegardensmall","hoursUrl":"http://www.apple.com/retail/thegardensmall","directionsUrl":"http://www.apple.com/retail/thegardensmall/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, The Gardens Mall","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/thegardensmall/images/thegardensmall_hero_43.jpg","phoneNumber":"1-561-273 2160"},{"address":{"postalCode":"34108","address":"Apple Store, Waterside Shops","address2":"5555 Tamiami Trail North","address3":null},"state":"FL","country":"US","city":"Naples","storeNumber":"R169","storeName":"Waterside Shops","storeEmail":"watersideshops@apple.com","storeDisplayName":"Apple Store, Waterside Shops","reservationUrl":"http://www.apple.com/retail/watersideshops","hoursUrl":"http://www.apple.com/retail/watersideshops","directionsUrl":"http://www.apple.com/retail/watersideshops/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-7:00 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Waterside Shops","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/watersideshops/images/watersideshops_hero_43.jpg","phoneNumber":"1-239-254 4240"},{"address":{"postalCode":"33928","address":"Apple Store, Coconut Point","address2":"23151 Fashion Drive","address3":null},"state":"FL","country":"US","city":"Estero","storeNumber":"R185","storeName":"Coconut Point","storeEmail":"coconutpoint@apple.com","storeDisplayName":"Apple Store, Coconut Point","reservationUrl":"http://www.apple.com/retail/coconutpoint","hoursUrl":"http://www.apple.com/retail/coconutpoint","directionsUrl":"http://www.apple.com/retail/coconutpoint/map","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Coconut Point","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/coconutpoint/images/coconutpoint_hero_43.jpg","phoneNumber":"1-239-949 8860"},{"address":{"postalCode":"33511","address":"Apple Store, Brandon","address2":"459 Brandon Town Center Drive","address3":null},"state":"FL","country":"US","city":"Brandon","storeNumber":"R289","storeName":"Brandon","storeEmail":"brandontowncenter@apple.com","storeDisplayName":"Apple Store, Brandon","reservationUrl":"http://www.apple.com/retail/brandon","hoursUrl":"http://www.apple.com/retail/brandon","directionsUrl":"http://www.apple.com/retail/brandon/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"11:00 AM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Brandon","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/brandon/images/brandon_hero_43.jpg","phoneNumber":"1-813-413 3400"},{"address":{"postalCode":"32809","address":"Apple Store, Florida Mall","address2":"8001 South Orange Blossom Trail","address3":null},"state":"FL","country":"US","city":"Orlando","storeNumber":"R143","storeName":"Florida Mall","storeEmail":"floridamall@apple.com","storeDisplayName":"Apple Store, Florida Mall","reservationUrl":"http://www.apple.com/retail/floridamall","hoursUrl":"http://www.apple.com/retail/floridamall","directionsUrl":"http://www.apple.com/retail/floridamall/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-10:00 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-8:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Florida Mall","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/floridamall/images/floridamall_hero_43.jpg","phoneNumber":"1-407-563 1020"},{"address":{"postalCode":"32839","address":"Apple Store, Millenia","address2":"4200 Conroy Road","address3":null},"state":"FL","country":"US","city":"Orlando","storeNumber":"R053","storeName":"Millenia","storeEmail":"millenia@apple.com","storeDisplayName":"Apple Store, Millenia","reservationUrl":"http://www.apple.com/retail/millenia","hoursUrl":"http://www.apple.com/retail/millenia","directionsUrl":"http://www.apple.com/retail/millenia/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"11:00 AM-7:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Millenia","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/millenia/images/millenia_hero_43.jpg","phoneNumber":"1-407-352 5551"},{"address":{"postalCode":"33607","address":"Apple Store, International Plaza","address2":"2223 N West Shore Boulevard","address3":null},"state":"FL","country":"US","city":"Tampa","storeNumber":"R019","storeName":"International Plaza","storeEmail":"internationalplaza@apple.com","storeDisplayName":"Apple Store, International Plaza","reservationUrl":"http://www.apple.com/retail/plaza","hoursUrl":"http://www.apple.com/retail/plaza","directionsUrl":"http://www.apple.com/retail/plaza/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"11:00 AM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, International Plaza","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/internationalplaza/images/internationalplaza_hero_43.jpg","phoneNumber":"1-813-393 4720"},{"address":{"postalCode":"32701","address":"Apple Store, Altamonte","address2":"451 E Altamonte Drive","address3":null},"state":"FL","country":"US","city":"Altamonte Springs","storeNumber":"R291","storeName":"Altamonte","storeEmail":"altamonte@apple.com","storeDisplayName":"Apple Store, Altamonte","reservationUrl":"http://www.apple.com/retail/altamonte","hoursUrl":"http://www.apple.com/retail/altamonte","directionsUrl":"http://www.apple.com/retail/altamonte/map","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Altamonte","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/altamonte/images/altamonte_hero_43.jpg","phoneNumber":"1-407-551 0404"},{"address":{"postalCode":"32246","address":"Apple Store, St. Johns Town Center","address2":"4712 River City Drive","address3":null},"state":"FL","country":"US","city":"Jacksonville","storeNumber":"R111","storeName":"St. Johns Town Center","storeEmail":"stjohnstowncenter@apple.com","storeDisplayName":"Apple Store, St. Johns Town Center","reservationUrl":"http://www.apple.com/retail/stjohnstowncenter","hoursUrl":"http://www.apple.com/retail/stjohnstowncenter","directionsUrl":"http://www.apple.com/retail/stjohnstowncenter/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"11:00 AM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, St. Johns Town Center","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/stjohnstowncenter/images/stjohnstowncenter_hero_43.jpg","phoneNumber":"1-904-380 3080"},{"address":{"postalCode":"29401","address":"Apple Store, King Street","address2":"301 King Street","address3":null},"state":"SC","country":"US","city":"Charleston","storeNumber":"R318","storeName":"King Street","storeEmail":"kingstreet@apple.com","storeDisplayName":"Apple Store, King Street","reservationUrl":"http://www.apple.com/retail/kingstreet","hoursUrl":"http://www.apple.com/retail/kingstreet","directionsUrl":"http://www.apple.com/retail/kingstreet/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Wed","storeTimings":"10:00 AM-8:00 PM"},{"storeDays":"Thu-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"11:00 AM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, King Street","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/kingstreet/images/kingstreet_hero_43.jpg","phoneNumber":"1-843-727-0400"},{"address":{"postalCode":"30909","address":"Apple Store, Augusta","address2":"3450 Wrightsboro Road","address3":null},"state":"GA","country":"US","city":"Augusta","storeNumber":"R364","storeName":"Augusta","storeEmail":"augusta@apple.com","storeDisplayName":"Apple Store, Augusta","reservationUrl":"http://www.apple.com/retail/augusta/","hoursUrl":"http://www.apple.com/retail/augusta/","directionsUrl":"http://www.apple.com/retail/augusta/map","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Augusta","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/augusta/images/augusta_hero_43.jpg","phoneNumber":"1-706-731 1800"},{"address":{"postalCode":"30326","address":"Apple Store, Lenox Square","address2":"3393 Peachtree Road NE","address3":null},"state":"GA","country":"US","city":"Atlanta","storeNumber":"R006","storeName":"Lenox Square","storeEmail":"lenoxsquare@apple.com","storeDisplayName":"Apple Store, Lenox Square","reservationUrl":"http://www.apple.com/retail/lenoxsquare","hoursUrl":"http://www.apple.com/retail/lenoxsquare","directionsUrl":"http://www.apple.com/retail/lenoxsquare/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"11:00 AM-6:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Lenox Square","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/lenoxsquare/images/lenoxsquare_hero_43.jpg","phoneNumber":"1-404-926 3085"},{"address":{"postalCode":"30346","address":"Apple Store, Perimeter","address2":"4400 Ashford Dunwoody Road","address3":null},"state":"GA","country":"US","city":"Atlanta","storeNumber":"R184","storeName":"Perimeter","storeEmail":"perimeter@apple.com","storeDisplayName":"Apple Store, Perimeter","reservationUrl":"http://www.apple.com/retail/perimeter","hoursUrl":"http://www.apple.com/retail/perimeter","directionsUrl":"http://www.apple.com/retail/perimeter/","storeHours":{"storeHoursText":"Store Hours:","bopisPickupDays":"","bopisPickupHours":"","hours":[{"storeDays":"Mon-Sat","storeTimings":"10:00 AM-9:00 PM"},{"storeDays":"Sun","storeTimings":"12:00 PM-7:00 PM"}]},"partsAvailability":{"MGAU2LL/A":{"storeSelectionEnabled":false,"pickupQuote":"Currently unavailable at Apple Store, Perimeter","storeSearchEnabled":true,"pickupDisplay":"unavailable","pickupSearchQuote":"Unavailable for Pickup"}},"storeImageUrl":"http://images.apple.com/retail/perimeter/images/perimeter_hero_43.jpg","phoneNumber":"1-678-459 9800"}]}}
require 'pp'
require 'pry'
require 'json'
require 'open-uri'
require 'twilio-ruby'
sexts = 0
bryce_phone = '+13215555555'
twil_phone = '+13215555555'
twilio = client = Twilio::REST::Client.new 'xxx', 'yyy'
begin
loop do
# every minute
# get the json
body = open('http://store.apple.com/us/retailStore/availabilitySearch?parts.0=MGAU2LL%2FA&zip=33175'){|resp| resp.read }
puts "#{Time.now.iso8601}: read #{body.length}"
doc = JSON.parse body
# check the top five stores
available = doc['body']['stores'][0..4].select{|store| store['partsAvailability']['MGAU2LL/A']['pickupDisplay'] != 'unavailable'}
pp available
# sms twilio if partsAvailability.pickupDisplay isn't unavailable
unless available.empty?
sexts += 1
if sexts > 3
pp twilio.account.messages.create(
from: twil_phone,
to: bryce_phone,
body: "Phones available, reminded you ten times, i'm out fool"
)
exit
end
pp twilio.account.messages.create(
from: twil_phone,
to: bryce_phone,
body: "OMG #{available.length} phones available!!!!"
)
end
sleep 60
sleep rand(60)
end
rescue => e
pp e
pp e.backtrace
pp twilio.account.messages.create(
from: twil_phone,
to: bryce_phone,
body: "exception… i'm dying"
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment