altflights 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
data/Rakefile CHANGED
@@ -0,0 +1,6 @@
1
+ require 'rubygems'
2
+ require 'rake/testtask'
3
+
4
+ Rake::TestTask.new(:test) do |t|
5
+ t.test_files = FileList['test/**/*_test.rb']
6
+ end
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 > 50
23
- count = 50
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
- Rails.logger.info "http://#{HOSTNAME}/k/ident/apisession?token=#{api_key}"
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
- Rails.logger.info "http://#{HOSTNAME}#{url}"
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
- Rails.logger.info "searchid: #{self.searchid = self.searchid.first.inner_xml}"
46
+ self.searchid = self.searchid.first.inner_xml
47
+ logger = "searchid: #{self.searchid}"
47
48
  else
48
- Rails.logger.info "search error:"
49
- Rails.logger.info body
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
- Rails.logger.info "http://#{HOSTNAME}#{url}"
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
- Rails.logger.info "count: #{last_count = doc.find('/searchresult/count').first.inner_xml}"
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 == 'false'
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
- Rails.logger.info "alternate flight count: #{doc.find('/searchresult/count').first.inner_xml}"
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.2
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-01-06 00:00:00 -08:00
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