flightcheck 0.0.6 → 0.0.7
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.
- checksums.yaml +4 -4
- data/lib/flightcheck.rb +22 -7
- 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: bdb7135f2e28deaff5f27571923eb7b603fc58ec
|
4
|
+
data.tar.gz: e3d30b474b4bc5a2b2e199eaa1ca1975d8e746f6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ef8e83ffee2b4f3657f47a378af5c697bb1a2c7e2bdedb6871b91b931f45e39bfa55d19a338f0d68009babdc12bec9bee0283a0ee6bf13bf0910156bd61e6318
|
7
|
+
data.tar.gz: d7c12d9d9bcc327af9038842499334d274f650c9cea3dccd823d396a6a069b4f47f82a6bcd71de5ffa731a41a903649cbbaf7b43ed69b0cd61c05225f042d5f3
|
data/lib/flightcheck.rb
CHANGED
@@ -1,7 +1,10 @@
|
|
1
1
|
require 'mechanize'
|
2
2
|
|
3
3
|
class Flight
|
4
|
-
attr_reader :flight_number, :departure_date, :title, :status, :route, :url,
|
4
|
+
attr_reader :flight_number, :departure_date, :title, :status, :route, :url,
|
5
|
+
:raw_airline_iata, :airline_iata, :route_array, :departure_airport_iata,
|
6
|
+
:departure_airport_city, :departure_country_iata, :arriving_airport_iata,
|
7
|
+
:arriving_airport_city, :arriving_country_iata
|
5
8
|
|
6
9
|
## Initialize
|
7
10
|
def initialize(flight_number, departure_date)
|
@@ -49,12 +52,6 @@ class Flight
|
|
49
52
|
# Extract the airline IATA without the parentheses
|
50
53
|
@airline_iata = /\w+/.match(@raw_airline_iata)
|
51
54
|
|
52
|
-
## Departure airport IATA
|
53
|
-
# @raw_departure_airport_iata = /\w+/.match(@route).to_s
|
54
|
-
|
55
|
-
## Arrival airport IATA
|
56
|
-
# Code here
|
57
|
-
|
58
55
|
## Flight route
|
59
56
|
# Cleanup the scraped route information
|
60
57
|
|
@@ -70,10 +67,28 @@ class Flight
|
|
70
67
|
# Substitue all " " with " "
|
71
68
|
@route.gsub!(" ", " ")
|
72
69
|
|
70
|
+
## Departure airport
|
71
|
+
# Extract departure airport information from @route
|
72
|
+
|
73
|
+
# Split route string into an array
|
74
|
+
@route_array = @route.split
|
75
|
+
|
76
|
+
# Put information inside the corresponding variables
|
77
|
+
@departure_airport_iata = @route_array[0].delete!("( )")
|
78
|
+
@departure_airport_city = @route_array[1].delete!(",")
|
79
|
+
@departure_country_iata = @route_array[2]
|
80
|
+
|
81
|
+
@arriving_airport_iata = @route_array[4].delete!("( )")
|
82
|
+
@arriving_airport_city = @route_array[5].delete!(",")
|
83
|
+
@arriving_country_iata = @route_array[6]
|
84
|
+
|
73
85
|
## Information
|
74
86
|
# Print all relevant information to te console
|
75
87
|
puts @title
|
76
88
|
puts @status
|
77
89
|
puts @route
|
90
|
+
|
91
|
+
|
92
|
+
|
78
93
|
end
|
79
94
|
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.7
|
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-31 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: mechanize
|