vast_api 0.0.5 → 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +5 -2
- data/VERSION +1 -1
- data/lib/vast_api.rb +31 -20
- data/lib/vast_api/attributes.rb +2 -2
- data/lib/vast_api/categories.rb +3 -3
- data/lib/vast_api/listings.rb +9 -1
- data/test/fixtures/vcr_cassettes/find_bike_with_category.yml +370 -0
- data/test/test_vast_api.rb +1 -1
- data/vast_api.gemspec +2 -2
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -10,11 +10,14 @@ A ruby wrapper for the vast.com listings api.
|
|
10
10
|
vast = @Vast.new('apikey','category') # both settings are optional
|
11
11
|
|
12
12
|
# Set Category
|
13
|
-
vast.category('item_vehicle/bike') #
|
13
|
+
vast = vast.category('item_vehicle/bike') #chainable
|
14
14
|
vast.category #retrives category
|
15
15
|
|
16
16
|
# set params
|
17
|
-
vast.where("price"=>"1001-2000")
|
17
|
+
vast = vast.where("price"=>"1001-2000")
|
18
|
+
|
19
|
+
# apply to self
|
20
|
+
vast.where!("price"=>"1001-2000")
|
18
21
|
|
19
22
|
# Get listings
|
20
23
|
vast.listing
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.0
|
1
|
+
0.1.0
|
data/lib/vast_api.rb
CHANGED
@@ -14,44 +14,55 @@ require File.expand_path('../vast_api/listings.rb', __FILE__)
|
|
14
14
|
require File.expand_path('../vast_api/listings/entry.rb', __FILE__)
|
15
15
|
|
16
16
|
class VastApi
|
17
|
-
|
18
|
-
|
17
|
+
attr_accessor :api_url
|
18
|
+
|
19
19
|
def initialize(apikey=nil, cat=nil)
|
20
|
+
@api_url = 'http://data.vast.com/'
|
20
21
|
@category = cat
|
21
|
-
@api_key = apikey
|
22
22
|
@query = { }
|
23
|
+
@query['apikey'] = apikey if apikey
|
23
24
|
@categories = {}
|
24
25
|
@attributes = {}
|
25
26
|
@listings = {}
|
26
27
|
end
|
27
28
|
|
29
|
+
def category!(cat)
|
30
|
+
@category = cat
|
31
|
+
self
|
32
|
+
end
|
33
|
+
|
28
34
|
def category(cat=nil)
|
35
|
+
self.dup
|
29
36
|
if cat.nil?
|
30
37
|
@category
|
31
38
|
else
|
32
|
-
|
33
|
-
self
|
39
|
+
self.dup.category!(cat)
|
34
40
|
end
|
35
41
|
end
|
36
42
|
|
37
|
-
def
|
38
|
-
|
39
|
-
|
40
|
-
else
|
41
|
-
@api_key = api_key
|
42
|
-
self
|
43
|
-
end
|
43
|
+
def where!(options)
|
44
|
+
@query.merge!(options)
|
45
|
+
self
|
44
46
|
end
|
45
47
|
|
46
48
|
def where(options)
|
47
|
-
|
48
|
-
|
49
|
+
self.dup.where!(options)
|
50
|
+
end
|
51
|
+
|
52
|
+
def api_key
|
53
|
+
@query['apikey']
|
54
|
+
end
|
55
|
+
|
56
|
+
def api_key=(key)
|
57
|
+
@query['apikey'] = key
|
49
58
|
end
|
50
59
|
|
51
60
|
def query
|
52
|
-
|
53
|
-
|
54
|
-
|
61
|
+
@query.to_query
|
62
|
+
end
|
63
|
+
|
64
|
+
def api_query
|
65
|
+
(api_key) ? "apikey=#{api_key}" : ''
|
55
66
|
end
|
56
67
|
|
57
68
|
def listings
|
@@ -73,7 +84,7 @@ class VastApi
|
|
73
84
|
if id.nil? || id.empty?
|
74
85
|
nil
|
75
86
|
else
|
76
|
-
Listings.get("#{
|
87
|
+
Listings.get("#{api_url}listings/#{id}/-/#{@category}?#{api_query}")
|
77
88
|
end
|
78
89
|
end
|
79
90
|
|
@@ -83,14 +94,14 @@ class VastApi
|
|
83
94
|
end
|
84
95
|
|
85
96
|
def self.find(id, cat)
|
86
|
-
Listings.get("#{
|
97
|
+
Listings.get("#{api_url}listings/#{id}/-/#{cat}?#{api_query}")
|
87
98
|
end
|
88
99
|
|
89
100
|
def self.find_by_url(url)
|
90
101
|
Listings.get(url)
|
91
102
|
end
|
92
103
|
|
93
|
-
|
104
|
+
protected
|
94
105
|
|
95
106
|
def opt_hash
|
96
107
|
str = ''
|
data/lib/vast_api/attributes.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
class VastApi
|
2
2
|
class Attributes < Hash
|
3
|
-
|
3
|
+
attr_reader :xml, :url, :vast
|
4
4
|
|
5
5
|
def initialize(vast)
|
6
6
|
@vast = vast
|
7
|
-
@url = "#{
|
7
|
+
@url = "#{@vast.api_url}attributes/-/#{@vast.category}?#{@vast.query}"
|
8
8
|
@xml = Nokogiri::XML(open(@url))
|
9
9
|
populate
|
10
10
|
end
|
data/lib/vast_api/categories.rb
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
class VastApi
|
2
2
|
class Categories < Hash
|
3
|
-
attr_reader :url
|
3
|
+
attr_reader :xml, :url, :vast
|
4
|
+
|
4
5
|
def initialize(vast)
|
5
6
|
@vast = vast
|
6
|
-
|
7
|
-
@url = "#{API_URL}categories#{query}"
|
7
|
+
@url = "#{@vast.api_url}categories?#{@vast.api_query}"
|
8
8
|
@xml = Nokogiri::XML(open(@url))
|
9
9
|
populate
|
10
10
|
end
|
data/lib/vast_api/listings.rb
CHANGED
@@ -4,7 +4,7 @@ class VastApi
|
|
4
4
|
|
5
5
|
def initialize(vast)
|
6
6
|
@vast = vast
|
7
|
-
@url = "#{
|
7
|
+
@url = "#{@vast.api_url}listings/-/#{@vast.category}?#{@vast.query}"
|
8
8
|
@xml = Nokogiri::XML(open(@url))
|
9
9
|
populate
|
10
10
|
end
|
@@ -43,6 +43,14 @@ class VastApi
|
|
43
43
|
@query
|
44
44
|
end
|
45
45
|
|
46
|
+
def find(id)
|
47
|
+
@vast.find(id)
|
48
|
+
end
|
49
|
+
|
50
|
+
def find!(id)
|
51
|
+
@vast.find!(id)
|
52
|
+
end
|
53
|
+
|
46
54
|
def self.get(url)
|
47
55
|
Entry.new(Nokogiri::XML(open(url)).at('entry'))
|
48
56
|
end
|
@@ -407,3 +407,373 @@
|
|
407
407
|
</entry>
|
408
408
|
|
409
409
|
http_version: "1.1"
|
410
|
+
- !ruby/struct:VCR::HTTPInteraction
|
411
|
+
request: !ruby/struct:VCR::Request
|
412
|
+
method: :get
|
413
|
+
uri: http://data.vast.com:80/categories?
|
414
|
+
body:
|
415
|
+
headers:
|
416
|
+
response: !ruby/struct:VCR::Response
|
417
|
+
status: !ruby/struct:VCR::ResponseStatus
|
418
|
+
code: 200
|
419
|
+
message: OK
|
420
|
+
headers:
|
421
|
+
date:
|
422
|
+
- Mon, 28 Mar 2011 16:53:53 GMT
|
423
|
+
server:
|
424
|
+
- Apache
|
425
|
+
x-powered-by:
|
426
|
+
- PHP/5.2.14
|
427
|
+
content-type:
|
428
|
+
- text/xml; charset=utf-8
|
429
|
+
accept-ranges:
|
430
|
+
- bytes
|
431
|
+
cache-control:
|
432
|
+
- private, max-age=300
|
433
|
+
age:
|
434
|
+
- "0"
|
435
|
+
expires:
|
436
|
+
- Mon, 28 Mar 2011 16:58:53 GMT
|
437
|
+
transfer-encoding:
|
438
|
+
- chunked
|
439
|
+
body: |
|
440
|
+
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
441
|
+
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:v="http://data.vast.com/ns/categories">
|
442
|
+
<id>http://data.vast.com/categories</id>
|
443
|
+
<updated>2011-03-21T17:52:16+0100</updated>
|
444
|
+
<entry>
|
445
|
+
<id>http://data.vast.com/categories</id>
|
446
|
+
<updated>2011-03-21T17:52:16+0100</updated>
|
447
|
+
<title type="text">SAMPLE - Vast Categories</title>
|
448
|
+
<subtitle>These are sample Vast API results. These results may only be used for testing and demonstrating applications and components based on the Vast API. All other uses are prohibited. For results suitable for other uses, including commercial use, please include your API key using the apikey parameter. You may apply for an API key at http://www.vast.com/partner.</subtitle>
|
449
|
+
<v:category count="1869094" id="jobs" name="Jobs"/>
|
450
|
+
<v:category count="156595" id="horses" name="Horses">
|
451
|
+
<v:category count="60" id="supplies" name="Supplies"/>
|
452
|
+
</v:category>
|
453
|
+
<v:category count="1135195" id="rentals" name="Rentals">
|
454
|
+
<v:category count="195" id="storage_parking" name="Storage & Parking"/>
|
455
|
+
<v:category count="1097493" id="residential" name="Residential">
|
456
|
+
<v:category count="130634" id="home" name="Single Family Homes"/>
|
457
|
+
<v:category count="57036" id="condo" name="Condos/Townhouses"/>
|
458
|
+
<v:category count="1350" id="short_term" name="Sublets & Short Term"/>
|
459
|
+
<v:category count="36938" id="roommate" name="Roommates & Shared Rentals"/>
|
460
|
+
<v:category count="868599" id="apartment" name="Apartments"/>
|
461
|
+
<v:category count="536" id="mobile_home" name="Mobile Homes"/>
|
462
|
+
</v:category>
|
463
|
+
<v:category count="912" id="land" name="Land"/>
|
464
|
+
<v:category count="18508" id="commercial" name="Commercial"/>
|
465
|
+
</v:category>
|
466
|
+
<v:category count="2156671" id="ticket" name="Tickets">
|
467
|
+
<v:category count="376873" id="concert" name="Concert"/>
|
468
|
+
<v:category count="1534543" id="sport" name="Sports"/>
|
469
|
+
<v:category count="189332" id="theater" name="Theater"/>
|
470
|
+
</v:category>
|
471
|
+
<v:category count="3623222" id="cars" name="Cars"/>
|
472
|
+
<v:category count="55890" id="announce" name="Community">
|
473
|
+
<v:category count="464" id="legal" name="Legal"/>
|
474
|
+
<v:category count="52" id="concert" name="Concert"/>
|
475
|
+
<v:category count="121" id="creative" name="Creative">
|
476
|
+
<v:category count="121" id="wanted" name="Wanted"/>
|
477
|
+
</v:category>
|
478
|
+
<v:category count="395" id="news" name="News"/>
|
479
|
+
<v:category count="1866" id="volunteer" name="Volunteer"/>
|
480
|
+
<v:category count="18" id="missed_con" name="Missed Connections"/>
|
481
|
+
<v:category count="31175" id="talent" name="Talent">
|
482
|
+
<v:category count="0" id="music" name="Music"/>
|
483
|
+
<v:category count="0" id="fashion" name="Fashion"/>
|
484
|
+
<v:category count="59" id="acting" name="Acting"/>
|
485
|
+
<v:category count="28889" id="wanted" name="Wanted"/>
|
486
|
+
</v:category>
|
487
|
+
<v:category count="0" id="sport" name="Sports"/>
|
488
|
+
<v:category count="0" id="rant" name="Rants & Raves"/>
|
489
|
+
<v:category count="376" id="rideshare" name="Rideshares"/>
|
490
|
+
<v:category count="8" id="education" name="Education"/>
|
491
|
+
<v:category count="91" id="activity_partners" name="Activity Partners"/>
|
492
|
+
<v:category count="22" id="business" name="Business"/>
|
493
|
+
<v:category count="0" id="kid" name="Kids & Toys"/>
|
494
|
+
<v:category count="170" id="politics" name="Politics"/>
|
495
|
+
<v:category count="2301" id="lost_found" name="Lost & Found"/>
|
496
|
+
<v:category count="6997" id="event" name="Events">
|
497
|
+
<v:category count="0" id="fashion" name="Fashion"/>
|
498
|
+
<v:category count="0" id="social" name="Social"/>
|
499
|
+
<v:category count="0" id="art" name="Art"/>
|
500
|
+
<v:category count="0" id="movie" name="Movies"/>
|
501
|
+
</v:category>
|
502
|
+
<v:category count="0" id="performance" name="Theater/Dance/Comedy"/>
|
503
|
+
<v:category count="0" id="food" name="Food"/>
|
504
|
+
<v:category count="0" id="book" name="Books"/>
|
505
|
+
<v:category count="0" id="write" name="Writing">
|
506
|
+
<v:category count="0" id="wanted" name="Wanted"/>
|
507
|
+
</v:category>
|
508
|
+
<v:category count="12168" id="musician" name="Musicians">
|
509
|
+
<v:category count="9882" id="wanted" name="Wanted"/>
|
510
|
+
</v:category>
|
511
|
+
<v:category count="0" id="artist" name="Artists"/>
|
512
|
+
<v:category count="1932" id="groups" name="Groups"/>
|
513
|
+
</v:category>
|
514
|
+
<v:category count="1368" id="pets" name="Pets">
|
515
|
+
<v:category count="5141" id="bird" name="Birds"/>
|
516
|
+
<v:category count="2191" id="farm" name="Farm"/>
|
517
|
+
<v:category count="8248" id="small_mammals" name="Small Mammals"/>
|
518
|
+
<v:category count="82975" id="cat" name="Cats"/>
|
519
|
+
<v:category count="622" id="fish" name="Fish"/>
|
520
|
+
<v:category count="18304" id="service" name="Services"/>
|
521
|
+
<v:category count="1435" id="reptile" name="Reptiles"/>
|
522
|
+
<v:category count="160683" id="dog" name="Dogs"/>
|
523
|
+
<v:category count="1368" id="supplies" name="Supplies"/>
|
524
|
+
</v:category>
|
525
|
+
<v:category count="239556" id="service" name="Services">
|
526
|
+
<v:category count="9093" id="computer" name="Computers">
|
527
|
+
<v:category count="0" id="wanted" name="Wanted"/>
|
528
|
+
</v:category>
|
529
|
+
<v:category count="3806" id="legal" name="Legal"/>
|
530
|
+
<v:category count="38" id="car" name="Cars & Trucks"/>
|
531
|
+
<v:category count="1873" id="skilled_trade" name="Skilled Trade"/>
|
532
|
+
<v:category count="5703" id="creative" name="Creative"/>
|
533
|
+
<v:category count="2551" id="lawn" name="Lawn & Garden"/>
|
534
|
+
<v:category count="5130" id="small_biz_ads" name="Small Business Ads"/>
|
535
|
+
<v:category count="18477" id="household" name="Household">
|
536
|
+
<v:category count="0" id="wanted" name="Wanted"/>
|
537
|
+
</v:category>
|
538
|
+
<v:category count="376" id="transportation" name="Transportation"/>
|
539
|
+
<v:category count="5208" id="travel" name="Travel"/>
|
540
|
+
<v:category count="32198" id="health" name="Health"/>
|
541
|
+
<v:category count="10980" id="education" name="Education"/>
|
542
|
+
<v:category count="1" id="boat" name="Boats"/>
|
543
|
+
<v:category count="778" id="business" name="Business"/>
|
544
|
+
<v:category count="0" id="realtor" name="Real Estate"/>
|
545
|
+
<v:category count="5634" id="automotive" name="Automotive"/>
|
546
|
+
<v:category count="65895" id="childcare" name="Childcare">
|
547
|
+
<v:category count="8" id="wanted" name="Wanted"/>
|
548
|
+
</v:category>
|
549
|
+
<v:category count="3186" id="event" name="Events"/>
|
550
|
+
<v:category count="18304" id="pets" name="Pets"/>
|
551
|
+
<v:category count="1938" id="musician" name="Musicians"/>
|
552
|
+
<v:category count="2124" id="finance" name="Finance"/>
|
553
|
+
<v:category count="4865" id="construction" name="Construction"/>
|
554
|
+
<v:category count="2196" id="move" name="Moving & Labor">
|
555
|
+
<v:category count="0" id="wanted" name="Wanted"/>
|
556
|
+
</v:category>
|
557
|
+
</v:category>
|
558
|
+
<v:category count="2092427" id="vacation_rentals" name="Vacation Rentals"/>
|
559
|
+
<v:category count="109753" id="travel" name="Travel">
|
560
|
+
<v:category count="5208" id="service" name="Services"/>
|
561
|
+
<v:category count="4716" id="activities" name="Activities">
|
562
|
+
<v:category count="446" id="skiing" name="Skiing"/>
|
563
|
+
<v:category count="11" id="safaris" name="Safaris"/>
|
564
|
+
<v:category count="0" id="canoeing" name="canoeing"/>
|
565
|
+
<v:category count="254" id="misc_water" name="Misc. Water Activities"/>
|
566
|
+
<v:category count="0" id="rafting" name="White-Water Rafting"/>
|
567
|
+
<v:category count="1344" id="tours" name="Tours"/>
|
568
|
+
<v:category count="168" id="romance" name="Romance"/>
|
569
|
+
<v:category count="0" id="ice_skating" name="Ice Skating"/>
|
570
|
+
<v:category count="57" id="adventure" name="Adventure"/>
|
571
|
+
<v:category count="11" id="horseback_riding" name="Horseback Riding"/>
|
572
|
+
<v:category count="0" id="surfing" name="Surfing"/>
|
573
|
+
<v:category count="902" id="museums" name="Museums"/>
|
574
|
+
<v:category count="91" id="scuba_snorkeling" name="Scuba & Snorkeling"/>
|
575
|
+
<v:category count="20" id="camping" name="Camping"/>
|
576
|
+
<v:category count="0" id="family" name="Family"/>
|
577
|
+
<v:category count="2" id="golf" name="Golf"/>
|
578
|
+
<v:category count="0" id="snow_sports" name="Snow Sports"/>
|
579
|
+
<v:category count="8" id="nightlife" name="Nightlife"/>
|
580
|
+
<v:category count="0" id="kayaking" name="Kayaking"/>
|
581
|
+
<v:category count="88" id="hiking_backpacking" name="Hiking & Backpacking"/>
|
582
|
+
<v:category count="85" id="misc_outdoor" name="Misc. Outdoor Activities"/>
|
583
|
+
<v:category count="15" id="spas_health" name="Spas & Health"/>
|
584
|
+
<v:category count="41" id="shows_events" name="Shows & Events"/>
|
585
|
+
<v:category count="2" id="cruises" name="Cruises"/>
|
586
|
+
<v:category count="68" id="air_tours" name="Air Tours"/>
|
587
|
+
<v:category count="0" id="windsurfing" name="Windsurfing"/>
|
588
|
+
<v:category count="212" id="wildlife_viewing" name="Wildlife Viewing"/>
|
589
|
+
<v:category count="3" id="boating" name="Boating"/>
|
590
|
+
<v:category count="0" id="climbing" name="Climbing"/>
|
591
|
+
<v:category count="0" id="seniors" name="Seniors"/>
|
592
|
+
<v:category count="37" id="biking" name="Biking"/>
|
593
|
+
<v:category count="0" id="multi_sport_activities" name="Multi-Sport Activities"/>
|
594
|
+
<v:category count="0" id="corporate_retreats" name="Corporate Retreats"/>
|
595
|
+
<v:category count="0" id="caving" name="Caving"/>
|
596
|
+
<v:category count="0" id="hunting" name="Hunting"/>
|
597
|
+
<v:category count="273" id="cultural_educational" name="Cultural & Educational"/>
|
598
|
+
<v:category count="190" id="food_wine" name="Food & Wine"/>
|
599
|
+
<v:category count="17" id="shopping" name="Shopping"/>
|
600
|
+
<v:category count="12" id="fishing" name="Fishing"/>
|
601
|
+
<v:category count="13" id="theme_parks" name="Theme Parks"/>
|
602
|
+
<v:category count="45" id="motorized_adventures" name="Motorized Adventures"/>
|
603
|
+
</v:category>
|
604
|
+
<v:category count="20" id="item_vehicle" name="Merchandise"/>
|
605
|
+
<v:category count="26202" id="campgrounds" name="Campgrounds"/>
|
606
|
+
<v:category count="73372" id="hotels" name="Hotels"/>
|
607
|
+
</v:category>
|
608
|
+
<v:category count="984227" id="item_vehicle" name="Merchandise">
|
609
|
+
<v:category count="20" id="bird" name="Birds">
|
610
|
+
<v:category count="20" id="supplies" name="Supplies"/>
|
611
|
+
</v:category>
|
612
|
+
<v:category count="324397" id="vehicle" name="Vehicles">
|
613
|
+
<v:category count="10216" id="car" name="Cars & Trucks">
|
614
|
+
<v:category count="0" id="farm" name="Farm"/>
|
615
|
+
<v:category count="0" id="motorcycle" name="Motorcycles"/>
|
616
|
+
<v:category count="0" id="rv" name="RVs"/>
|
617
|
+
<v:category count="0" id="commercial_truck" name="Commercial Trucks"/>
|
618
|
+
<v:category count="81" id="antique" name="Antiques"/>
|
619
|
+
</v:category>
|
620
|
+
<v:category count="0" id="computer" name="Computers">
|
621
|
+
<v:category count="0" id="software" name="Software"/>
|
622
|
+
<v:category count="0" id="hardware" name="Hardware"/>
|
623
|
+
</v:category>
|
624
|
+
<v:category count="0" id="trailer" name="Trailers"/>
|
625
|
+
<v:category count="0" id="craft" name="Crafts"/>
|
626
|
+
<v:category count="0" id="cat" name="Cats">
|
627
|
+
<v:category count="0" id="supplies" name="Supplies"/>
|
628
|
+
</v:category>
|
629
|
+
<v:category count="0" id="lawn" name="Lawn & Garden"/>
|
630
|
+
<v:category count="0" id="fish" name="Fish">
|
631
|
+
<v:category count="0" id="supplies" name="Supplies"/>
|
632
|
+
</v:category>
|
633
|
+
<v:category count="0" id="tool" name="Tools"/>
|
634
|
+
<v:category count="0" id="jewelry" name="Jewelry"/>
|
635
|
+
<v:category count="0" id="travel" name="Travel"/>
|
636
|
+
<v:category count="0" id="furniture" name="Furniture"/>
|
637
|
+
<v:category count="0" id="education" name="Education"/>
|
638
|
+
<v:category count="0" id="part_accessories" name="Parts & Accessories">
|
639
|
+
<v:category count="0" id="accessories" name="Accessories"/>
|
640
|
+
<v:category count="0" id="part" name="Parts"/>
|
641
|
+
</v:category>
|
642
|
+
<v:category count="0" id="kid" name="Kids & Toys"/>
|
643
|
+
<v:category count="18" id="farm" name="Farm"/>
|
644
|
+
<v:category count="0" id="automotive" name="Automotive"/>
|
645
|
+
<v:category count="81" id="antique_collectible" name="Antiques & Collectibles">
|
646
|
+
<v:category count="0" id="collectible" name="Collectibles"/>
|
647
|
+
<v:category count="81" id="antique" name="Antiques"/>
|
648
|
+
</v:category>
|
649
|
+
<v:category count="0" id="bike" name="Bicycles"/>
|
650
|
+
<v:category count="0" id="commercial" name="Commercial"/>
|
651
|
+
<v:category count="0" id="clothing_accessories" name="Clothing & Accessories">
|
652
|
+
<v:category count="0" id="clothing" name="Clothing"/>
|
653
|
+
<v:category count="0" id="footwear" name="Footwear"/>
|
654
|
+
<v:category count="0" id="accessories" name="Accessories"/>
|
655
|
+
<v:category count="0" id="antique" name="Antiques"/>
|
656
|
+
</v:category>
|
657
|
+
<v:category count="0" id="office" name="Office"/>
|
658
|
+
<v:category count="0" id="art_related" name="Art & Supplies">
|
659
|
+
<v:category count="0" id="art" name="Art"/>
|
660
|
+
<v:category count="0" id="supplies" name="Supplies"/>
|
661
|
+
</v:category>
|
662
|
+
<v:category count="0" id="household" name="Household"/>
|
663
|
+
<v:category count="0" id="sport" name="Sports"/>
|
664
|
+
<v:category count="9180" id="atv" name="ATVs"/>
|
665
|
+
<v:category count="0" id="instrument" name="Musical Instruments"/>
|
666
|
+
<v:category count="171181" id="boat" name="Boats"/>
|
667
|
+
<v:category count="0" id="health" name="Health"/>
|
668
|
+
<v:category count="0" id="food" name="Food"/>
|
669
|
+
<v:category count="0" id="poster" name="Posters"/>
|
670
|
+
<v:category count="0" id="music_movie" name="Music & Movies">
|
671
|
+
<v:category count="0" id="music" name="Music"/>
|
672
|
+
<v:category count="0" id="movie" name="Movies"/>
|
673
|
+
</v:category>
|
674
|
+
<v:category count="0" id="finance" name="Finance"/>
|
675
|
+
<v:category count="0" id="dog" name="Dogs">
|
676
|
+
<v:category count="0" id="supplies" name="Supplies"/>
|
677
|
+
</v:category>
|
678
|
+
<v:category count="0" id="electronics" name="Electronics">
|
679
|
+
<v:category count="0" id="software" name="Software"/>
|
680
|
+
<v:category count="0" id="phone" name="Phones"/>
|
681
|
+
<v:category count="0" id="hardware" name="Hardware"/>
|
682
|
+
<v:category count="0" id="audio_video" name="Audio & Video"/>
|
683
|
+
<v:category count="0" id="video_game" name="Video Games"/>
|
684
|
+
<v:category count="0" id="photo" name="Photo"/>
|
685
|
+
</v:category>
|
686
|
+
</v:category>
|
687
|
+
<v:category count="10646" id="book" name="Books"/>
|
688
|
+
<v:category count="780" id="construction" name="Construction"/>
|
689
|
+
<v:category count="1973" id="business" name="Business"/>
|
690
|
+
<v:category count="7530" id="appliance" name="Appliances"/>
|
691
|
+
</v:category>
|
692
|
+
<v:category count="3866918" id="real_estate" name="Real Estate">
|
693
|
+
<v:category count="26053" id="farm" name="Farm"/>
|
694
|
+
<v:category count="2883806" id="residential" name="Residential">
|
695
|
+
<v:category count="2393400" id="home" name="Single Family Homes"/>
|
696
|
+
<v:category count="394898" id="condo" name="Condos/Townhouses"/>
|
697
|
+
<v:category count="80423" id="multi_unit" name="Multi-Unit Properties"/>
|
698
|
+
<v:category count="12218" id="mobile_home" name="Mobile Homes"/>
|
699
|
+
</v:category>
|
700
|
+
<v:category count="7527" id="service" name="Services"/>
|
701
|
+
<v:category count="516564" id="land" name="Land"/>
|
702
|
+
<v:category count="6048" id="open_house" name="Open House"/>
|
703
|
+
<v:category count="35075" id="commercial" name="Commercial"/>
|
704
|
+
</v:category>
|
705
|
+
</entry>
|
706
|
+
</feed>
|
707
|
+
|
708
|
+
http_version: "1.1"
|
709
|
+
- !ruby/struct:VCR::HTTPInteraction
|
710
|
+
request: !ruby/struct:VCR::Request
|
711
|
+
method: :get
|
712
|
+
uri: http://data.vast.com:80/listings/555288039954342885/-/item_vehicle/bike?
|
713
|
+
body:
|
714
|
+
headers:
|
715
|
+
response: !ruby/struct:VCR::Response
|
716
|
+
status: !ruby/struct:VCR::ResponseStatus
|
717
|
+
code: 200
|
718
|
+
message: OK
|
719
|
+
headers:
|
720
|
+
date:
|
721
|
+
- Mon, 28 Mar 2011 16:58:52 GMT
|
722
|
+
server:
|
723
|
+
- Apache
|
724
|
+
x-powered-by:
|
725
|
+
- PHP/5.2.14
|
726
|
+
content-type:
|
727
|
+
- text/xml; charset=utf-8
|
728
|
+
accept-ranges:
|
729
|
+
- bytes
|
730
|
+
cache-control:
|
731
|
+
- private, max-age=300
|
732
|
+
age:
|
733
|
+
- "0"
|
734
|
+
expires:
|
735
|
+
- Mon, 28 Mar 2011 17:03:52 GMT
|
736
|
+
transfer-encoding:
|
737
|
+
- chunked
|
738
|
+
body: |
|
739
|
+
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:v='http://data.vast.com/ns/listings'>
|
740
|
+
<id>http://data.vast.com/listings/555288039954342885/-/item_vehicle/bike</id>
|
741
|
+
<updated>2011-03-18T09:04:04+01:00</updated>
|
742
|
+
<published>2011-02-14T09:03:26+01:00</published>
|
743
|
+
<author>
|
744
|
+
<name>www.sample.com</name>
|
745
|
+
</author>
|
746
|
+
<title type="text">SAMPLE - Vintage 25 Inch Univega</title>
|
747
|
+
<v:vertical>general</v:vertical>
|
748
|
+
<v:category>item_vehicle%2Cbike</v:category>
|
749
|
+
<v:item_id>555288039954342885</v:item_id>
|
750
|
+
<v:location precision="zip">
|
751
|
+
<v:state>WA</v:state>
|
752
|
+
<v:country>United States</v:country>
|
753
|
+
<v:zip>98077</v:zip>
|
754
|
+
<v:distance>0</v:distance>
|
755
|
+
<v:city>Woodinville</v:city>
|
756
|
+
<v:lat precision="unknown">47.749870</v:lat>
|
757
|
+
<v:lon precision="unknown">-122.098319</v:lon>
|
758
|
+
<v:address></v:address>
|
759
|
+
</v:location>
|
760
|
+
<v:price type="money" symbol="$" currency="USD" value="0"/>
|
761
|
+
<v:currency type="text">USD</v:currency>
|
762
|
+
<link rel="self" type="application/atom+xml" href="http://data.vast.com/listings/555288039954342885/-/item_vehicle/bike?apikey="/>
|
763
|
+
<link rel="via" type="text/html" title="www.sample.com" href="http://details.vast.com/details/item_vehicle/bike/ob-NzezewM0CURHmZaIMMyUBGiJ/"/>
|
764
|
+
<link rel="alternate" type="text/html" title="Vintage 25 Inch Univega" href="http://details.vast.com/details/item_vehicle/bike/ob-NzezewM0CURHmZaIMMyUBGiJ/"/>
|
765
|
+
<link rel="http://feedback.vast.com" type="text/html" title="Report incorrect result" href="http://www.vast.com/ajax/report?id=555288039954342885&category=item_vehicle/bike&apikey="/>
|
766
|
+
<v:domain_name type="text">www.sample.com</v:domain_name>
|
767
|
+
<v:year type="number"></v:year>
|
768
|
+
<v:image_url type="image/jpeg">http://img.vast.com/128x96/555288039954342885</v:image_url>
|
769
|
+
<v:large_image_url type="image/jpeg">http://img.vast.com/320x240/555288039954342885</v:large_image_url>
|
770
|
+
<v:tiny_image_url type="image/jpeg">http://img.vast.com/59x44/555288039954342885</v:tiny_image_url>
|
771
|
+
<v:image_count>1</v:image_count>
|
772
|
+
<v:hasimage type="boolean">yes</v:hasimage>
|
773
|
+
<v:hosted type="boolean">no</v:hosted>
|
774
|
+
<v:hosted_type type="text">landing</v:hosted_type>
|
775
|
+
<v:description type="text">This bike is in great condition. Everything on the bike still works incredibly well. Questions and concerns - Kramsivamhotmail.com</v:description>
|
776
|
+
<content type="html"><img src="http://img.vast.com/128x96/555288039954342885"><ul><li><strong>description:</strong>This bike is in great condition. Everything on the bike still works incredibly well. Questions and concerns - Kramsivamhotmail.com</li><li><strong>price:</strong>0</li><li><strong>country:</strong>United States</li><li><strong>state:</strong>WA</li><li><strong>zip:</strong>98077</li><li><strong>city:</strong>Woodinville</li></ul></content>
|
777
|
+
</entry>
|
778
|
+
|
779
|
+
http_version: "1.1"
|
data/test/test_vast_api.rb
CHANGED
@@ -57,7 +57,7 @@ describe VastApi do
|
|
57
57
|
p bike.id
|
58
58
|
find_bike_cat = ''
|
59
59
|
VCR.use_cassette('find bike with category', :record => :new_episodes) do
|
60
|
-
find_bike_cat = @
|
60
|
+
find_bike_cat = @listing.find!(bike.id)
|
61
61
|
end
|
62
62
|
find_bike_cat.id.must_equal bike.id
|
63
63
|
end
|
data/vast_api.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{vast_api}
|
8
|
-
s.version = "0.0
|
8
|
+
s.version = "0.1.0"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["Ryan Ong", "Mikhail Knyazev"]
|
12
|
-
s.date = %q{2011-03-
|
12
|
+
s.date = %q{2011-03-28}
|
13
13
|
s.description = %q{A ruby wrapper for the http://www.vast.com/ api}
|
14
14
|
s.email = %q{ryanong@gmail.com}
|
15
15
|
s.extra_rdoc_files = [
|
metadata
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
name: vast_api
|
3
3
|
version: !ruby/object:Gem::Version
|
4
4
|
prerelease:
|
5
|
-
version: 0.0
|
5
|
+
version: 0.1.0
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Ryan Ong
|
@@ -11,7 +11,7 @@ autorequire:
|
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
13
|
|
14
|
-
date: 2011-03-
|
14
|
+
date: 2011-03-28 00:00:00 -04:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -158,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
158
158
|
requirements:
|
159
159
|
- - ">="
|
160
160
|
- !ruby/object:Gem::Version
|
161
|
-
hash:
|
161
|
+
hash: -3668420163538428929
|
162
162
|
segments:
|
163
163
|
- 0
|
164
164
|
version: "0"
|