jetblue_plane_tracker 0.2.6 → 0.2.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +8 -8
- data/README.md +1 -15
- data/lib/jetblue_plane_tracker/airport.rb +33 -7
- data/lib/jetblue_plane_tracker/flight.rb +2 -2
- data/lib/jetblue_plane_tracker/travel.rb +1 -1
- data/lib/jetblue_plane_tracker/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
MGJhN2ZiZGFmMDdhNWNmYTY3MzdlZTNlYzM1MmRhZGRiZjBjMGQ5MQ==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
YzRiMmJlNzBkN2RlZmYwYTY3ZGU3Zjk4MmJlN2FlMzlhNGVmNTc2OQ==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
YTM5NTkxNTBjNTRkMGNiYjZmY2U5YTJiOGRjZjRmNjIxMTVhNGY3MTQwMzIz
|
10
|
+
ODc4YjNmMzhiZDJjYzgyYzJhMTdjZTc1MTI2YjBlMmNmODdkNDllMDMwYTY1
|
11
|
+
ZGRiMjI5M2Q2Y2Q2NDFiNDlmYzlmNmVlMWZjNmNlMWFkYzdhNGU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
NTQ4Y2VjZDk4YjIxMGE0NTU1Y2IyYmFiYjA3YWEwMjI0YTAwNTBiYjYyNzEw
|
14
|
+
NGYyOTI0ZjAxNjk1OTgyNzU3ZmNiMDE5MzVjMDE0ZTlmNGRmOTUzNWQ3ZWFh
|
15
|
+
ODIzOGI0YjQwYzdlMzE1OThmMmU0OGI4MzJhNTU5NjUyYTAxYzg=
|
data/README.md
CHANGED
@@ -5,7 +5,7 @@ A Ruby wrapper for JetBlue flights status tracker.
|
|
5
5
|
|
6
6
|
Install the gem via the CLI
|
7
7
|
|
8
|
-
```
|
8
|
+
```ruby
|
9
9
|
gem install jetblue_plane_tracker
|
10
10
|
```
|
11
11
|
|
@@ -34,20 +34,6 @@ Get a flight status by the flight number and its date:
|
|
34
34
|
```ruby
|
35
35
|
flights = jbtracker.flight_status(flight: 37, date: "2015-07-29")
|
36
36
|
```
|
37
|
-
|
38
|
-
Print flights by:
|
39
|
-
```ruby
|
40
|
-
flights.each { |flight| puts flight }
|
41
|
-
```
|
42
|
-
Print flights into json by:
|
43
|
-
```ruby
|
44
|
-
flights.each { |flight| puts flight.to_json }
|
45
|
-
```
|
46
|
-
Convert to JSON by:
|
47
|
-
```ruby
|
48
|
-
flights.map { |flight| flight.to_json }
|
49
|
-
```
|
50
|
-
|
51
37
|
## Suggestions
|
52
38
|
|
53
39
|
* Date Format is ```yyyy-mm-dd```
|
@@ -48,16 +48,42 @@
|
|
48
48
|
airport_name[/[(][a-zA-Z]*[)]/, 0].gsub(/[()]/, "").strip.to_s
|
49
49
|
end
|
50
50
|
|
51
|
-
def
|
51
|
+
def find_by_iata(iata_code)
|
52
|
+
data = get_json
|
53
|
+
airport_data = data[iata_code]
|
54
|
+
new_object_instance(airport_data)
|
55
|
+
end
|
56
|
+
|
57
|
+
def search(search_text)
|
58
|
+
data = get_json
|
59
|
+
airports = []
|
60
|
+
data.each do |d|
|
61
|
+
airport_data = d[1]
|
62
|
+
airports << new_object_instance(airport_data) if airport_data.has_value?(search_text)
|
63
|
+
end
|
64
|
+
airports
|
65
|
+
end
|
66
|
+
|
67
|
+
def all
|
68
|
+
data = get_json
|
69
|
+
airports = []
|
70
|
+
data.each do |airport_data|
|
71
|
+
airports << new_object_instance(airport_data[1])
|
72
|
+
end
|
73
|
+
airports
|
74
|
+
end
|
75
|
+
|
76
|
+
def get_json
|
52
77
|
file = File.read(File.expand_path('../../data/airports.json', __FILE__))
|
53
|
-
|
54
|
-
airport_data = data[options[:iata]]
|
55
|
-
new(airport_data["iata"], airport_data["icao"], airport_data["name"],
|
56
|
-
airport_data["city"], airport_data["country"], airport_data["latitude"],
|
57
|
-
airport_data["longitude"], airport_data["altitude"], airport_data["timezone"],
|
58
|
-
airport_data["dst"])
|
78
|
+
JSON.parse(file)
|
59
79
|
end
|
60
80
|
|
81
|
+
def new_object_instance(airport_data)
|
82
|
+
new(airport_data["iata"], airport_data["icao"], airport_data["name"],
|
83
|
+
airport_data["city"], airport_data["country"], airport_data["latitude"],
|
84
|
+
airport_data["longitude"], airport_data["altitude"], airport_data["timezone"],
|
85
|
+
airport_data["dst"])
|
86
|
+
end
|
61
87
|
|
62
88
|
end
|
63
89
|
|
@@ -3,8 +3,8 @@ module JetBluePlaneTracker
|
|
3
3
|
attr_accessor :origin, :destination, :legs
|
4
4
|
|
5
5
|
def initialize(origin, destination, legs)
|
6
|
-
self.origin = Airport.
|
7
|
-
self.destination = Airport.
|
6
|
+
self.origin = Airport.find_by_iata(Airport.parse_airport_iata(origin))
|
7
|
+
self.destination = Airport.find_by_iata(Airport.parse_airport_iata(destination))
|
8
8
|
self.legs = legs
|
9
9
|
end
|
10
10
|
|
@@ -4,7 +4,7 @@ module JetBluePlaneTracker
|
|
4
4
|
|
5
5
|
def initialize(airport, scheduled_takeoff, actual_takeoff, terminal, gate, temperature)
|
6
6
|
super()
|
7
|
-
self.airport = Airport.
|
7
|
+
self.airport = Airport.find_by_iata(Airport.parse_airport_iata(airport))
|
8
8
|
self.scheduled_takeoff = DateTime.parse(scheduled_takeoff)
|
9
9
|
self.actual_takeoff = DateTime.parse(actual_takeoff)
|
10
10
|
self.terminal = terminal
|
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.7
|
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-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|