Class: Echelon::DisneylandParis
- Defined in:
- lib/echelon/parks/disneyland_paris.rb
Instance Attribute Summary collapse
-
#json_data ⇒ Object
readonly
Returns the value of attribute json_data.
Instance Method Summary collapse
-
#initialize ⇒ DisneylandParis
constructor
A new instance of DisneylandParis.
- #ride_list ⇒ Object
Methods inherited from Park
#find_by_id, #find_by_name, #rides
Constructor Details
#initialize ⇒ DisneylandParis
Returns a new instance of DisneylandParis.
53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 |
# File 'lib/echelon/parks/disneyland_paris.rb', line 53 def initialize # fetch the zipped json feed from the same url as the disney iphone app # (you have no idea how long this took to work out) http = Net::HTTP.new('disney.cms.pureagency.com', 443) http.use_ssl = true http.verify_mode = OpenSSL::SSL::VERIFY_NONE data = 'key=Ajjjsh;Uj' headers = { 'User-Agent' => 'Disneyland 1.0 (iPhone; iPhone OS 4.1; en_GB)', 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8' } resp, _data = http.post('/cms/ProxyTempsAttente', data, headers) tmp = Tempfile.new('disneyland_paris_zip') tmp << resp.body tmp.close json_data = nil Zip::ZipFile.open(tmp.path) do |zipfile| json_data = JSON.parse(zipfile.read('temps_attente.json')) json_data = json_data['l'] end i = 0 rides = [] while i < json_data.count ride = [] ride << json_data[i] ride << json_data[i + 1] ride << json_data[i + 2] ride << json_data[i + 3] ride << json_data[i + 4] rides << ride i += 5 end @json_data = rides end |
Instance Attribute Details
#json_data ⇒ Object (readonly)
Returns the value of attribute json_data.
12 13 14 |
# File 'lib/echelon/parks/disneyland_paris.rb', line 12 def json_data @json_data end |
Instance Method Details
#ride_list ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/echelon/parks/disneyland_paris.rb', line 14 def ride_list { 'P1AA01' => 'La Cabane des Robinson', 'P1AA02' => 'Indiana Jones and the Temple of Peril', 'P1AA04' => 'Pirates of the Caribbean', 'P1DA03' => 'Autopia', 'P1DA04' => 'Buzz Lightyear Laser Blast', 'P1DA06' => 'Les Mystères du Nautilus', 'P1DA07' => 'Orbitron', 'P1DA08' => 'Space Mountain: Mission 2', 'P1DA09' => 'Star Tours', 'P1DA12' => 'Captain EO', 'P1NA00' => 'Alice\'s Curious Labyrinth', 'P1NA01' => 'Blanche-Neige et les Sept Nains', 'P1NA02' => 'Le Carrousel de Lancelot', 'P1NA03' => 'Casey Jr. - le Petit Train du Cirque', 'P1NA05' => 'Dumbo the Flying Elephant', 'P1NA07' => '"it\'s a small world" Celebration', 'P1NA08' => 'Mad Hatter\'s Tea Cups', 'P1NA09' => 'Le Pays des Contes de Fées', 'P1NA10' => 'Peter Pan\'s Flight', 'P1NA13' => 'Les Voyages de Pinocchio', 'P1RA00' => 'Big Thunder Mountain', 'P1RA03' => 'Phantom Manor', 'P1RA04' => 'River Rogue Keelboats', 'P2XA00' => 'Studio Tram Tour: Behind the Magic', 'P2XA01' => 'CinéMagique', 'P2XA02' => 'Cars Quatre Roues Rallye', 'P2XA03' => 'Crush\'s Coaster', 'P2XA05' => 'Flying Carpets Over Agrabah', 'P2XA06' => 'RC Racer', 'P2XA07' => 'Toy Soldiers Parachute Drop', 'P2XA08' => 'Slinky Dog Zigzag Spin', 'P2ZA00' => 'Armageddon : les Effets Spéciaux', 'P2ZA01' => 'Rock\'n\'Roller Coaster starring Aerosmith', 'P2ZA02' => 'The Twilight Zone Tower of Terror' } end |