Sha256: ef674cc4cc59a35455d1413609038b5700f4c51c258736f21c9ed738e9ba0eef
Contents?: true
Size: 859 Bytes
Versions: 2
Compression:
Stored size: 859 Bytes
Contents
require 'rubygems' require 'json' require 'net/http' module Echelon class AltonTowers < Park attr_reader :json_data def ride_list { 1 => 'Air', 2 => 'Enterprise', 3 => 'Rita' } end def initialize # fetch the json feed from the merlin site url = "http://www.merlincms.com/2.php" resp = Net::HTTP.get_response(URI.parse(url)) data = resp.body # were only interested in the ride data, throw everything else away json_data = JSON.parse(data) @json_data = json_data["Rides"] end private def create_ride_object(ref) self.json_data.each do |ride| if ride["ref"].to_i == ref return Ride.new(:name => self.ride_list[ref], :queue_time => ride["queue"].to_i, :active => ride["active"].to_i) end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
echelon-0.0.5 | lib/echelon/parks/alton_towers.rb |
echelon-0.0.4 | lib/echelon/parks/alton_towers.rb |