jetblue_plane_tracker 0.2.5 → 0.2.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/lib/jetblue_plane_tracker/airport.rb +13 -13
- data/lib/jetblue_plane_tracker/arrival.rb +0 -4
- data/lib/jetblue_plane_tracker/departure.rb +0 -5
- data/lib/jetblue_plane_tracker/flight.rb +1 -1
- data/lib/jetblue_plane_tracker/leg.rb +22 -22
- data/lib/jetblue_plane_tracker/travel.rb +1 -2
- data/lib/jetblue_plane_tracker/version.rb +1 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
OWM0MTdlMjNmYWY3ZTk2N2FiNGU4NGFjM2E5YjQwMTliMDI1ODhjMA==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
MWY5MGRmZDdkMjNkZTZhOGIxYTk2YWQyMWYxZjA5MzJiNTFhNTA1OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NzljODQ5MzEyNDY4ZjFkNjE1ZmNiMjU5YjZjYjAzMDRlYmMxYzBhNWRjOWJj
|
10
|
+
ZWZiZjJkNzNiOTlkZjkwM2Y2NDNlNGRiMDRhODdkYTM5NmEyNWU0N2MwMWU5
|
11
|
+
Yjc2ODE2MjQzYzI1MGQxNWVmNWI4MGRmYjJhNzkwNWUyYmFlOGY=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
ZjFmZDlhNmM4ZDAyNjJiMDNhZjRkZDczM2Q5YmEyZDM5ODljMGZjYzU2MjNh
|
14
|
+
ZThjYmFiYzNmMmY4NzJhZjVkNzA2NjcyNjdlZmFiMmQxYmRhZGU3YWRiYzIx
|
15
|
+
NDAwNTMxNGI2N2QyZjI3YWFmZTc2OTg0NTZkNGZjZTgyMjU0OTU=
|
@@ -10,8 +10,8 @@
|
|
10
10
|
self.name = name
|
11
11
|
self.city = city
|
12
12
|
self.country = country
|
13
|
-
self.longitude = longitude
|
14
|
-
self.latitude = latitude
|
13
|
+
self.longitude = longitude.to_f
|
14
|
+
self.latitude = latitude.to_f
|
15
15
|
self.altitude = altitude
|
16
16
|
self.timezone = timezone
|
17
17
|
self.dst = dst
|
@@ -29,17 +29,17 @@
|
|
29
29
|
|
30
30
|
def to_json
|
31
31
|
{
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
}
|
32
|
+
iata: self.iata,
|
33
|
+
icao: self.icao,
|
34
|
+
name: self.name,
|
35
|
+
city: self.city,
|
36
|
+
country: self.country,
|
37
|
+
latitude: self.latitude,
|
38
|
+
longitude: self.longitude,
|
39
|
+
altitude: self.altitude,
|
40
|
+
timezone: self.timezone,
|
41
|
+
dst: self.dst
|
42
|
+
}
|
43
43
|
end
|
44
44
|
|
45
45
|
class << self
|
@@ -1,11 +1,6 @@
|
|
1
1
|
module JetBluePlaneTracker
|
2
2
|
class Departure < Travel
|
3
3
|
|
4
|
-
def initialize(airport, scheduled_takeoff, actual_takeoff, terminal, gate, temperature)
|
5
|
-
super(airport, scheduled_takeoff, actual_takeoff, terminal, gate, temperature)
|
6
|
-
end
|
7
|
-
|
8
|
-
|
9
4
|
class << self
|
10
5
|
|
11
6
|
def parse(leg)
|
@@ -16,18 +16,6 @@ module JetBluePlaneTracker
|
|
16
16
|
"##{number}\n#{departure}\n#{arrival}\n#{status}\n#{progress}"
|
17
17
|
end
|
18
18
|
|
19
|
-
def to_json
|
20
|
-
{
|
21
|
-
"number" => self.number,
|
22
|
-
"date" => self.date,
|
23
|
-
"departure" => self.departure.to_json,
|
24
|
-
"arrival" => self.arrival.to_json,
|
25
|
-
"status" => self.status,
|
26
|
-
"progress" => self.progress,
|
27
|
-
"current_location" => self.current_location
|
28
|
-
}.to_json
|
29
|
-
end
|
30
|
-
|
31
19
|
def flight_tracker_progress
|
32
20
|
min_progress = 0
|
33
21
|
max_progress = 1
|
@@ -50,21 +38,33 @@ module JetBluePlaneTracker
|
|
50
38
|
progress * 100
|
51
39
|
end
|
52
40
|
|
53
|
-
|
41
|
+
|
54
42
|
def current_location
|
55
|
-
departude_longitude = self.departure.airport.longitude.to_f
|
56
|
-
arrival_longitude = self.arrival.airport.longitude.to_f
|
57
|
-
current_progress = self.progress / 100
|
58
|
-
|
59
|
-
current_latitude = self.arrival.airport.latitude
|
60
|
-
current_longitude = get_plane_longitude(departude_longitude, arrival_longitude, current_progress)
|
61
43
|
|
62
|
-
|
44
|
+
departure = self.departure.airport
|
45
|
+
arrival = self.arrival.airport
|
46
|
+
current_progress = self.progress/100
|
47
|
+
|
48
|
+
latitude = get_plane_coordinate(departure.latitude, arrival.latitude, current_progress)
|
49
|
+
longitude = get_plane_coordinate(departure.longitude, arrival.longitude, current_progress)
|
50
|
+
|
51
|
+
{
|
52
|
+
latitude: latitude,
|
53
|
+
longitude: longitude
|
54
|
+
}
|
63
55
|
end
|
64
56
|
|
65
57
|
private
|
66
|
-
def
|
67
|
-
|
58
|
+
def get_plane_coordinate(coordinate_x, coordinate_y, progress)
|
59
|
+
new_coordinate = 0
|
60
|
+
|
61
|
+
if(coordinate_x != coordinate_y)
|
62
|
+
new_coordinate = coordinate_x + progress * (coordinate_y - coordinate_x)
|
63
|
+
else
|
64
|
+
new_coordinate = coordinate_x
|
65
|
+
end
|
66
|
+
|
67
|
+
new_coordinate
|
68
68
|
end
|
69
69
|
|
70
70
|
end
|
@@ -16,7 +16,6 @@ module JetBluePlaneTracker
|
|
16
16
|
"#{type}-> Airport: #{airport.name} Scheduled Take-Off: #{scheduled_takeoff} - Actual Take-Off: #{actual_takeoff} [Terminal: #{terminal}, Gate: #{gate}, Temperature: #{temperature}]"
|
17
17
|
end
|
18
18
|
|
19
|
-
|
20
19
|
def to_json
|
21
20
|
{
|
22
21
|
"airport" => self.airport.to_json,
|
@@ -25,7 +24,7 @@ module JetBluePlaneTracker
|
|
25
24
|
"terminal" => self.terminal,
|
26
25
|
"gate" => self.gate,
|
27
26
|
"temperature" => self.temperature
|
28
|
-
}
|
27
|
+
}
|
29
28
|
end
|
30
29
|
|
31
30
|
def type
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: jetblue_plane_tracker
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Brian Díaz
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-08-
|
11
|
+
date: 2015-08-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -44,14 +44,14 @@ dependencies:
|
|
44
44
|
requirements:
|
45
45
|
- - ! '>='
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.2.18
|
48
48
|
type: :runtime
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.2.18
|
55
55
|
description: A Ruby wrapper for JetBlue flights status API
|
56
56
|
email: brian@briandiaz.me
|
57
57
|
executables: []
|