craigler 1.3.2 → 1.3.3

Sign up to get free protection for your applications and to get access to all the features.
data/.document CHANGED
@@ -1,4 +1,4 @@
1
- README.rdoc
1
+ README.md
2
2
  lib/**/*.rb
3
3
  bin/*
4
4
  features/**/*.feature
@@ -0,0 +1,17 @@
1
+ *.gem
2
+ *.rbc
3
+ .bundle
4
+ .config
5
+ .yardoc
6
+ Gemfile.lock
7
+ InstalledFiles
8
+ _yardoc
9
+ coverage
10
+ doc/
11
+ lib/bundler/man
12
+ pkg
13
+ rdoc
14
+ spec/reports
15
+ test/tmp
16
+ test/version_tmp
17
+ tmp
@@ -0,0 +1 @@
1
+ --no-private -m markdown lib/**/*.rb - LICENSE
data/Gemfile ADDED
@@ -0,0 +1,4 @@
1
+ source 'https://rubygems.org'
2
+
3
+ # Specify your gem's dependencies in craigler.gemspec
4
+ gemspec
File without changes
@@ -0,0 +1,167 @@
1
+ # Craigler
2
+
3
+ Search API for [craigslist](http://www.craigslist.org/about/sites)
4
+
5
+ ## SYNOPSIS
6
+ I couldn't decide which API I liked best, so you have two choices.
7
+
8
+ Craigler.search(:motorcycles, :in => [:utah, :nevada, :arizona], :for => 'Boulevard M50') do |item|
9
+ puts item.title
10
+ puts item.url
11
+ puts item.time
12
+ end
13
+
14
+ or
15
+
16
+ Craigler.find('Boulevard M50', :in => :california, :only => :motorcycles) do |item|
17
+ puts item.title
18
+ puts item.url
19
+ puts item.time
20
+ end
21
+
22
+ You can also create a search object to fetch the results later. When no location or category is given Craigler searches `:all_for_sale_or_wanted` `:in => :anywhere`
23
+
24
+ search = Craigler::Search.new('Yamaha')
25
+ search.results()
26
+
27
+ Note that the results are cached until you instruct craigler to update them.
28
+
29
+ search.results(:refresh => true)
30
+
31
+ See {Craigler.Search} for a list of all available options
32
+
33
+ ### Supported Categories
34
+ `:all_for_sale_or_wanted`, `:art_and_crafts`, `:auto_parts`, `:baby_and_kid_stuff`, `:barter`, `:bicycles`, `:boats`, `:books`, `:business`, `:cars_and_trucks`, `:clothing`, `:collectibles`, `:community`, `:computers_and_tech`, `:electronics`, `:event`, `:farm_and_garden`, `:free_stuff`, `:furniture`, `:games_and_toys`, `:garage_sales`, `:general`, `:gigs`, `:household`, `:housing`, `:items_wanted`, `:jewelry`, `:jobs`, `:materials`, `:media`, `:motorcycles`, `:musical_instruments`, `:personals`, `:photo_and_video`, `:recreational_vehicles`, `:resume`, `:services_offered`, `:sporting_goods`, `:tickets`, `:tools`
35
+
36
+ ### Supported Locations
37
+
38
+ Use `:anywhere` to search all supported locations.
39
+
40
+ #### States
41
+ `:alaska`, `:arizona`, `:arkansas`, `:california`, `:colorado`, `:connecticut`, `:delaware`, `:dc`, `:florida`, `:georgia`, `:hawaii`, `:idaho`, `:illinois`, `:indiana`, `:iowa`, `:kansas`, `:kentucky`, `:louisiana`, `:maine`, `:maryland`, `:mass`, `:michigan`, `:minnesota`, `:mississippi`, `:missouri`, `:montana`, `:nebraska`, `:nevada`, `:n_hampshire`, `:new_jersey`, `:new_mexico`, `:new_york`, `:n_carolina`, `:north_dakota`, `:ohio`, `:oklahoma`, `:oregon`, `:pennsylvania`, `:rhode_island`, `:s_carolina`, `:south_dakota`, `:tennessee`, `:texas`, `:utah`, `:vermont`, `:virginia`, `:washington`, `:west_virginia` `:wisconsin`, `:wyoming`
42
+ #### Cities
43
+ ##### Alabama
44
+ `:auburn`, `:bham`, `:columbusga`, `:dothan`, `:shoals`, `:gadsden`, `:huntsville`, `:mobile`, `:montgomery`, `:tuscaloosa`
45
+ ##### Alaska
46
+ `:anchorage`
47
+ ##### Arizona
48
+ `:flagstaff`, `:mohave`, `:phoenix`, `:prescott`, `:sierravista`, `:tucson`, `:yuma`
49
+ ##### Arkansas
50
+ `:fayar`, `:fortsmith`, `:jonesboro`, `:littlerock`, `:memphis`, `:texarkana`
51
+ ##### California
52
+ `:sfbay`, `:bakersfield`, `:chico`, `:fresno`, `:goldcountry`, `:humboldt`, `:imperial`, `:inlandempire`
53
+ `:losangeles`, `:mendocino`, `:merced`, `:modesto`, `:monterey`, `:orangecounty`, `:palmsprings`, `:redding`
54
+ `:reno`, `:sacramento`, `:sandiego`, `:slo`, `:santabarbara`, `:stockton`, `:ventura`, `:visalia`, `:yubasutter`
55
+ ##### Colorado
56
+ `:boulder`, `:cosprings`, `:denver`, `:fortcollins`, `:pueblo`, `:rockies`, `:westslope`
57
+ ##### Connecticut
58
+ `:newlondon`, `:hartford`, `:newhaven`, `:nwct`
59
+ ##### Delaware
60
+ `:delaware`
61
+ ##### Dc
62
+ `:washingtondc`
63
+ ##### Florida
64
+ `:daytona`, `:keys`, `:fortmyers`, `:gainesville`, `:jacksonville`, `:lakeland`, `:ocala`, `:orlando`
65
+ `:panamacity`, `:pensacola`, `:sarasota`, `:miami`, `:spacecoast`, `:staugustine`, `:tallahassee`, `:tampa`, `:treasure`
66
+ ##### Georgia
67
+ `:athensga`, `:atlanta`, `:augusta`, `:brunswick`, `:columbusga`, `:macon`, `:savannah`, `:valdosta`
68
+ ##### Hawaii
69
+ `:honolulu`
70
+ ##### Idaho
71
+ `:boise`, `:eastidaho`, `:pullman`, `:spokane`, `:twinfalls`
72
+ ##### Illinois
73
+ `:bn`, `:carbondale`, `:chambana`, `:chicago`, `:decatur`, `:peoria`, `:quadcities`, `:rockford`, `:springfieldil`, `:stlouis`
74
+ ##### Indiana
75
+ `:bloomington`, `:evansville`, `:fortwayne`, `:indianapolis`, `:tippecanoe`, `:muncie`, `:southbend`, `:terrehaute`
76
+ ##### Iowa
77
+ `:ames`, `:cedarrapids`, `:desmoines`, `:dubuque`, `:iowacity`, `:omaha`, `:quadcities`, `:siouxcity`, `:waterloo`
78
+ ##### Kansas
79
+ `:kansascity`, `:lawrence`, `:ksu`, `:topeka`, `:wichita`
80
+ ##### Kentucky
81
+ `:bgky`, `:cincinnati`, `:huntington`, `:lexington`, `:louisville`, `:westky`
82
+ ##### Louisiana
83
+ `:batonrouge`, `:lafayette`, `:lakecharles`, `:monroe`, `:neworleans`, `:shreveport`
84
+ ##### Maine
85
+ `:maine`
86
+ ##### Maryland
87
+ `:annapolis`, `:baltimore`, `:easternshore`, `:smd`, `:westmd`
88
+ ##### Mass
89
+ `:boston`, `:capecod`, `:southcoast`, `:westernmass`, `:worcester`
90
+ ##### Michigan
91
+ `:annarbor`, `:centralmich`, `:detroit`, `:flint`, `:grandrapids`, `:jxn`, `:kalamazoo`, `:lansing`
92
+ `:muskegon`, `:nmi`, `:porthuron`, `:saginaw`, `:southbend`, `:swmi`, `:up`
93
+ ##### Minnesota
94
+ `:duluth`, `:fargo`, `:mankato`, `:minneapolis`, `:rmn`, `:stcloud`
95
+ ##### Mississippi
96
+ `:gulfport`, `:hattiesburg`, `:jackson`, `:memphis`, `:northmiss`
97
+ ##### Missouri
98
+ `:columbiamo`, `:joplin`, `:kansascity`, `:semo`, `:springfield`, `:stlouis`
99
+ ##### Montana
100
+ `:montana`
101
+ ##### Nebraska
102
+ `:grandisland`, `:lincoln`, `:omaha`, `:siouxcity`
103
+ ##### Nevada
104
+ `:lasvegas`, `:reno`
105
+ ##### N hampshire
106
+ `:nh`
107
+ ##### New jersey
108
+ `:cnj`, `:jerseyshore`, `:newjersey`, `:southjersey`
109
+ ##### New mexico
110
+ `:albuquerque`, `:farmington`, `:lascruces`, `:roswell`, `:santafe`
111
+ ##### New york
112
+ `:albany`, `:binghamton`, `:buffalo`, `:catskills`, `:chautauqua`, `:elmira`, `:hudsonvalley`, `:ithaca`
113
+ `:longisland`, `:newyork`, `:plattsburgh`, `:rochester`, `:syracuse`, `:utica`, `:watertown`
114
+ ##### N carolina
115
+ `:asheville`, `:boone`, `:charlotte`, `:eastnc`, `:fayetteville`, `:greensboro`, `:hickory`, `:outerbanks`
116
+ `:raleigh`, `:wilmington`, `:winstonsalem`
117
+ ##### North dakota
118
+ `:fargo`, `:nd`
119
+ ##### Ohio
120
+ `:akroncanton`, `:athensohio`, `:cincinnati`, `:cleveland`, `:columbus`, `:dayton`, `:huntington`, `:limaohio`
121
+ `:mansfield`, `:parkersburg`, `:sandusky`, `:toledo`, `:wheeling`, `:youngstown`
122
+ ##### Oklahoma
123
+ `:fortsmith`, `:lawton`, `:oklahomacity`, `:stillwater`, `:tulsa`
124
+ ##### Oregon
125
+ `:bend`, `:corvallis`, `:eastoregon`, `:eugene`, `:medford`, `:oregoncoast`, `:portland`, `:roseburg`, `:salem`
126
+ ##### Pennsylvania
127
+ `:altoona`, `:erie`, `:harrisburg`, `:lancaster`, `:allentown`, `:philadelphia`, `:pittsburgh`, `:poconos`
128
+ `:reading`, `:scranton`, `:pennstate`, `:williamsport`, `:york`
129
+ ##### Rhode island
130
+ `:providence`
131
+ ##### S carolina
132
+ `:charleston`, `:columbia`, `:florencesc`, `:greenville`, `:hiltonhead`, `:myrtlebeach`
133
+ ##### South dakota
134
+ `:sd`
135
+ ##### Tennessee
136
+ `:chattanooga`, `:clarksville`, `:jacksontn`, `:knoxville`, `:memphis`, `:nashville`, `:tricities`
137
+ ##### Texas
138
+ `:abilene`, `:amarillo`, `:austin`, `:beaumont`, `:brownsville`, `:collegestation`, `:corpuschristi`, `:dallas`
139
+ `:elpaso`, `:galveston`, `:houston`, `:killeen`, `:laredo`, `:lubbock`, `:mcallen`, `:odessa`, `:sanantonio`
140
+ `:sanmarcos`, `:texarkana`, `:easttexas`, `:victoriatx`, `:waco`, `:wichitafalls`
141
+ ##### Utah
142
+ `:logan`, `:ogden`, `:provo`, `:saltlakecity`, `:stgeorge`
143
+ ##### Vermont
144
+ `:burlington`
145
+ ##### Virginia
146
+ `:blacksburg`, `:charlottesville`, `:danville`, `:easternshore`, `:fredericksburg`, `:norfolk`, `:harrisonburg`
147
+ `:lynchburg`, `:richmond`, `:roanoke`
148
+ ##### Washington
149
+ `:bellingham`, `:kpr`, `:olympic`, `:pullman`, `:seattle`, `:skagit`, `:spokane`, `:wenatchee`, `:yakima`
150
+ ##### West virginia
151
+ `:charlestonwv`, `:huntington`, `:martinsburg`, `:morgantown`, `:parkersburg`, `:wv`, `:wheeling`
152
+ ##### Wisconsin
153
+ `:appleton`, `:duluth`, `:eauclaire`, `:greenbay`, `:janesville`, `:racine`, `:lacrosse`, `:madison`
154
+ `:milwaukee`, `:sheboygan`, `:wausau`
155
+
156
+
157
+ ## REQUIREMENTS
158
+
159
+ * Hpricot
160
+
161
+ ## INSTALL
162
+
163
+ * sudo gem install craigler
164
+
165
+ ## Copyright
166
+
167
+ Copyright (c) 2009 Devin Christensen. See {file:LICENSE} for details.
data/Rakefile CHANGED
@@ -1,28 +1,4 @@
1
- require 'rubygems'
2
- require 'rake'
3
- require 'yaml'
4
-
5
- begin
6
- require 'jeweler'
7
- Jeweler::Tasks.new do |gem|
8
- gem.name = "craigler"
9
- gem.summary = %Q{Search API for craigslist}
10
- gem.email = "quixoten@gmail.com"
11
- gem.homepage = "http://github.com/threetrieslater/craigler"
12
- gem.authors = ["Devin Christensen"]
13
- gem.add_dependency "hpricot", "~> 0.8.4"
14
- gem.add_development_dependency "shoulda", ">= 2.10.3"
15
- gem.add_development_dependency "rdoc", "~> 3.11.0"
16
- # gem is a Gem::Specification... see http://www.rubygems.org/read/chapter/20 for additional settings
17
- end
18
-
19
- Jeweler::GemcutterTasks.new
20
-
21
- rescue LoadError
22
- puts "Jeweler (or a dependency) not available. Install it with: sudo gem install jeweler"
23
- exit
24
- end
25
-
1
+ require "bundler/gem_tasks"
26
2
  require 'rake/testtask'
27
3
  Rake::TestTask.new(:test) do |test|
28
4
  test.libs << 'lib' << 'test'
@@ -30,35 +6,10 @@ Rake::TestTask.new(:test) do |test|
30
6
  test.verbose = true
31
7
  end
32
8
 
33
- begin
34
- require 'rcov/rcovtask'
35
- Rcov::RcovTask.new do |test|
36
- test.libs << 'test'
37
- test.pattern = 'test/**/*_test.rb'
38
- test.verbose = true
39
- end
40
- rescue LoadError
41
- task :rcov do
42
- abort "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
43
- end
9
+ require 'yard'
10
+ YARD::Rake::YardocTask.new() do |t|
11
+ t.files = ["-", "LICENSE.txt"]
44
12
  end
45
13
 
46
-
47
14
  task :default => :test
48
15
 
49
- require 'rdoc/task'
50
- Rake::RDocTask.new do |rdoc|
51
- if File.exist?('VERSION.yml')
52
- config = YAML::load(File.read('VERSION.yml'))
53
- version = "#{config[:major]}.#{config[:minor]}.#{config[:patch]}"
54
- else
55
- version = ""
56
- end
57
-
58
- rdoc.rdoc_dir = 'rdoc'
59
- rdoc.title = "Craigler #{version}"
60
- rdoc.rdoc_files.include('lib/**/*.rb')
61
- rdoc.rdoc_files.include('README.rdoc', 'LICENSE')
62
- rdoc.main = 'README.rdoc'
63
- end
64
-
@@ -0,0 +1,25 @@
1
+ # -*- encoding: utf-8 -*-
2
+ lib = File.expand_path('../lib', __FILE__)
3
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
+ require 'craigler/version'
5
+
6
+ Gem::Specification.new do |gem|
7
+ gem.name = "craigler"
8
+ gem.version = Craigler::VERSION
9
+ gem.authors = ["Devin Christensen"]
10
+ gem.email = ["quixoten@gmail.com"]
11
+ gem.summary = %Q{Search API for craigslist}
12
+ gem.homepage = "http://github.com/illogician/craigler"
13
+
14
+ gem.files = `git ls-files`.split($/)
15
+ gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
16
+ gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
17
+ gem.require_paths = ["lib"]
18
+
19
+ gem.add_dependency "hpricot", "~> 0.8"
20
+ gem.add_development_dependency "rake", "~> 0.9.2"
21
+ gem.add_development_dependency "shoulda", "~> 3.3.1"
22
+ gem.add_development_dependency "minitest", "~> 4.1.0"
23
+ gem.add_development_dependency "yard", "~> 0.7"
24
+ end
25
+
@@ -5,28 +5,26 @@ require 'craigler/constants'
5
5
  require 'craigler/search'
6
6
 
7
7
  module Craigler
8
-
9
- # :stopdoc:
10
8
  class CraiglerError < StandardError; end
11
9
  class InvalidCategory < CraiglerError; end
12
10
  class InvalidSearchTerm < CraiglerError; end
13
11
  class InvalidLocation < CraiglerError; end
14
- # :startdoc:
15
-
12
+
16
13
  class << self
17
- # Interface to Search that may or may not be more readable
14
+ # Alternate interface to {Search#initialize}
18
15
  #
19
- # Supports all options of Search#new except <tt>:only</tt>, as it's supplied through the <tt>category</tt> parameter
16
+ # @param category [Symbol] the category to search
17
+ # @param options [Hash] options passed to {Search#initialize}.
20
18
  def search(category, options = {})
21
19
  options = options.merge({ :only => category })
22
20
  results = Search.new(options.delete(:for), options).results()
23
21
  results.each {|result| yield(result) } if block_given?
24
22
  results
25
23
  end
26
-
27
- # Interface to Search that somewhat mimics ActiveRecord#find
24
+
25
+ # Wrapper for {Search#initialize}
28
26
  #
29
- # Supports all the options of Search#new
27
+ # @param (see Search#initialize)
30
28
  def find(search_term, options = {})
31
29
  results = Search.new(search_term, options).results()
32
30
  results.each {|result| yield(result) } if block_given?
@@ -1,9 +1,9 @@
1
1
  module Craigler
2
-
3
- # :stopdoc:
4
2
  RESULTS_PER_PAGE = 25
5
-
3
+
4
+ # @private
6
5
  LOCATIONS = {
6
+ # States
7
7
  :alabama => ['http://auburn.craigslist.org/','http://bham.craigslist.org/','http://columbusga.craigslist.org/','http://dothan.craigslist.org/','http://shoals.craigslist.org/','http://gadsden.craigslist.org/','http://huntsville.craigslist.org/','http://mobile.craigslist.org/','http://montgomery.craigslist.org/','http://tuscaloosa.craigslist.org/'],
8
8
  :alaska => ['http://anchorage.craigslist.org/'],
9
9
  :arizona => ['http://flagstaff.craigslist.org/','http://mohave.craigslist.org/','http://phoenix.craigslist.org/','http://prescott.craigslist.org/','http://sierravista.craigslist.org/','http://tucson.craigslist.org/','http://yuma.craigslist.org/'],
@@ -66,9 +66,9 @@ module Craigler
66
66
  :mobile => ['http://mobile.craigslist.org/'],
67
67
  :montgomery => ['http://montgomery.craigslist.org/'],
68
68
  :tuscaloosa => ['http://tuscaloosa.craigslist.org/'],
69
- # Alaska =
69
+ # Alaska
70
70
  :anchorage => ['http://anchorage.craigslist.org/'],
71
- # Arizona =
71
+ # Arizona
72
72
  :flagstaff => ['http://flagstaff.craigslist.org/'],
73
73
  :mohave => ['http://mohave.craigslist.org/'],
74
74
  :phoenix => ['http://phoenix.craigslist.org/'],
@@ -76,14 +76,14 @@ module Craigler
76
76
  :sierravista => ['http://sierravista.craigslist.org/'],
77
77
  :tucson => ['http://tucson.craigslist.org/'],
78
78
  :yuma => ['http://yuma.craigslist.org/'],
79
- # Arkansas =
79
+ # Arkansas
80
80
  :fayar => ['http://fayar.craigslist.org/'],
81
81
  :fortsmith => ['http://fortsmith.craigslist.org/'],
82
82
  :jonesboro => ['http://jonesboro.craigslist.org/'],
83
83
  :littlerock => ['http://littlerock.craigslist.org/'],
84
84
  :memphis => ['http://memphis.craigslist.org/'],
85
85
  :texarkana => ['http://texarkana.craigslist.org/'],
86
- # California =
86
+ # California
87
87
  :sfbay => ['http://sfbay.craigslist.org/'],
88
88
  :bakersfield => ['http://bakersfield.craigslist.org/'],
89
89
  :chico => ['http://chico.craigslist.org/'],
@@ -109,7 +109,7 @@ module Craigler
109
109
  :ventura => ['http://ventura.craigslist.org/'],
110
110
  :visalia => ['http://visalia.craigslist.org/'],
111
111
  :yubasutter => ['http://yubasutter.craigslist.org/'],
112
- # Colorado =
112
+ # Colorado
113
113
  :boulder => ['http://boulder.craigslist.org/'],
114
114
  :cosprings => ['http://cosprings.craigslist.org/'],
115
115
  :denver => ['http://denver.craigslist.org/'],
@@ -117,16 +117,16 @@ module Craigler
117
117
  :pueblo => ['http://pueblo.craigslist.org/'],
118
118
  :rockies => ['http://rockies.craigslist.org/'],
119
119
  :westslope => ['http://westslope.craigslist.org/'],
120
- # Connecticut =
120
+ # Connecticut
121
121
  :newlondon => ['http://newlondon.craigslist.org/'],
122
122
  :hartford => ['http://hartford.craigslist.org/'],
123
123
  :newhaven => ['http://newhaven.craigslist.org/'],
124
124
  :nwct => ['http://nwct.craigslist.org/'],
125
- # Delaware =
125
+ # Delaware
126
126
  :delaware => ['http://delaware.craigslist.org/'],
127
- # Dc =
127
+ # Dc
128
128
  :washingtondc => ['http://washingtondc.craigslist.org/'],
129
- # Florida =
129
+ # Florida
130
130
  :daytona => ['http://daytona.craigslist.org/'],
131
131
  :keys => ['http://keys.craigslist.org/'],
132
132
  :fortmyers => ['http://fortmyers.craigslist.org/'],
@@ -144,7 +144,7 @@ module Craigler
144
144
  :tallahassee => ['http://tallahassee.craigslist.org/'],
145
145
  :tampa => ['http://tampa.craigslist.org/'],
146
146
  :treasure => ['http://treasure.craigslist.org/'],
147
- # Georgia =
147
+ # Georgia
148
148
  :athensga => ['http://athensga.craigslist.org/'],
149
149
  :atlanta => ['http://atlanta.craigslist.org/'],
150
150
  :augusta => ['http://augusta.craigslist.org/'],
@@ -153,15 +153,15 @@ module Craigler
153
153
  :macon => ['http://macon.craigslist.org/'],
154
154
  :savannah => ['http://savannah.craigslist.org/'],
155
155
  :valdosta => ['http://valdosta.craigslist.org/'],
156
- # Hawaii =
156
+ # Hawaii
157
157
  :honolulu => ['http://honolulu.craigslist.org/'],
158
- # Idaho =
158
+ # Idaho
159
159
  :boise => ['http://boise.craigslist.org/'],
160
160
  :eastidaho => ['http://eastidaho.craigslist.org/'],
161
161
  :pullman => ['http://pullman.craigslist.org/'],
162
162
  :spokane => ['http://spokane.craigslist.org/'],
163
163
  :twinfalls => ['http://twinfalls.craigslist.org/'],
164
- # Illinois =
164
+ # Illinois
165
165
  :bn => ['http://bn.craigslist.org/'],
166
166
  :carbondale => ['http://carbondale.craigslist.org/'],
167
167
  :chambana => ['http://chambana.craigslist.org/'],
@@ -172,7 +172,7 @@ module Craigler
172
172
  :rockford => ['http://rockford.craigslist.org/'],
173
173
  :springfieldil => ['http://springfieldil.craigslist.org/'],
174
174
  :stlouis => ['http://stlouis.craigslist.org/'],
175
- # Indiana =
175
+ # Indiana
176
176
  :bloomington => ['http://bloomington.craigslist.org/'],
177
177
  :evansville => ['http://evansville.craigslist.org/'],
178
178
  :fortwayne => ['http://fortwayne.craigslist.org/'],
@@ -182,7 +182,7 @@ module Craigler
182
182
  :southbend => ['http://southbend.craigslist.org/'],
183
183
  :terrahaute => ['http://terrehaute.craigslist.org/'],
184
184
  :terrehaute => ['http://terrehaute.craigslist.org/'],
185
- # Iowa =
185
+ # Iowa
186
186
  :ames => ['http://ames.craigslist.org/'],
187
187
  :cedarrapids => ['http://cedarrapids.craigslist.org/'],
188
188
  :desmoines => ['http://desmoines.craigslist.org/'],
@@ -192,41 +192,41 @@ module Craigler
192
192
  :quadcities => ['http://quadcities.craigslist.org/'],
193
193
  :siouxcity => ['http://siouxcity.craigslist.org/'],
194
194
  :waterloo => ['http://waterloo.craigslist.org/'],
195
- # Kansas =
195
+ # Kansas
196
196
  :kansascity => ['http://kansascity.craigslist.org/'],
197
197
  :lawrence => ['http://lawrence.craigslist.org/'],
198
198
  :ksu => ['http://ksu.craigslist.org/'],
199
199
  :topeka => ['http://topeka.craigslist.org/'],
200
200
  :wichita => ['http://wichita.craigslist.org/'],
201
- # Kentucky =
201
+ # Kentucky
202
202
  :bgky => ['http://bgky.craigslist.org/'],
203
203
  :cincinnati => ['http://cincinnati.craigslist.org/'],
204
204
  :huntington => ['http://huntington.craigslist.org/'],
205
205
  :lexington => ['http://lexington.craigslist.org/'],
206
206
  :louisville => ['http://louisville.craigslist.org/'],
207
207
  :westky => ['http://westky.craigslist.org/'],
208
- # Louisiana =
208
+ # Louisiana
209
209
  :batonrouge => ['http://batonrouge.craigslist.org/'],
210
210
  :lafayette => ['http://lafayette.craigslist.org/'],
211
211
  :lakecharles => ['http://lakecharles.craigslist.org/'],
212
212
  :monroe => ['http://monroe.craigslist.org/'],
213
213
  :neworleans => ['http://neworleans.craigslist.org/'],
214
214
  :shreveport => ['http://shreveport.craigslist.org/'],
215
- # Maine =
215
+ # Maine
216
216
  :maine => ['http://maine.craigslist.org/'],
217
- # Maryland =
217
+ # Maryland
218
218
  :annapolis => ['http://annapolis.craigslist.org/'],
219
219
  :baltimore => ['http://baltimore.craigslist.org/'],
220
220
  :easternshore => ['http://easternshore.craigslist.org/'],
221
221
  :smd => ['http://smd.craigslist.org/'],
222
222
  :westmd => ['http://westmd.craigslist.org/'],
223
- # Mass =
223
+ # Mass
224
224
  :boston => ['http://boston.craigslist.org/'],
225
225
  :capecod => ['http://capecod.craigslist.org/'],
226
226
  :southcoast => ['http://southcoast.craigslist.org/'],
227
227
  :westernmass => ['http://westernmass.craigslist.org/'],
228
228
  :worcester => ['http://worcester.craigslist.org/'],
229
- # Michigan =
229
+ # Michigan
230
230
  :annarbor => ['http://annarbor.craigslist.org/'],
231
231
  :centralmich => ['http://centralmich.craigslist.org/'],
232
232
  :detroit => ['http://detroit.craigslist.org/'],
@@ -242,50 +242,50 @@ module Craigler
242
242
  :southbend => ['http://southbend.craigslist.org/'],
243
243
  :swmi => ['http://swmi.craigslist.org/'],
244
244
  :up => ['http://up.craigslist.org/'],
245
- # Minnesota =
245
+ # Minnesota
246
246
  :duluth => ['http://duluth.craigslist.org/'],
247
247
  :fargo => ['http://fargo.craigslist.org/'],
248
248
  :mankato => ['http://mankato.craigslist.org/'],
249
249
  :minneapolis => ['http://minneapolis.craigslist.org/'],
250
250
  :rmn => ['http://rmn.craigslist.org/'],
251
251
  :stcloud => ['http://stcloud.craigslist.org/'],
252
- # Mississippi =
252
+ # Mississippi
253
253
  :gulfport => ['http://gulfport.craigslist.org/'],
254
254
  :hattiesburg => ['http://hattiesburg.craigslist.org/'],
255
255
  :jackson => ['http://jackson.craigslist.org/'],
256
256
  :memphis => ['http://memphis.craigslist.org/'],
257
257
  :northmiss => ['http://northmiss.craigslist.org/'],
258
- # Missouri =
258
+ # Missouri
259
259
  :columbiamo => ['http://columbiamo.craigslist.org/'],
260
260
  :joplin => ['http://joplin.craigslist.org/'],
261
261
  :kansascity => ['http://kansascity.craigslist.org/'],
262
262
  :semo => ['http://semo.craigslist.org/'],
263
263
  :springfield => ['http://springfield.craigslist.org/'],
264
264
  :stlouis => ['http://stlouis.craigslist.org/'],
265
- # Montana =
265
+ # Montana
266
266
  :montana => ['http://montana.craigslist.org/'],
267
- # Nebraska =
267
+ # Nebraska
268
268
  :grandisland => ['http://grandisland.craigslist.org/'],
269
269
  :lincoln => ['http://lincoln.craigslist.org/'],
270
270
  :omaha => ['http://omaha.craigslist.org/'],
271
271
  :siouxcity => ['http://siouxcity.craigslist.org/'],
272
- # Nevada =
272
+ # Nevada
273
273
  :lasvegas => ['http://lasvegas.craigslist.org/'],
274
274
  :reno => ['http://reno.craigslist.org/'],
275
- # N hampshire =
275
+ # N hampshire
276
276
  :nh => ['http://nh.craigslist.org/'],
277
- # New jersey =
277
+ # New jersey
278
278
  :cnj => ['http://cnj.craigslist.org/'],
279
279
  :jerseyshore => ['http://jerseyshore.craigslist.org/'],
280
280
  :newjersey => ['http://newjersey.craigslist.org/'],
281
281
  :southjersey => ['http://southjersey.craigslist.org/'],
282
- # New mexico =
282
+ # New mexico
283
283
  :albuquerque => ['http://albuquerque.craigslist.org/'],
284
284
  :farmington => ['http://farmington.craigslist.org/'],
285
285
  :lascruces => ['http://lascruces.craigslist.org/'],
286
286
  :roswell => ['http://roswell.craigslist.org/'],
287
287
  :santafe => ['http://santafe.craigslist.org/'],
288
- # New york =
288
+ # New york
289
289
  :albany => ['http://albany.craigslist.org/'],
290
290
  :binghamton => ['http://binghamton.craigslist.org/'],
291
291
  :buffalo => ['http://buffalo.craigslist.org/'],
@@ -301,7 +301,7 @@ module Craigler
301
301
  :syracuse => ['http://syracuse.craigslist.org/'],
302
302
  :utica => ['http://utica.craigslist.org/'],
303
303
  :watertown => ['http://watertown.craigslist.org/'],
304
- # N carolina =
304
+ # N carolina
305
305
  :asheville => ['http://asheville.craigslist.org/'],
306
306
  :boone => ['http://boone.craigslist.org/'],
307
307
  :charlotte => ['http://charlotte.craigslist.org/'],
@@ -313,10 +313,10 @@ module Craigler
313
313
  :raleigh => ['http://raleigh.craigslist.org/'],
314
314
  :wilmington => ['http://wilmington.craigslist.org/'],
315
315
  :winstonsalem => ['http://winstonsalem.craigslist.org/'],
316
- # North dakota =
316
+ # North dakota
317
317
  :fargo => ['http://fargo.craigslist.org/'],
318
318
  :nd => ['http://nd.craigslist.org/'],
319
- # Ohio =
319
+ # Ohio
320
320
  :akroncanton => ['http://akroncanton.craigslist.org/'],
321
321
  :athensohio => ['http://athensohio.craigslist.org/'],
322
322
  :cincinnati => ['http://cincinnati.craigslist.org/'],
@@ -331,13 +331,13 @@ module Craigler
331
331
  :toledo => ['http://toledo.craigslist.org/'],
332
332
  :wheeling => ['http://wheeling.craigslist.org/'],
333
333
  :youngstown => ['http://youngstown.craigslist.org/'],
334
- # Oklahoma =
334
+ # Oklahoma
335
335
  :fortsmith => ['http://fortsmith.craigslist.org/'],
336
336
  :lawton => ['http://lawton.craigslist.org/'],
337
337
  :oklahomacity => ['http://oklahomacity.craigslist.org/'],
338
338
  :stillwater => ['http://stillwater.craigslist.org/'],
339
339
  :tulsa => ['http://tulsa.craigslist.org/'],
340
- # Oregon =
340
+ # Oregon
341
341
  :bend => ['http://bend.craigslist.org/'],
342
342
  :corvallis => ['http://corvallis.craigslist.org/'],
343
343
  :eastoregon => ['http://eastoregon.craigslist.org/'],
@@ -347,7 +347,7 @@ module Craigler
347
347
  :portland => ['http://portland.craigslist.org/'],
348
348
  :roseburg => ['http://roseburg.craigslist.org/'],
349
349
  :salem => ['http://salem.craigslist.org/'],
350
- # Pennsylvania =
350
+ # Pennsylvania
351
351
  :altoona => ['http://altoona.craigslist.org/'],
352
352
  :erie => ['http://erie.craigslist.org/'],
353
353
  :harrisburg => ['http://harrisburg.craigslist.org/'],
@@ -361,18 +361,18 @@ module Craigler
361
361
  :pennstate => ['http://pennstate.craigslist.org/'],
362
362
  :williamsport => ['http://williamsport.craigslist.org/'],
363
363
  :york => ['http://york.craigslist.org/'],
364
- # Rhode island =
364
+ # Rhode island
365
365
  :providence => ['http://providence.craigslist.org/'],
366
- # S carolina =
366
+ # S carolina
367
367
  :charleston => ['http://charleston.craigslist.org/'],
368
368
  :columbia => ['http://columbia.craigslist.org/'],
369
369
  :florencesc => ['http://florencesc.craigslist.org/'],
370
370
  :greenville => ['http://greenville.craigslist.org/'],
371
371
  :hiltonhead => ['http://hiltonhead.craigslist.org/'],
372
372
  :myrtlebeach => ['http://myrtlebeach.craigslist.org/'],
373
- # South dakota =
373
+ # South dakota
374
374
  :sd => ['http://sd.craigslist.org/'],
375
- # Tennessee =
375
+ # Tennessee
376
376
  :chattanooga => ['http://chattanooga.craigslist.org/'],
377
377
  :clarksville => ['http://clarksville.craigslist.org/'],
378
378
  :jacksontn => ['http://jacksontn.craigslist.org/'],
@@ -380,7 +380,7 @@ module Craigler
380
380
  :memphis => ['http://memphis.craigslist.org/'],
381
381
  :nashville => ['http://nashville.craigslist.org/'],
382
382
  :tricities => ['http://tricities.craigslist.org/'],
383
- # Texas =
383
+ # Texas
384
384
  :abilene => ['http://abilene.craigslist.org/'],
385
385
  :amarillo => ['http://amarillo.craigslist.org/'],
386
386
  :austin => ['http://austin.craigslist.org/'],
@@ -404,15 +404,15 @@ module Craigler
404
404
  :victoriatx => ['http://victoriatx.craigslist.org/'],
405
405
  :waco => ['http://waco.craigslist.org/'],
406
406
  :wichitafalls => ['http://wichitafalls.craigslist.org/'],
407
- # Utah =
407
+ # Utah
408
408
  :logan => ['http://logan.craigslist.org/'],
409
409
  :ogden => ['http://ogden.craigslist.org/'],
410
410
  :provo => ['http://provo.craigslist.org/'],
411
411
  :saltlakecity => ['http://saltlakecity.craigslist.org/'],
412
412
  :stgeorge => ['http://stgeorge.craigslist.org/'],
413
- # Vermont =
413
+ # Vermont
414
414
  :burlington => ['http://burlington.craigslist.org/'],
415
- # Virginia =
415
+ # Virginia
416
416
  :blacksburg => ['http://blacksburg.craigslist.org/'],
417
417
  :charlottesville => ['http://charlottesville.craigslist.org/'],
418
418
  :danville => ['http://danville.craigslist.org/'],
@@ -423,7 +423,7 @@ module Craigler
423
423
  :lynchburg => ['http://lynchburg.craigslist.org/'],
424
424
  :richmond => ['http://richmond.craigslist.org/'],
425
425
  :roanoke => ['http://roanoke.craigslist.org/'],
426
- # Washington =
426
+ # Washington
427
427
  :bellingham => ['http://bellingham.craigslist.org/'],
428
428
  :kpr => ['http://kpr.craigslist.org/'],
429
429
  :olympic => ['http://olympic.craigslist.org/'],
@@ -433,7 +433,7 @@ module Craigler
433
433
  :spokane => ['http://spokane.craigslist.org/'],
434
434
  :wenatchee => ['http://wenatchee.craigslist.org/'],
435
435
  :yakima => ['http://yakima.craigslist.org/'],
436
- # West virginia =
436
+ # West virginia
437
437
  :charlestonwv => ['http://charlestonwv.craigslist.org/'],
438
438
  :huntington => ['http://huntington.craigslist.org/'],
439
439
  :martinsburg => ['http://martinsburg.craigslist.org/'],
@@ -441,7 +441,7 @@ module Craigler
441
441
  :parkersburg => ['http://parkersburg.craigslist.org/'],
442
442
  :wv => ['http://wv.craigslist.org/'],
443
443
  :wheeling => ['http://wheeling.craigslist.org/'],
444
- # Wisconsin =
444
+ # Wisconsin
445
445
  :appleton => ['http://appleton.craigslist.org/'],
446
446
  :duluth => ['http://duluth.craigslist.org/'],
447
447
  :eauclaire => ['http://eauclaire.craigslist.org/'],
@@ -455,6 +455,7 @@ module Craigler
455
455
  :wausau => ['http://wausau.craigslist.org/']
456
456
  }
457
457
 
458
+ # @private
458
459
  CATEGORIES = {
459
460
  :community => 'ccc',
460
461
  :event => 'eee',
@@ -497,6 +498,4 @@ module Craigler
497
498
  :resume => 'res',
498
499
  :services_offered => 'bbb'
499
500
  }
500
-
501
- # :startdoc:
502
501
  end
@@ -8,17 +8,11 @@ module Craigler
8
8
 
9
9
  # Creates a wrapper object for a craigslist search
10
10
  #
11
- # === Options
12
- # [:in]
13
- # Specifies the location(s) to search in. Defaults to <tt>:anywhere</tt>.
14
- # [:only]
15
- # Specifies the category or categories to search in. Defaults to <tt>:all_for_sale_or_wanted</tt>
16
- # [:page_limit]
17
- # Maximum number of pages to fetch results from. Defaults to <tt>4</tt>.
18
- # <b>Note:</b> A location may, and often does, have more than one searchable
19
- # url assciated with it, e.g., {California}[http://geo.craigslist.org/iso/us/ca]. Because
20
- # <tt>:page_limit</tt> is applied seperately to each url within the location, searching <tt>:in => :california</tt>
21
- # with a <tt>:page_limit => 4</tt> could potentially make up to 100 page requests.
11
+ # @param [String] search_term
12
+ # @option options [Symbol, Array] :in (:anywhere) location(s) to search
13
+ # @option options [Symbol, Array] :only (:all_for_sale_or_wanted) category or categories to search
14
+ # @option options [Fixnum] :page_limit (4) maximum number of pages to read per url
15
+ # @note A location often has more than one url associated with it. For example, [`:california`](http://geo.craigslist.org/iso/us/ca) has 29 associated urls as of this writing. In this case, up to 116 pages could potentially be searched (`:page_limit * num_urls = 4 * 29 = 116`).
22
16
  def initialize(search_term, options = {})
23
17
  raise InvalidSearchTerm if search_term.nil? || search_term == ''
24
18
 
@@ -37,9 +31,7 @@ module Craigler
37
31
  # Returns the results of the search. If this is the first time
38
32
  # calling #results then they will be fetched over the internet and cached in the search object.
39
33
  #
40
- # === Options
41
- # [:refresh]
42
- # Set to <tt>true</tt> to force an update across the internet.
34
+ # @option options [Boolean] :refresh (false) force the results to be updated before they are returned
43
35
  def results(options = {})
44
36
  options = { :refresh => false }.merge(options)
45
37
  return @results unless @results.nil? || options[:refresh]
@@ -59,20 +51,20 @@ module Craigler
59
51
  end
60
52
 
61
53
  protected
62
- def _validate_locations # :nodoc:
54
+ def _validate_locations
63
55
  @locations.each() do |location|
64
56
  raise InvalidLocation.new(":anywhere not expected as part of an array") if location == :anywhere
65
57
  raise InvalidLocation.new(":#{location} is not a valid location") unless LOCATIONS.key?(location)
66
58
  end
67
59
  end
68
60
 
69
- def _validate_categories # :nodoc:
61
+ def _validate_categories
70
62
  @categories.each() do |category|
71
63
  raise InvalidCategory unless CATEGORIES.key?(category)
72
64
  end
73
65
  end
74
66
 
75
- def _for_each_locations_search_url # :nodoc:
67
+ def _for_each_locations_search_url
76
68
  @locations.each do |location|
77
69
  LOCATIONS[location].each do |url|
78
70
  @categories.each do |category|
@@ -82,7 +74,7 @@ module Craigler
82
74
  end
83
75
  end
84
76
 
85
- def _extract_items_from_url(location, url) # :nodoc:
77
+ def _extract_items_from_url(location, url)
86
78
  (Hpricot(open(url))/'item').collect { |item| {
87
79
  :url => item['rdf:about'],
88
80
  :title => (item%'title').inner_text,
@@ -91,4 +83,4 @@ module Craigler
91
83
  }}
92
84
  end
93
85
  end
94
- end
86
+ end
@@ -0,0 +1,3 @@
1
+ module Craigler
2
+ VERSION = "1.3.3"
3
+ end
@@ -1,12 +1,7 @@
1
- require 'rubygems'
1
+ require 'craigler'
2
2
  require 'test/unit'
3
3
  require 'shoulda'
4
4
 
5
- $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
6
- $LOAD_PATH.unshift(File.dirname(__FILE__))
7
-
8
- require 'craigler'
9
-
10
5
  module Craigler
11
6
  class Search
12
7
  def open(*args)
metadata CHANGED
@@ -1,123 +1,144 @@
1
- --- !ruby/object:Gem::Specification
1
+ --- !ruby/object:Gem::Specification
2
2
  name: craigler
3
- version: !ruby/object:Gem::Version
4
- hash: 31
3
+ version: !ruby/object:Gem::Version
4
+ version: 1.3.3
5
5
  prerelease:
6
- segments:
7
- - 1
8
- - 3
9
- - 2
10
- version: 1.3.2
11
6
  platform: ruby
12
- authors:
7
+ authors:
13
8
  - Devin Christensen
14
9
  autorequire:
15
10
  bindir: bin
16
11
  cert_chain: []
17
-
18
- date: 2012-02-17 00:00:00 Z
19
- dependencies:
20
- - !ruby/object:Gem::Dependency
12
+ date: 2012-10-16 00:00:00.000000000 Z
13
+ dependencies:
14
+ - !ruby/object:Gem::Dependency
21
15
  name: hpricot
22
- prerelease: false
23
- requirement: &id001 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
24
17
  none: false
25
- requirements:
18
+ requirements:
26
19
  - - ~>
27
- - !ruby/object:Gem::Version
28
- hash: 55
29
- segments:
30
- - 0
31
- - 8
32
- - 4
33
- version: 0.8.4
20
+ - !ruby/object:Gem::Version
21
+ version: '0.8'
34
22
  type: :runtime
35
- version_requirements: *id001
36
- - !ruby/object:Gem::Dependency
23
+ prerelease: false
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '0.8'
30
+ - !ruby/object:Gem::Dependency
31
+ name: rake
32
+ requirement: !ruby/object:Gem::Requirement
33
+ none: false
34
+ requirements:
35
+ - - ~>
36
+ - !ruby/object:Gem::Version
37
+ version: 0.9.2
38
+ type: :development
39
+ prerelease: false
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.9.2
46
+ - !ruby/object:Gem::Dependency
37
47
  name: shoulda
48
+ requirement: !ruby/object:Gem::Requirement
49
+ none: false
50
+ requirements:
51
+ - - ~>
52
+ - !ruby/object:Gem::Version
53
+ version: 3.3.1
54
+ type: :development
38
55
  prerelease: false
39
- requirement: &id002 !ruby/object:Gem::Requirement
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ none: false
58
+ requirements:
59
+ - - ~>
60
+ - !ruby/object:Gem::Version
61
+ version: 3.3.1
62
+ - !ruby/object:Gem::Dependency
63
+ name: minitest
64
+ requirement: !ruby/object:Gem::Requirement
40
65
  none: false
41
- requirements:
42
- - - ">="
43
- - !ruby/object:Gem::Version
44
- hash: 33
45
- segments:
46
- - 2
47
- - 10
48
- - 3
49
- version: 2.10.3
66
+ requirements:
67
+ - - ~>
68
+ - !ruby/object:Gem::Version
69
+ version: 4.1.0
50
70
  type: :development
51
- version_requirements: *id002
52
- - !ruby/object:Gem::Dependency
53
- name: rdoc
54
71
  prerelease: false
55
- requirement: &id003 !ruby/object:Gem::Requirement
72
+ version_requirements: !ruby/object:Gem::Requirement
73
+ none: false
74
+ requirements:
75
+ - - ~>
76
+ - !ruby/object:Gem::Version
77
+ version: 4.1.0
78
+ - !ruby/object:Gem::Dependency
79
+ name: yard
80
+ requirement: !ruby/object:Gem::Requirement
56
81
  none: false
57
- requirements:
82
+ requirements:
58
83
  - - ~>
59
- - !ruby/object:Gem::Version
60
- hash: 43
61
- segments:
62
- - 3
63
- - 11
64
- - 0
65
- version: 3.11.0
84
+ - !ruby/object:Gem::Version
85
+ version: '0.7'
66
86
  type: :development
67
- version_requirements: *id003
87
+ prerelease: false
88
+ version_requirements: !ruby/object:Gem::Requirement
89
+ none: false
90
+ requirements:
91
+ - - ~>
92
+ - !ruby/object:Gem::Version
93
+ version: '0.7'
68
94
  description:
69
- email: quixoten@gmail.com
95
+ email:
96
+ - quixoten@gmail.com
70
97
  executables: []
71
-
72
98
  extensions: []
73
-
74
- extra_rdoc_files:
75
- - LICENSE
76
- - README.rdoc
77
- files:
99
+ extra_rdoc_files: []
100
+ files:
78
101
  - .document
79
- - LICENSE
80
- - README.rdoc
102
+ - .gitignore
103
+ - .yardopts
104
+ - Gemfile
105
+ - LICENSE.txt
106
+ - README.md
81
107
  - Rakefile
82
- - VERSION.yml
108
+ - craigler.gemspec
83
109
  - lib/craigler.rb
84
110
  - lib/craigler/constants.rb
85
111
  - lib/craigler/search.rb
112
+ - lib/craigler/version.rb
86
113
  - test/craigler_search_test.rb
87
114
  - test/craigler_test.rb
88
115
  - test/test_helper.rb
89
- homepage: http://github.com/threetrieslater/craigler
116
+ homepage: http://github.com/illogician/craigler
90
117
  licenses: []
91
-
92
118
  post_install_message:
93
119
  rdoc_options: []
94
-
95
- require_paths:
120
+ require_paths:
96
121
  - lib
97
- required_ruby_version: !ruby/object:Gem::Requirement
122
+ required_ruby_version: !ruby/object:Gem::Requirement
98
123
  none: false
99
- requirements:
100
- - - ">="
101
- - !ruby/object:Gem::Version
102
- hash: 3
103
- segments:
104
- - 0
105
- version: "0"
106
- required_rubygems_version: !ruby/object:Gem::Requirement
124
+ requirements:
125
+ - - ! '>='
126
+ - !ruby/object:Gem::Version
127
+ version: '0'
128
+ required_rubygems_version: !ruby/object:Gem::Requirement
107
129
  none: false
108
- requirements:
109
- - - ">="
110
- - !ruby/object:Gem::Version
111
- hash: 3
112
- segments:
113
- - 0
114
- version: "0"
130
+ requirements:
131
+ - - ! '>='
132
+ - !ruby/object:Gem::Version
133
+ version: '0'
115
134
  requirements: []
116
-
117
135
  rubyforge_project:
118
- rubygems_version: 1.8.15
136
+ rubygems_version: 1.8.24
119
137
  signing_key:
120
138
  specification_version: 3
121
139
  summary: Search API for craigslist
122
- test_files: []
123
-
140
+ test_files:
141
+ - test/craigler_search_test.rb
142
+ - test/craigler_test.rb
143
+ - test/test_helper.rb
144
+ has_rdoc:
@@ -1,165 +0,0 @@
1
- = Craigler
2
-
3
- Search API for craigslist
4
-
5
- == SYNOPSIS:
6
- I couldn't decide which API I liked best, so you have two choices.
7
-
8
- Craigler.search(:motorcycles, :in => [:utah, :nevada, :arizona], :for => 'Boulevard M50') do |item|
9
- puts item.title
10
- puts item.url
11
- puts item.time
12
- end
13
-
14
- or
15
-
16
- Craigler.find('Boulevard M50', :in => :california, :only => :motorcycles) do |item|
17
- puts item.title
18
- puts item.url
19
- puts item.time
20
- end
21
-
22
- You can also create a search object to fetch the results later. When no location or category is given Craigler searches <tt>:all_for_sale_or_wanted</tt> <tt>:in => :anywhere</tt>
23
-
24
- search = Craigler::Search.new('Yamaha')
25
- search.results()
26
-
27
- Note that additional calls to <tt>search.results()</tt> will always return the same result set unless refresh is forced
28
- search.results(:refresh => true)
29
-
30
- See Craigler::Search for a list of all available options
31
-
32
- === Supported Categories
33
- <tt>:all_for_sale_or_wanted</tt>, <tt>:art_and_crafts</tt>, <tt>:auto_parts</tt>, <tt>:baby_and_kid_stuff</tt>, <tt>:barter</tt>, <tt>:bicycles</tt>, <tt>:boats</tt>, <tt>:books</tt>, <tt>:business</tt>, <tt>:cars_and_trucks</tt>, <tt>:clothing</tt>, <tt>:collectibles</tt>, <tt>:community</tt>, <tt>:computers_and_tech</tt>, <tt>:electronics</tt>, <tt>:event</tt>, <tt>:farm_and_garden</tt>, <tt>:free_stuff</tt>, <tt>:furniture</tt>, <tt>:games_and_toys</tt>, <tt>:garage_sales</tt>, <tt>:general</tt>, <tt>:gigs</tt>, <tt>:household</tt>, <tt>:housing</tt>, <tt>:items_wanted</tt>, <tt>:jewelry</tt>, <tt>:jobs</tt>, <tt>:materials</tt>, <tt>:media</tt>, <tt>:motorcycles</tt>, <tt>:musical_instruments</tt>, <tt>:personals</tt>, <tt>:photo_and_video</tt>, <tt>:recreational_vehicles</tt>, <tt>:resume</tt>, <tt>:services_offered</tt>, <tt>:sporting_goods</tt>, <tt>:tickets</tt>, <tt>:tools</tt>
34
-
35
- === Supported Locations
36
- ==== States
37
- <tt>:alaska</tt>, <tt>:arizona</tt>, <tt>:arkansas</tt>, <tt>:california</tt>, <tt>:colorado</tt>, <tt>:connecticut</tt>, <tt>:delaware</tt>, <tt>:dc</tt>, <tt>:florida</tt>, <tt>:georgia</tt>, <tt>:hawaii</tt>, <tt>:idaho</tt>, <tt>:illinois</tt>, <tt>:indiana</tt>, <tt>:iowa</tt>, <tt>:kansas</tt>, <tt>:kentucky</tt>, <tt>:louisiana</tt>, <tt>:maine</tt>, <tt>:maryland</tt>, <tt>:mass</tt>, <tt>:michigan</tt>, <tt>:minnesota</tt>, <tt>:mississippi</tt>, <tt>:missouri</tt>, <tt>:montana</tt>, <tt>:nebraska</tt>, <tt>:nevada</tt>, <tt>:n_hampshire</tt>, <tt>:new_jersey</tt>, <tt>:new_mexico</tt>, <tt>:new_york</tt>, <tt>:n_carolina</tt>, <tt>:north_dakota</tt>, <tt>:ohio</tt>, <tt>:oklahoma</tt>, <tt>:oregon</tt>, <tt>:pennsylvania</tt>, <tt>:rhode_island</tt>, <tt>:s_carolina</tt>, <tt>:south_dakota</tt>, <tt>:tennessee</tt>, <tt>:texas</tt>, <tt>:utah</tt>, <tt>:vermont</tt>, <tt>:virginia</tt>, <tt>:washington</tt>, <tt>:west_virginia</tt> <tt>:wisconsin</tt>, <tt>:wyoming</tt>
38
- ==== Cities
39
- ===== Alabama
40
- <tt>:auburn</tt>,<tt>:bham</tt>,<tt>:columbusga</tt>,<tt>:dothan</tt>,<tt>:shoals</tt>,<tt>:gadsden</tt>,<tt>:huntsville</tt>,<tt>:mobile</tt>,<tt>:montgomery</tt>,<tt>:tuscaloosa</tt>,
41
- ===== Alaska
42
- <tt>:anchorage</tt>,
43
- ===== Arizona
44
- <tt>:flagstaff</tt>,<tt>:mohave</tt>,<tt>:phoenix</tt>,<tt>:prescott</tt>,<tt>:sierravista</tt>,<tt>:tucson</tt>,<tt>:yuma</tt>,
45
- ===== Arkansas
46
- <tt>:fayar</tt>,<tt>:fortsmith</tt>,<tt>:jonesboro</tt>,<tt>:littlerock</tt>,<tt>:memphis</tt>,<tt>:texarkana</tt>,
47
- ===== California
48
- <tt>:sfbay</tt>,<tt>:bakersfield</tt>,<tt>:chico</tt>,<tt>:fresno</tt>,<tt>:goldcountry</tt>,<tt>:humboldt</tt>,<tt>:imperial</tt>,<tt>:inlandempire</tt>,
49
- <tt>:losangeles</tt>,<tt>:mendocino</tt>,<tt>:merced</tt>,<tt>:modesto</tt>,<tt>:monterey</tt>,<tt>:orangecounty</tt>,<tt>:palmsprings</tt>,<tt>:redding</tt>,
50
- <tt>:reno</tt>,<tt>:sacramento</tt>,<tt>:sandiego</tt>,<tt>:slo</tt>,<tt>:santabarbara</tt>,<tt>:stockton</tt>,<tt>:ventura</tt>,<tt>:visalia</tt>,<tt>:yubasutter</tt>,
51
- ===== Colorado
52
- <tt>:boulder</tt>,<tt>:cosprings</tt>,<tt>:denver</tt>,<tt>:fortcollins</tt>,<tt>:pueblo</tt>,<tt>:rockies</tt>,<tt>:westslope</tt>,
53
- ===== Connecticut
54
- <tt>:newlondon</tt>,<tt>:hartford</tt>,<tt>:newhaven</tt>,<tt>:nwct</tt>,
55
- ===== Delaware
56
- <tt>:delaware</tt>,
57
- ===== Dc
58
- <tt>:washingtondc</tt>,
59
- ===== Florida
60
- <tt>:daytona</tt>,<tt>:keys</tt>,<tt>:fortmyers</tt>,<tt>:gainesville</tt>,<tt>:jacksonville</tt>,<tt>:lakeland</tt>,<tt>:ocala</tt>,<tt>:orlando</tt>,
61
- <tt>:panamacity</tt>,<tt>:pensacola</tt>,<tt>:sarasota</tt>,<tt>:miami</tt>,<tt>:spacecoast</tt>,<tt>:staugustine</tt>,<tt>:tallahassee</tt>,<tt>:tampa</tt>,<tt>:treasure</tt>,
62
- ===== Georgia
63
- <tt>:athensga</tt>,<tt>:atlanta</tt>,<tt>:augusta</tt>,<tt>:brunswick</tt>,<tt>:columbusga</tt>,<tt>:macon</tt>,<tt>:savannah</tt>,<tt>:valdosta</tt>,
64
- ===== Hawaii
65
- <tt>:honolulu</tt>,
66
- ===== Idaho
67
- <tt>:boise</tt>,<tt>:eastidaho</tt>,<tt>:pullman</tt>,<tt>:spokane</tt>,<tt>:twinfalls</tt>,
68
- ===== Illinois
69
- <tt>:bn</tt>,<tt>:carbondale</tt>,<tt>:chambana</tt>,<tt>:chicago</tt>,<tt>:decatur</tt>,<tt>:peoria</tt>,<tt>:quadcities</tt>,<tt>:rockford</tt>,<tt>:springfieldil</tt>,<tt>:stlouis</tt>,
70
- ===== Indiana
71
- <tt>:bloomington</tt>,<tt>:evansville</tt>,<tt>:fortwayne</tt>,<tt>:indianapolis</tt>,<tt>:tippecanoe</tt>,<tt>:muncie</tt>,<tt>:southbend</tt>,<tt>:terrehaute</tt>,
72
- ===== Iowa
73
- <tt>:ames</tt>,<tt>:cedarrapids</tt>,<tt>:desmoines</tt>,<tt>:dubuque</tt>,<tt>:iowacity</tt>,<tt>:omaha</tt>,<tt>:quadcities</tt>,<tt>:siouxcity</tt>,<tt>:waterloo</tt>,
74
- ===== Kansas
75
- <tt>:kansascity</tt>,<tt>:lawrence</tt>,<tt>:ksu</tt>,<tt>:topeka</tt>,<tt>:wichita</tt>,
76
- ===== Kentucky
77
- <tt>:bgky</tt>,<tt>:cincinnati</tt>,<tt>:huntington</tt>,<tt>:lexington</tt>,<tt>:louisville</tt>,<tt>:westky</tt>,
78
- ===== Louisiana
79
- <tt>:batonrouge</tt>,<tt>:lafayette</tt>,<tt>:lakecharles</tt>,<tt>:monroe</tt>,<tt>:neworleans</tt>,<tt>:shreveport</tt>,
80
- ===== Maine
81
- <tt>:maine</tt>,
82
- ===== Maryland
83
- <tt>:annapolis</tt>,<tt>:baltimore</tt>,<tt>:easternshore</tt>,<tt>:smd</tt>,<tt>:westmd</tt>,
84
- ===== Mass
85
- <tt>:boston</tt>,<tt>:capecod</tt>,<tt>:southcoast</tt>,<tt>:westernmass</tt>,<tt>:worcester</tt>,
86
- ===== Michigan
87
- <tt>:annarbor</tt>,<tt>:centralmich</tt>,<tt>:detroit</tt>,<tt>:flint</tt>,<tt>:grandrapids</tt>,<tt>:jxn</tt>,<tt>:kalamazoo</tt>,<tt>:lansing</tt>,
88
- <tt>:muskegon</tt>,<tt>:nmi</tt>,<tt>:porthuron</tt>,<tt>:saginaw</tt>,<tt>:southbend</tt>,<tt>:swmi</tt>,<tt>:up</tt>,
89
- ===== Minnesota
90
- <tt>:duluth</tt>,<tt>:fargo</tt>,<tt>:mankato</tt>,<tt>:minneapolis</tt>,<tt>:rmn</tt>,<tt>:stcloud</tt>,
91
- ===== Mississippi
92
- <tt>:gulfport</tt>,<tt>:hattiesburg</tt>,<tt>:jackson</tt>,<tt>:memphis</tt>,<tt>:northmiss</tt>,
93
- ===== Missouri
94
- <tt>:columbiamo</tt>,<tt>:joplin</tt>,<tt>:kansascity</tt>,<tt>:semo</tt>,<tt>:springfield</tt>,<tt>:stlouis</tt>,
95
- ===== Montana
96
- <tt>:montana</tt>,
97
- ===== Nebraska
98
- <tt>:grandisland</tt>,<tt>:lincoln</tt>,<tt>:omaha</tt>,<tt>:siouxcity</tt>,
99
- ===== Nevada
100
- <tt>:lasvegas</tt>,<tt>:reno</tt>,
101
- ===== N hampshire
102
- <tt>:nh</tt>,
103
- ===== New jersey
104
- <tt>:cnj</tt>,<tt>:jerseyshore</tt>,<tt>:newjersey</tt>,<tt>:southjersey</tt>,
105
- ===== New mexico
106
- <tt>:albuquerque</tt>,<tt>:farmington</tt>,<tt>:lascruces</tt>,<tt>:roswell</tt>,<tt>:santafe</tt>,
107
- ===== New york
108
- <tt>:albany</tt>,<tt>:binghamton</tt>,<tt>:buffalo</tt>,<tt>:catskills</tt>,<tt>:chautauqua</tt>,<tt>:elmira</tt>,<tt>:hudsonvalley</tt>,<tt>:ithaca</tt>,
109
- <tt>:longisland</tt>,<tt>:newyork</tt>,<tt>:plattsburgh</tt>,<tt>:rochester</tt>,<tt>:syracuse</tt>,<tt>:utica</tt>,<tt>:watertown</tt>,
110
- ===== N carolina
111
- <tt>:asheville</tt>,<tt>:boone</tt>,<tt>:charlotte</tt>,<tt>:eastnc</tt>,<tt>:fayetteville</tt>,<tt>:greensboro</tt>,<tt>:hickory</tt>,<tt>:outerbanks</tt>,
112
- <tt>:raleigh</tt>,<tt>:wilmington</tt>,<tt>:winstonsalem</tt>,
113
- ===== North dakota
114
- <tt>:fargo</tt>,<tt>:nd</tt>,
115
- ===== Ohio
116
- <tt>:akroncanton</tt>,<tt>:athensohio</tt>,<tt>:cincinnati</tt>,<tt>:cleveland</tt>,<tt>:columbus</tt>,<tt>:dayton</tt>,<tt>:huntington</tt>,<tt>:limaohio</tt>,
117
- <tt>:mansfield</tt>,<tt>:parkersburg</tt>,<tt>:sandusky</tt>,<tt>:toledo</tt>,<tt>:wheeling</tt>,<tt>:youngstown</tt>,
118
- ===== Oklahoma
119
- <tt>:fortsmith</tt>,<tt>:lawton</tt>,<tt>:oklahomacity</tt>,<tt>:stillwater</tt>,<tt>:tulsa</tt>,
120
- ===== Oregon
121
- <tt>:bend</tt>,<tt>:corvallis</tt>,<tt>:eastoregon</tt>,<tt>:eugene</tt>,<tt>:medford</tt>,<tt>:oregoncoast</tt>,<tt>:portland</tt>,<tt>:roseburg</tt>,<tt>:salem</tt>,
122
- ===== Pennsylvania
123
- <tt>:altoona</tt>,<tt>:erie</tt>,<tt>:harrisburg</tt>,<tt>:lancaster</tt>,<tt>:allentown</tt>,<tt>:philadelphia</tt>,<tt>:pittsburgh</tt>,<tt>:poconos</tt>,
124
- <tt>:reading</tt>,<tt>:scranton</tt>,<tt>:pennstate</tt>,<tt>:williamsport</tt>,<tt>:york</tt>,
125
- ===== Rhode island
126
- <tt>:providence</tt>,
127
- ===== S carolina
128
- <tt>:charleston</tt>,<tt>:columbia</tt>,<tt>:florencesc</tt>,<tt>:greenville</tt>,<tt>:hiltonhead</tt>,<tt>:myrtlebeach</tt>,
129
- ===== South dakota
130
- <tt>:sd</tt>,
131
- ===== Tennessee
132
- <tt>:chattanooga</tt>,<tt>:clarksville</tt>,<tt>:jacksontn</tt>,<tt>:knoxville</tt>,<tt>:memphis</tt>,<tt>:nashville</tt>,<tt>:tricities</tt>,
133
- ===== Texas
134
- <tt>:abilene</tt>,<tt>:amarillo</tt>,<tt>:austin</tt>,<tt>:beaumont</tt>,<tt>:brownsville</tt>,<tt>:collegestation</tt>,<tt>:corpuschristi</tt>,<tt>:dallas</tt>,
135
- <tt>:elpaso</tt>,<tt>:galveston</tt>,<tt>:houston</tt>,<tt>:killeen</tt>,<tt>:laredo</tt>,<tt>:lubbock</tt>,<tt>:mcallen</tt>,<tt>:odessa</tt>,<tt>:sanantonio</tt>,
136
- <tt>:sanmarcos</tt>,<tt>:texarkana</tt>,<tt>:easttexas</tt>,<tt>:victoriatx</tt>,<tt>:waco</tt>,<tt>:wichitafalls</tt>,
137
- ===== Utah
138
- <tt>:logan</tt>,<tt>:ogden</tt>,<tt>:provo</tt>,<tt>:saltlakecity</tt>,<tt>:stgeorge</tt>,
139
- ===== Vermont
140
- <tt>:burlington</tt>,
141
- ===== Virginia
142
- <tt>:blacksburg</tt>,<tt>:charlottesville</tt>,<tt>:danville</tt>,<tt>:easternshore</tt>,<tt>:fredericksburg</tt>,<tt>:norfolk</tt>,<tt>:harrisonburg</tt>,
143
- <tt>:lynchburg</tt>,<tt>:richmond</tt>,<tt>:roanoke</tt>,
144
- ===== Washington
145
- <tt>:bellingham</tt>,<tt>:kpr</tt>,<tt>:olympic</tt>,<tt>:pullman</tt>,<tt>:seattle</tt>,<tt>:skagit</tt>,<tt>:spokane</tt>,<tt>:wenatchee</tt>,<tt>:yakima</tt>,
146
- ===== West virginia
147
- <tt>:charlestonwv</tt>,<tt>:huntington</tt>,<tt>:martinsburg</tt>,<tt>:morgantown</tt>,<tt>:parkersburg</tt>,<tt>:wv</tt>,<tt>:wheeling</tt>,
148
- ===== Wisconsin
149
- <tt>:appleton</tt>,<tt>:duluth</tt>,<tt>:eauclaire</tt>,<tt>:greenbay</tt>,<tt>:janesville</tt>,<tt>:racine</tt>,<tt>:lacrosse</tt>,<tt>:madison</tt>,
150
- <tt>:milwaukee</tt>,<tt>:sheboygan</tt>,<tt>:wausau</tt>
151
-
152
-
153
- Or use <tt>:in => :anywhere</tt> to search all supported locations.
154
-
155
- == REQUIREMENTS:
156
-
157
- * Hpricot
158
-
159
- == INSTALL:
160
-
161
- * sudo gem install quixoten-craigler
162
-
163
- == Copyright
164
-
165
- Copyright (c) 2009 Devin Christensen. See LICENSE for details.
@@ -1,5 +0,0 @@
1
- ---
2
- :patch: 2
3
- :build:
4
- :major: 1
5
- :minor: 3