echelon 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -4
- data/README.rdoc +14 -5
- data/lib/echelon.rb +2 -0
- data/lib/echelon/parks/seaworld_orlando.rb +68 -0
- data/lib/echelon/parks/seaworld_san_diego.rb +65 -0
- data/lib/echelon/parks/thorpe_park.rb +2 -1
- data/lib/echelon/version.rb +1 -1
- metadata +7 -7
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
echelon (0.0.
|
4
|
+
echelon (0.0.4)
|
5
5
|
json_pure (= 1.4.6)
|
6
6
|
xml-simple (= 1.0.12)
|
7
7
|
zip (= 2.0.2)
|
@@ -28,7 +28,4 @@ PLATFORMS
|
|
28
28
|
DEPENDENCIES
|
29
29
|
bundler (>= 1.0.0)
|
30
30
|
echelon!
|
31
|
-
json_pure (= 1.4.6)
|
32
31
|
rspec (>= 2.4.0)
|
33
|
-
xml-simple (= 1.0.12)
|
34
|
-
zip (= 2.0.2)
|
data/README.rdoc
CHANGED
@@ -12,16 +12,25 @@ Currently only the following parks are supported...
|
|
12
12
|
|
13
13
|
* Thorpe Park
|
14
14
|
* Disneyland Paris
|
15
|
+
* Seaworld San Antonio
|
16
|
+
* Seaworld San Diego
|
17
|
+
* Seaworld Orlando
|
15
18
|
|
16
19
|
== SYNOPSIS:
|
17
20
|
|
18
21
|
require 'echelon'
|
19
|
-
|
20
|
-
|
22
|
+
seaworld = Echelon::SeaworldSanAntonio.new()
|
23
|
+
seaworld.find_by_name("Steel Eel")
|
24
|
+
=> #<Echelon::Ride:0xb7179ca8 @updated_at=#<DateTime>, @name="Steel Eel", @active=1, @queue_time=30>
|
25
|
+
seaworld.rides
|
26
|
+
=> [#<Echelon::Ride:0xb7176454 @updated_at=#<DateTime>, @name="Steel Eel", @active=1, @queue_time=30>,
|
27
|
+
#<Echelon::Ride:0xb7174690 @updated_at=#<DateTime>, @name="Texas Splashdown", @active=0, @queue_time=0>,
|
28
|
+
#<Echelon::Ride:0xb7172854 @updated_at=#<DateTime>, @name="Great White", @active=1, @queue_time=15>,
|
29
|
+
#<Echelon::Ride:0xb7170a40 @updated_at=#<DateTime>, @name="Rio Loco", @active=0, @queue_time=0>,
|
30
|
+
#<Echelon::Ride:0xb716ebc8 @updated_at=#<DateTime>, @name="Journey to Atlantis", @active=1, @queue_time=0>,
|
31
|
+
#<Echelon::Ride:0xb716cd8c @updated_at=#<DateTime>, @name="Lost Lagoon", @active=0, @queue_time=0>,
|
32
|
+
#<Echelon::Ride:0xb716afc8 @updated_at=#<DateTime>, @name="Shamu Express", @active=1, @queue_time=15>]
|
21
33
|
|
22
|
-
== REQUIREMENTS:
|
23
|
-
|
24
|
-
* FIX (list of requirements)
|
25
34
|
|
26
35
|
== INSTALL:
|
27
36
|
|
data/lib/echelon.rb
CHANGED
@@ -7,6 +7,8 @@ require "#{File.dirname(__FILE__)}/echelon/park.rb"
|
|
7
7
|
require "#{File.dirname(__FILE__)}/echelon/parks/thorpe_park.rb"
|
8
8
|
require "#{File.dirname(__FILE__)}/echelon/parks/disneyland_paris.rb"
|
9
9
|
require "#{File.dirname(__FILE__)}/echelon/parks/seaworld_san_antonio.rb"
|
10
|
+
require "#{File.dirname(__FILE__)}/echelon/parks/seaworld_san_diego.rb"
|
11
|
+
require "#{File.dirname(__FILE__)}/echelon/parks/seaworld_orlando.rb"
|
10
12
|
|
11
13
|
module Echelon
|
12
14
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'xmlsimple'
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
module Echelon
|
6
|
+
class SeaworldOrlando < Park
|
7
|
+
|
8
|
+
attr_reader :xml_data
|
9
|
+
|
10
|
+
def ride_list
|
11
|
+
{
|
12
|
+
2002 => 'Wild Arctic Ride',
|
13
|
+
2048 => 'Flying Fiddler',
|
14
|
+
2049 => 'Swishy Fishies',
|
15
|
+
2034 => 'Kraken',
|
16
|
+
2018 => 'Sky Tower',
|
17
|
+
2036 => 'Journey to Atlantis',
|
18
|
+
2037 => 'Manta',
|
19
|
+
2008 => 'Sea Carousel',
|
20
|
+
2044 => 'Shamu Express',
|
21
|
+
2045 => 'Ocean Commotion',
|
22
|
+
2046 => 'Jazzy Jellies'
|
23
|
+
}
|
24
|
+
end
|
25
|
+
|
26
|
+
def initialize
|
27
|
+
# fetch the xml file
|
28
|
+
http = Net::HTTP.new('lab.defimobile.com', 443)
|
29
|
+
http.use_ssl = true
|
30
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
31
|
+
resp, data = http.get('/orlando/rides')
|
32
|
+
|
33
|
+
# were only interested in the ride data, throw everything else away
|
34
|
+
xml_data = XmlSimple.xml_in(data)
|
35
|
+
@xml_data = xml_data['ride']
|
36
|
+
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def create_ride_object(ref)
|
41
|
+
self.xml_data.each do |ride|
|
42
|
+
if ride["id"].to_s.to_i == ref
|
43
|
+
active, queue_time = parse_wait_time(ride["waitTime"].to_s)
|
44
|
+
updated_at = DateTime.parse(ride["lastModified"].to_s)
|
45
|
+
return Ride.new(:name => self.ride_list[ref], :queue_time => queue_time, :active => active, :updated_at => updated_at)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
|
50
|
+
def parse_wait_time(wait)
|
51
|
+
if wait == "Closed"
|
52
|
+
queue_time = 0
|
53
|
+
active = 0
|
54
|
+
elsif wait == "No Wait"
|
55
|
+
queue_time = 0
|
56
|
+
active = 1
|
57
|
+
elsif wait =~ /(\d*) min/
|
58
|
+
queue_time = $1.to_i
|
59
|
+
active = 1
|
60
|
+
else
|
61
|
+
queue_time = 0
|
62
|
+
active = 0
|
63
|
+
end
|
64
|
+
return active, queue_time
|
65
|
+
end
|
66
|
+
|
67
|
+
end
|
68
|
+
end
|
@@ -0,0 +1,65 @@
|
|
1
|
+
require 'rubygems'
|
2
|
+
require 'xmlsimple'
|
3
|
+
require 'net/http'
|
4
|
+
|
5
|
+
module Echelon
|
6
|
+
class SeaworldSanDiego < Park
|
7
|
+
|
8
|
+
attr_reader :xml_data
|
9
|
+
|
10
|
+
def ride_list
|
11
|
+
{
|
12
|
+
1034 => 'Shipwreck Rapids',
|
13
|
+
1024 => 'Skytower',
|
14
|
+
1010 => 'Journey to Atlantis',
|
15
|
+
1011 => 'Wild Arctic Ride',
|
16
|
+
1122 => 'Elmo\'s Flying Fish',
|
17
|
+
1029 => 'Skyride',
|
18
|
+
1123 => 'Abby\'s Sea Star Spin',
|
19
|
+
1121 => 'Oscar\'s Rocking Eel'
|
20
|
+
}
|
21
|
+
end
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
# fetch the xml file
|
25
|
+
http = Net::HTTP.new('lab.defimobile.com', 443)
|
26
|
+
http.use_ssl = true
|
27
|
+
http.verify_mode = OpenSSL::SSL::VERIFY_NONE
|
28
|
+
resp, data = http.get('/san_diego/rides')
|
29
|
+
|
30
|
+
# were only interested in the ride data, throw everything else away
|
31
|
+
xml_data = XmlSimple.xml_in(data)
|
32
|
+
@xml_data = xml_data['ride']
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def create_ride_object(ref)
|
38
|
+
self.xml_data.each do |ride|
|
39
|
+
if ride["id"].to_s.to_i == ref
|
40
|
+
active, queue_time = parse_wait_time(ride["waitTime"].to_s)
|
41
|
+
updated_at = DateTime.parse(ride["lastModified"].to_s)
|
42
|
+
return Ride.new(:name => self.ride_list[ref], :queue_time => queue_time, :active => active, :updated_at => updated_at)
|
43
|
+
end
|
44
|
+
end
|
45
|
+
end
|
46
|
+
|
47
|
+
def parse_wait_time(wait)
|
48
|
+
if wait == "Closed"
|
49
|
+
queue_time = 0
|
50
|
+
active = 0
|
51
|
+
elsif wait == "No Wait"
|
52
|
+
queue_time = 0
|
53
|
+
active = 1
|
54
|
+
elsif wait =~ /(\d*) min/
|
55
|
+
queue_time = $1.to_i
|
56
|
+
active = 1
|
57
|
+
else
|
58
|
+
queue_time = 0
|
59
|
+
active = 0
|
60
|
+
end
|
61
|
+
return active, queue_time
|
62
|
+
end
|
63
|
+
|
64
|
+
end
|
65
|
+
end
|
data/lib/echelon/version.rb
CHANGED
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: echelon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 21
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 0
|
9
|
-
-
|
10
|
-
version: 0.0.
|
9
|
+
- 5
|
10
|
+
version: 0.0.5
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lloyd Pick
|
@@ -15,8 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2011-
|
19
|
-
default_executable:
|
18
|
+
date: 2011-05-26 00:00:00 Z
|
20
19
|
dependencies:
|
21
20
|
- !ruby/object:Gem::Dependency
|
22
21
|
name: bundler
|
@@ -120,7 +119,9 @@ files:
|
|
120
119
|
- lib/echelon/park.rb
|
121
120
|
- lib/echelon/parks/alton_towers.rb
|
122
121
|
- lib/echelon/parks/disneyland_paris.rb
|
122
|
+
- lib/echelon/parks/seaworld_orlando.rb
|
123
123
|
- lib/echelon/parks/seaworld_san_antonio.rb
|
124
|
+
- lib/echelon/parks/seaworld_san_diego.rb
|
124
125
|
- lib/echelon/parks/thorpe_park.rb
|
125
126
|
- lib/echelon/ride.rb
|
126
127
|
- lib/echelon/version.rb
|
@@ -129,7 +130,6 @@ files:
|
|
129
130
|
- spec/echelon_spec.rb
|
130
131
|
- spec/seaworld_san_antonio_spec.rb
|
131
132
|
- spec/thorpe_park_spec.rb
|
132
|
-
has_rdoc: true
|
133
133
|
homepage: http://github.com/lloydpick/echelon
|
134
134
|
licenses: []
|
135
135
|
|
@@ -161,7 +161,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
161
161
|
requirements: []
|
162
162
|
|
163
163
|
rubyforge_project: echelon
|
164
|
-
rubygems_version: 1.4
|
164
|
+
rubygems_version: 1.8.4
|
165
165
|
signing_key:
|
166
166
|
specification_version: 3
|
167
167
|
summary: RubyGem to give quick access to Theme Park queue times
|