flightcheck 0.0.1

Sign up to get free protection for your applications and to get access to all the features.
Files changed (3) hide show
  1. checksums.yaml +7 -0
  2. data/lib/flightcheck.rb +23 -0
  3. metadata +44 -0
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA1:
3
+ metadata.gz: 40247bf3a3618bbc0417aaec093e5542acbe90c6
4
+ data.tar.gz: cc7c3ba8ed916b820b4f8ee0a703fe54fad47923
5
+ SHA512:
6
+ metadata.gz: 8cf82a8d44a7081f7c6c67cf6e85c97e5427646e2daca7f37208105770a7d78e298205f3eb0f24384591dcd6a32f3dc6a5d965e4a590531be6567ce028e41247
7
+ data.tar.gz: 4ac2bd41b97f26ac2a8b820601476c3bbc962c975d458dc8484e3d51a38b5c09b7a7faa6f28e6f70985d6f8ffbfd0791471c6375dbb8fcf607cf684abfbd63ed
@@ -0,0 +1,23 @@
1
+ require 'mechanize'
2
+
3
+ class Flight
4
+ attr_reader :flightNumber, :departureDate, :title, :status
5
+
6
+ def initialize(flightNumber, departureDate)
7
+ @flightNumber = flightNumber
8
+ @departureDate = departureDate
9
+ end
10
+
11
+ def check
12
+ @url = "http://www.flightstats.com/go/FlightStatus/flightStatusByFlight.do?airline=&flightNumber=#{flightNumber}&departureDate=#{departureDate}"
13
+
14
+ a = Mechanize.new
15
+ a.get(@url) do |page|
16
+ @title = page.search("head > title").text.strip
17
+ @status = page.search("#mainAreaLeftColumn > div.uiComponent674.flightStatusByFlightBlock > div > div.statusBlock.statusBlockRed > div.statusType").text.strip
18
+ end
19
+
20
+ puts @title
21
+ puts @status
22
+ end
23
+ end
metadata ADDED
@@ -0,0 +1,44 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: flightcheck
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.0.1
5
+ platform: ruby
6
+ authors:
7
+ - Narek Aramjan
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2014-05-17 00:00:00.000000000 Z
12
+ dependencies: []
13
+ description:
14
+ email: narek.aramjan@gmail.com
15
+ executables: []
16
+ extensions: []
17
+ extra_rdoc_files: []
18
+ files:
19
+ - lib/flightcheck.rb
20
+ homepage: http://rubygems.org/gems/flightcheck
21
+ licenses:
22
+ - MIT
23
+ metadata: {}
24
+ post_install_message:
25
+ rdoc_options: []
26
+ require_paths:
27
+ - lib
28
+ required_ruby_version: !ruby/object:Gem::Requirement
29
+ requirements:
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '0'
33
+ required_rubygems_version: !ruby/object:Gem::Requirement
34
+ requirements:
35
+ - - ">="
36
+ - !ruby/object:Gem::Version
37
+ version: '0'
38
+ requirements: []
39
+ rubyforge_project:
40
+ rubygems_version: 2.2.2
41
+ signing_key:
42
+ specification_version: 4
43
+ summary: A simple flight status checker
44
+ test_files: []