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.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/flightcheck.rb +22 -7
  3. metadata +2 -2
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 5e305044fb746cf2c50727f31bd1075b81022186
4
- data.tar.gz: b1a3d8eeeea3f267364310c44223a7f7ea7e3d77
3
+ metadata.gz: bdb7135f2e28deaff5f27571923eb7b603fc58ec
4
+ data.tar.gz: e3d30b474b4bc5a2b2e199eaa1ca1975d8e746f6
5
5
  SHA512:
6
- metadata.gz: 279499c474d34255037df1d884266d7b0a3a2888f2551a8d61d2deb4a0c82edf72f4b7588c18cce3fae06cb581cf89d48cf1df2e2fd098e933e6f9e02c940398
7
- data.tar.gz: f5ddcfbfd85609bdfbdf2e4fc772c81acabe4db8fd3138ac5247bfbfeb3c2236af5fdb59cc3f7342667e88844826c27df3b0128e1a2c13dfdc659a10e7a9db45
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, :raw_airline_iata, :airline_iata, :departure_airport, :arrival_airport
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.6
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-30 00:00:00.000000000 Z
11
+ date: 2014-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: mechanize