flightcheck 0.0.4 → 0.0.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/flightcheck.rb +18 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5648fb618f9441ef33e3a1bff16d418cdb8d61c3
|
4
|
+
data.tar.gz: d2d069e30c372f2388a8ba2f4782e9ae43b2422a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 20a9c2c0da573f964270277e37b3c07638b2c6f1009bbb4369bf03562854bde50fa3ff4d8bfb63bd0a1f4b793d4bfe448ff5b7130933780048449b76d9a2ad85
|
7
|
+
data.tar.gz: 918596fe39ffc9d7e6c9e6e686aae35b85f192fadab1da47147c19726b93cab934cb3b32cf9bb3e384ce3e4df2350af1359b490952f5b8dbbee97c1198ee9397
|
data/lib/flightcheck.rb
CHANGED
@@ -1,12 +1,15 @@
|
|
1
1
|
require 'mechanize'
|
2
2
|
|
3
3
|
class Flight
|
4
|
-
attr_reader :flightNumber, :departureDate, :title, :status, :url
|
4
|
+
attr_reader :flightNumber, :departureDate, :title, :status, :url, :raw_airline_iata, :airline_iata, :departure_airport, :arrival_airport
|
5
5
|
|
6
6
|
def initialize(flightNumber, departureDate)
|
7
7
|
@flightNumber = flightNumber
|
8
8
|
@departureDate = departureDate
|
9
9
|
@url = "http://www.flightstats.com/go/FlightStatus/flightStatusByFlight.do?airline=&flightNumber=#{flightNumber}&departureDate=#{departureDate}"
|
10
|
+
@airline_iata = nil
|
11
|
+
@departure_airport = nil
|
12
|
+
@arrival_airport = nil
|
10
13
|
end
|
11
14
|
|
12
15
|
def check
|
@@ -18,5 +21,19 @@ class Flight
|
|
18
21
|
|
19
22
|
puts @title
|
20
23
|
puts @status
|
24
|
+
|
25
|
+
## Airline IATA
|
26
|
+
# Extract raw airline iata and convert to string to avoid
|
27
|
+
# TypeError: no implicit conversion of MatchData intro String
|
28
|
+
@raw_airline_iata = /\(\w+\)/.match(@title).to_s
|
29
|
+
|
30
|
+
# Extract the airline IATA without the paraentheses
|
31
|
+
@airline_iata = /\w+/.match(@raw_airline_iata)
|
32
|
+
|
33
|
+
## Departure airport IATA
|
34
|
+
# Code here
|
35
|
+
|
36
|
+
## Arrival airport IATA
|
37
|
+
# Code here
|
21
38
|
end
|
22
39
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: flightcheck
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Narek Aramjan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-05-
|
11
|
+
date: 2014-05-25 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|