jetblue_plane_tracker 0.2.1 → 0.2.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -2,20 +2,19 @@
2
2
 
3
3
  class Airport
4
4
 
5
- include HTTParty
6
- base_uri "airport-data.com/api"
5
+ attr_accessor :iata, :icao, :name, :city, :country, :latitude, :longitude, :altitude, :timezone, :dst
7
6
 
8
- attr_accessor :icao, :iata, :name, :location, :country, :country_code, :longitude, :latitude
9
-
10
- def initialize(icao, iata, name, location, country, country_code, longitude, latitude)
11
- self.icao = icao
7
+ def initialize(iata, icao, name, city, country, latitude, longitude, altitude, timezone, dst)
12
8
  self.iata = iata
9
+ self.icao = icao
13
10
  self.name = name
14
- self.location = location
11
+ self.city = city
15
12
  self.country = country
16
- self.country_code = country_code
17
13
  self.longitude = longitude
18
14
  self.latitude = latitude
15
+ self.altitude = altitude
16
+ self.timezone = timezone
17
+ self.dst = dst
19
18
  end
20
19
 
21
20
  def to_s
@@ -30,14 +29,16 @@
30
29
 
31
30
  def to_json
32
31
  {
33
- "icao" => self.icao,
34
32
  "iata" => self.iata,
33
+ "icao" => self.icao,
35
34
  "name" => self.name,
36
- "location" => self.location,
35
+ "city" => self.city,
37
36
  "country" => self.country,
38
- "country_code" => self.country_code,
37
+ "latitude" => self.latitude,
39
38
  "longitude" => self.longitude,
40
- "latitude" => self.latitude
39
+ "altitude" => self.altitude,
40
+ "timezone" => self.timezone,
41
+ "dst" => self.dst
41
42
  }.to_json
42
43
  end
43
44
 
@@ -48,15 +49,16 @@
48
49
  end
49
50
 
50
51
  def find(options={})
51
- response = self.get("/ap_info.json", query: options)
52
- if response["status"] == 200
53
- new(response["icao"], response["iata"], response["name"], response["location"],
54
- response["country"], response["country_code"], response["longitude"], response["latitude"])
55
- else
56
- raise response["error"]
57
- end
52
+ file = File.read(File.expand_path('../../data/airports.json', __FILE__))
53
+ data = JSON.parse(file)
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"])
58
59
  end
59
60
 
61
+
60
62
  end
61
63
 
62
64
  end
@@ -1,3 +1,3 @@
1
1
  module JetBluePlaneTracker
2
- VERSION = '0.2.1'
2
+ VERSION = '0.2.3'
3
3
  end
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.1
4
+ version: 0.2.3
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-01 00:00:00.000000000 Z
11
+ date: 2015-08-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: httparty
@@ -45,6 +45,7 @@ extensions: []
45
45
  extra_rdoc_files: []
46
46
  files:
47
47
  - README.md
48
+ - lib/data/airports.json
48
49
  - lib/jetblue_plane_tracker.rb
49
50
  - lib/jetblue_plane_tracker/airport.rb
50
51
  - lib/jetblue_plane_tracker/arrival.rb