altflights 0.0.2 → 0.0.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.
- data/Rakefile +6 -0
- data/lib/altflights.rb +2 -2
- data/lib/altflights/kayak_wrapper.rb +10 -9
- metadata +7 -4
data/Rakefile
CHANGED
data/lib/altflights.rb
CHANGED
@@ -19,8 +19,8 @@ module AltFlights
|
|
19
19
|
|
20
20
|
def get_flights(searchid, sid, count) # date_string format => '%m/%d/%y'
|
21
21
|
|
22
|
-
if count.to_i >
|
23
|
-
count =
|
22
|
+
if count.to_i > 100
|
23
|
+
count = 100
|
24
24
|
end
|
25
25
|
|
26
26
|
results = AltFlights::KayakWrapper.poll_results(searchid, sid, count)
|
@@ -12,7 +12,7 @@ class AltFlights::KayakWrapper
|
|
12
12
|
self.sid = nil
|
13
13
|
Net::HTTP.start(HOSTNAME, PORT) do |http|
|
14
14
|
response = http.get("/k/ident/apisession?token=#{api_key}")
|
15
|
-
|
15
|
+
logger = "http://#{HOSTNAME}/k/ident/apisession?token=#{api_key}"
|
16
16
|
body = response.body
|
17
17
|
parser = LibXML::XML::Parser.string(body)
|
18
18
|
doc = parser.parse
|
@@ -37,16 +37,17 @@ class AltFlights::KayakWrapper
|
|
37
37
|
self.searchid = nil
|
38
38
|
Net::HTTP.start(HOSTNAME, PORT) do |http|
|
39
39
|
response = http.get(url)
|
40
|
-
|
40
|
+
logger = "http://#{HOSTNAME}#{url}"
|
41
41
|
body = response.body
|
42
42
|
parser = LibXML::XML::Parser.string(body)
|
43
43
|
doc = parser.parse
|
44
44
|
self.searchid = doc.find('//searchid')
|
45
45
|
if searchid.first != nil
|
46
|
-
|
46
|
+
self.searchid = self.searchid.first.inner_xml
|
47
|
+
logger = "searchid: #{self.searchid}"
|
47
48
|
else
|
48
|
-
|
49
|
-
|
49
|
+
puts "search error:"
|
50
|
+
puts body
|
50
51
|
return nil
|
51
52
|
end
|
52
53
|
end
|
@@ -60,7 +61,7 @@ class AltFlights::KayakWrapper
|
|
60
61
|
url += "&c=#{count}"
|
61
62
|
end
|
62
63
|
response = http.get(url)
|
63
|
-
|
64
|
+
logger = "http://#{HOSTNAME}#{url}"
|
64
65
|
body = response.body
|
65
66
|
if count
|
66
67
|
return handle_results(body)
|
@@ -77,12 +78,12 @@ class AltFlights::KayakWrapper
|
|
77
78
|
doc = parser.parse
|
78
79
|
more = doc.find('/searchresult/morepending')
|
79
80
|
|
80
|
-
|
81
|
+
logger = "count: #{last_count = doc.find('/searchresult/count').first.inner_xml}"
|
81
82
|
if more
|
82
83
|
more = more.first.inner_xml
|
83
84
|
end
|
84
85
|
|
85
|
-
if more == '
|
86
|
+
if more == 'true'
|
86
87
|
return 0
|
87
88
|
else
|
88
89
|
return last_count
|
@@ -93,7 +94,7 @@ class AltFlights::KayakWrapper
|
|
93
94
|
parser = LibXML::XML::Parser.string(body)
|
94
95
|
doc = parser.parse
|
95
96
|
|
96
|
-
|
97
|
+
logger = "alternate flight count: #{doc.find('/searchresult/count').first.inner_xml}"
|
97
98
|
|
98
99
|
results = []
|
99
100
|
doc.find("/searchresult/trips/trip").each do |t|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: altflights
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- FlightCaster
|
@@ -10,7 +10,7 @@ autorequire:
|
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
12
|
|
13
|
-
date: 2010-
|
13
|
+
date: 2010-03-04 00:00:00 -08:00
|
14
14
|
default_executable:
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
@@ -66,5 +66,8 @@ rubygems_version: 1.3.5
|
|
66
66
|
signing_key:
|
67
67
|
specification_version: 3
|
68
68
|
summary: Kayak alternative flights wrapper
|
69
|
-
test_files:
|
70
|
-
|
69
|
+
test_files:
|
70
|
+
- lib/altflights/booking.rb
|
71
|
+
- lib/altflights/flight.rb
|
72
|
+
- lib/altflights/kayak_wrapper.rb
|
73
|
+
- lib/altflights.rb
|