vast_api 0.0.1 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- data/Rakefile +1 -1
- data/VERSION +1 -1
- data/lib/vast_api/attributes/entry.rb +8 -8
- data/lib/vast_api/listings/entry.rb +16 -10
- data/lib/vast_api/listings.rb +34 -1
- data/lib/vast_api.rb +17 -2
- data/test/fixtures/vcr_cassettes/bike_listings.yml +159 -160
- data/test/fixtures/vcr_cassettes/filter_items.yml +129 -128
- data/test/fixtures/vcr_cassettes/find_bike_with_attribute.yml +61 -60
- data/test/fixtures/vcr_cassettes/find_bike_with_category.yml +66 -28
- data/test/test_vast_api.rb +5 -4
- data/vast_api.gemspec +3 -4
- metadata +4 -5
- data/lib/vast_api/base.rb +0 -43
@@ -11,7 +11,7 @@
|
|
11
11
|
message: OK
|
12
12
|
headers:
|
13
13
|
date:
|
14
|
-
-
|
14
|
+
- Mon, 21 Mar 2011 20:15:45 GMT
|
15
15
|
server:
|
16
16
|
- Apache
|
17
17
|
x-powered-by:
|
@@ -25,7 +25,7 @@
|
|
25
25
|
age:
|
26
26
|
- "0"
|
27
27
|
expires:
|
28
|
-
-
|
28
|
+
- Mon, 21 Mar 2011 20:20:45 GMT
|
29
29
|
transfer-encoding:
|
30
30
|
- chunked
|
31
31
|
body: |
|
@@ -33,99 +33,100 @@
|
|
33
33
|
<feed xmlns='http://www.w3.org/2005/Atom' xmlns:o='http://a9.com/-/spec/opensearchrss/1.0/' xmlns:v='http://data.vast.com/ns/attributes'>
|
34
34
|
<id>http://data.vast.com/attributes/-/item_vehicle/bike</id>
|
35
35
|
<link rel="self" type="application/atom+xml" href="http://data.vast.com/attributes/-/item_vehicle/bike"/>
|
36
|
-
<updated>2011-03-
|
36
|
+
<updated>2011-03-21T21:14:47+01:00</updated>
|
37
37
|
<title type="text">SAMPLE - Bicycles For Sale</title>
|
38
38
|
<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>
|
39
39
|
<logo>http://www.vast.com/resources/vast_v3/images/vast_logo.jpg</logo>
|
40
|
-
<o:totalResults>
|
40
|
+
<o:totalResults>730</o:totalResults>
|
41
41
|
<o:startIndex>1</o:startIndex>
|
42
42
|
<o:itemsPerPage>10</o:itemsPerPage>
|
43
43
|
<o:Query xmlns:v="http://data.vast.com/ns/search" role="request" v:range="50" startIndex="1" totalResults="10" v:feed="attributes" v:category="item_vehicle,bike" />
|
44
44
|
<v:stem/>
|
45
45
|
<v:extra/>
|
46
|
-
<v:site_count>
|
46
|
+
<v:site_count>10</v:site_count>
|
47
47
|
<v:location/>
|
48
48
|
<entry>
|
49
49
|
<id>http://data.vast.com/attributes/location/-/item_vehicle/bike</id>
|
50
50
|
<title type='text'>SAMPLE - Location</title>
|
51
|
-
<updated>2011-03-
|
51
|
+
<updated>2011-03-21T21:14:47+01:00</updated>
|
52
52
|
<author>
|
53
53
|
<name>www.vast.com</name>
|
54
54
|
</author>
|
55
55
|
<v:attribute id="location" type="text">
|
56
|
-
<v:value id="Park-City--UT" count="
|
57
|
-
<v:value id="
|
58
|
-
<v:value id="
|
59
|
-
<v:value id="Los-Angeles--CA" count="16">Los Angeles, CA</v:value>
|
56
|
+
<v:value id="Park-City--UT" count="72">Park City, UT</v:value>
|
57
|
+
<v:value id="New-York--NY" count="19">New York, NY</v:value>
|
58
|
+
<v:value id="Porter--TX" count="16">Porter, TX</v:value>
|
60
59
|
<v:value id="Fullerton--CA" count="14">Fullerton, CA</v:value>
|
61
|
-
<v:value id="San-Francisco--CA" count="9">San Francisco, CA</v:value>
|
62
60
|
<v:value id="Homeland--CA" count="8">Homeland, CA</v:value>
|
63
|
-
<v:value id="
|
64
|
-
<v:value id="
|
65
|
-
<v:value id="
|
66
|
-
<v:value id="
|
67
|
-
<v:value id="
|
68
|
-
<v:value id="
|
61
|
+
<v:value id="Los-Angeles--CA" count="6">Los Angeles, CA</v:value>
|
62
|
+
<v:value id="Trumbull--CT" count="5">Trumbull, CT</v:value>
|
63
|
+
<v:value id="Houston--TX" count="4">Houston, TX</v:value>
|
64
|
+
<v:value id="Baltimore--MD" count="4">Baltimore, MD</v:value>
|
65
|
+
<v:value id="Centerbrook--CT" count="4">Centerbrook, CT</v:value>
|
66
|
+
<v:value id="Norwalk--CT" count="4">Norwalk, CT</v:value>
|
67
|
+
<v:value id="Bridgeport--CT" count="4">Bridgeport, CT</v:value>
|
68
|
+
<v:value id="Indianapolis--IN" count="4">Indianapolis, IN</v:value>
|
69
|
+
<v:value id="Portland--OR" count="4">Portland, OR</v:value>
|
69
70
|
<v:value id="Atlanta--GA" count="4">Atlanta, GA</v:value>
|
70
|
-
<v:value id="
|
71
|
-
<v:value id="
|
72
|
-
<v:value id="
|
73
|
-
<v:value id="
|
74
|
-
<v:value id="
|
75
|
-
<v:value id="
|
76
|
-
<v:value id="
|
77
|
-
<v:value id="Washington--NY" count="3">Washington, NY</v:value>
|
78
|
-
<v:value id="Aurora--IL" count="3">Aurora, IL</v:value>
|
71
|
+
<v:value id="Salt-Lake-City--UT" count="4">Salt Lake City, UT</v:value>
|
72
|
+
<v:value id="Phoenix--AZ" count="4">Phoenix, AZ</v:value>
|
73
|
+
<v:value id="Spokane--WA" count="4">Spokane, WA</v:value>
|
74
|
+
<v:value id="Minneapolis--MN" count="3">Minneapolis, MN</v:value>
|
75
|
+
<v:value id="San-Francisco--CA" count="3">San Francisco, CA</v:value>
|
76
|
+
<v:value id="Waterbury--CT" count="3">Waterbury, CT</v:value>
|
77
|
+
<v:value id="Albuquerque--NM" count="3">Albuquerque, NM</v:value>
|
79
78
|
<v:value id="Stratford--CT" count="3">Stratford, CT</v:value>
|
80
|
-
<v:value id="
|
81
|
-
<v:value id="
|
82
|
-
<v:value id="
|
83
|
-
<v:value id="
|
79
|
+
<v:value id="Denver--CO" count="3">Denver, CO</v:value>
|
80
|
+
<v:value id="Reading--PA" count="3">Reading, PA</v:value>
|
81
|
+
<v:value id="Columbus--OH" count="3">Columbus, OH</v:value>
|
82
|
+
<v:value id="New-Haven--CT" count="3">New Haven, CT</v:value>
|
83
|
+
<v:value id="Washington--NY" count="3">Washington, NY</v:value>
|
84
|
+
<v:value id="North-Haven--CT" count="3">North Haven, CT</v:value>
|
85
|
+
<v:value id="Santa-Rosa--CA" count="3">Santa Rosa, CA</v:value>
|
84
86
|
<v:value id="Champlain--NY" count="3">Champlain, NY</v:value>
|
85
|
-
<v:value id="
|
86
|
-
<v:value id="
|
87
|
-
<v:value id="
|
88
|
-
<v:value id="
|
89
|
-
<v:value id="
|
90
|
-
<v:value id="
|
91
|
-
<v:value id="
|
92
|
-
<v:value id="
|
93
|
-
<v:value id="
|
94
|
-
<v:value id="
|
95
|
-
<v:value id="
|
96
|
-
<v:value id="
|
97
|
-
<v:value id="
|
98
|
-
<v:value id="
|
87
|
+
<v:value id="Aurora--IL" count="3">Aurora, IL</v:value>
|
88
|
+
<v:value id="Louisville--KY" count="3">Louisville, KY</v:value>
|
89
|
+
<v:value id="North-Bend--WA" count="3">North Bend, WA</v:value>
|
90
|
+
<v:value id="Honolulu--HI" count="3">Honolulu, HI</v:value>
|
91
|
+
<v:value id="Saint-Petersburg--FL" count="3">Saint Petersburg, FL</v:value>
|
92
|
+
<v:value id="Seattle--WA" count="3">Seattle, WA</v:value>
|
93
|
+
<v:value id="Redondo-Beach--CA" count="2">Redondo Beach, CA</v:value>
|
94
|
+
<v:value id="Provo--UT" count="2">Provo, UT</v:value>
|
95
|
+
<v:value id="Fayetteville--AR" count="2">Fayetteville, AR</v:value>
|
96
|
+
<v:value id="Boulder--CO" count="2">Boulder, CO</v:value>
|
97
|
+
<v:value id="Davis--CA" count="2">Davis, CA</v:value>
|
98
|
+
<v:value id="Tulsa--OK" count="2">Tulsa, OK</v:value>
|
99
|
+
<v:value id="Jacksonville--FL" count="2">Jacksonville, FL</v:value>
|
100
|
+
<v:value id="Charlotte--NC" count="2">Charlotte, NC</v:value>
|
99
101
|
<v:value id="Shepparton--Australia" count="10">Shepparton, Australia</v:value>
|
100
|
-
<v:value id="Other-
|
101
|
-
<v:value id="Other-
|
102
|
-
<v:value id="Other-PA" count="
|
103
|
-
<v:value id="
|
104
|
-
<v:value id="Other-OH" count="2">Other OH</v:value>
|
105
|
-
<v:value id="unknown" count="204">unknown</v:value>
|
102
|
+
<v:value id="Other-NY" count="6">Other NY</v:value>
|
103
|
+
<v:value id="Other-CA" count="6">Other CA</v:value>
|
104
|
+
<v:value id="Other-PA" count="5">Other PA</v:value>
|
105
|
+
<v:value id="unknown" count="170">unknown</v:value>
|
106
106
|
</v:attribute>
|
107
|
-
<content type="html"><ul><li><a href="/attributes/-/item_vehicle/bike?location=Park-City--UT">Park City, UT</a>
|
107
|
+
<content type="html"><ul><li><a href="/attributes/-/item_vehicle/bike?location=Park-City--UT">Park City, UT</a> 72</li><li><a href="/attributes/-/item_vehicle/bike?location=New-York--NY">New York, NY</a> 19</li><li><a href="/attributes/-/item_vehicle/bike?location=Porter--TX">Porter, TX</a> 16</li><li><a href="/attributes/-/item_vehicle/bike?location=Fullerton--CA">Fullerton, CA</a> 14</li><li><a href="/attributes/-/item_vehicle/bike?location=Homeland--CA">Homeland, CA</a> 8</li><li><a href="/attributes/-/item_vehicle/bike?location=Los-Angeles--CA">Los Angeles, CA</a> 6</li><li><a href="/attributes/-/item_vehicle/bike?location=Trumbull--CT">Trumbull, CT</a> 5</li><li><a href="/attributes/-/item_vehicle/bike?location=Houston--TX">Houston, TX</a> 4</li><li><a href="/attributes/-/item_vehicle/bike?location=Baltimore--MD">Baltimore, MD</a> 4</li><li><a href="/attributes/-/item_vehicle/bike?location=Centerbrook--CT">Centerbrook, CT</a> 4</li><li><a href="/attributes/-/item_vehicle/bike?location=Norwalk--CT">Norwalk, CT</a> 4</li><li><a href="/attributes/-/item_vehicle/bike?location=Bridgeport--CT">Bridgeport, CT</a> 4</li><li><a href="/attributes/-/item_vehicle/bike?location=Indianapolis--IN">Indianapolis, IN</a> 4</li><li><a href="/attributes/-/item_vehicle/bike?location=Portland--OR">Portland, OR</a> 4</li><li><a href="/attributes/-/item_vehicle/bike?location=Atlanta--GA">Atlanta, GA</a> 4</li><li><a href="/attributes/-/item_vehicle/bike?location=Salt-Lake-City--UT">Salt Lake City, UT</a> 4</li><li><a href="/attributes/-/item_vehicle/bike?location=Phoenix--AZ">Phoenix, AZ</a> 4</li><li><a href="/attributes/-/item_vehicle/bike?location=Spokane--WA">Spokane, WA</a> 4</li><li><a href="/attributes/-/item_vehicle/bike?location=Minneapolis--MN">Minneapolis, MN</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=San-Francisco--CA">San Francisco, CA</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Waterbury--CT">Waterbury, CT</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Albuquerque--NM">Albuquerque, NM</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Stratford--CT">Stratford, CT</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Denver--CO">Denver, CO</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Reading--PA">Reading, PA</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Columbus--OH">Columbus, OH</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=New-Haven--CT">New Haven, CT</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Washington--NY">Washington, NY</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=North-Haven--CT">North Haven, CT</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Santa-Rosa--CA">Santa Rosa, CA</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Champlain--NY">Champlain, NY</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Aurora--IL">Aurora, IL</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Louisville--KY">Louisville, KY</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=North-Bend--WA">North Bend, WA</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Honolulu--HI">Honolulu, HI</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Saint-Petersburg--FL">Saint Petersburg, FL</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Seattle--WA">Seattle, WA</a> 3</li><li><a href="/attributes/-/item_vehicle/bike?location=Redondo-Beach--CA">Redondo Beach, CA</a> 2</li><li><a href="/attributes/-/item_vehicle/bike?location=Provo--UT">Provo, UT</a> 2</li><li><a href="/attributes/-/item_vehicle/bike?location=Fayetteville--AR">Fayetteville, AR</a> 2</li><li><a href="/attributes/-/item_vehicle/bike?location=Boulder--CO">Boulder, CO</a> 2</li><li><a href="/attributes/-/item_vehicle/bike?location=Davis--CA">Davis, CA</a> 2</li><li><a href="/attributes/-/item_vehicle/bike?location=Tulsa--OK">Tulsa, OK</a> 2</li><li><a href="/attributes/-/item_vehicle/bike?location=Jacksonville--FL">Jacksonville, FL</a> 2</li><li><a href="/attributes/-/item_vehicle/bike?location=Charlotte--NC">Charlotte, NC</a> 2</li><li><a href="/attributes/-/item_vehicle/bike?location=Shepparton--Australia">Shepparton, Australia</a> 10</li><li><a href="/attributes/-/item_vehicle/bike?location=Other-NY">Other NY</a> 6</li><li><a href="/attributes/-/item_vehicle/bike?location=Other-CA">Other CA</a> 6</li><li><a href="/attributes/-/item_vehicle/bike?location=Other-PA">Other PA</a> 5</li><li><a href="/attributes/-/item_vehicle/bike?location=unknown">unknown</a> 170</li></ul></content>
|
108
108
|
</entry>
|
109
109
|
<entry>
|
110
110
|
<id>http://data.vast.com/attributes/price/-/item_vehicle/bike</id>
|
111
111
|
<title type='text'>SAMPLE - Price</title>
|
112
|
-
<updated>2011-03-
|
112
|
+
<updated>2011-03-21T21:14:46+01:00</updated>
|
113
113
|
<author>
|
114
114
|
<name>www.vast.com</name>
|
115
115
|
</author>
|
116
|
-
<v:attribute id="price" type="money" symbol="$" currency="USD" lower="0" upper="
|
117
|
-
<v:value id="0-1000" count="
|
118
|
-
<v:value id="1001-2000" count="
|
119
|
-
<v:value id="2001-3000" count="
|
120
|
-
<v:value id="3001-
|
121
|
-
<v:value id="
|
116
|
+
<v:attribute id="price" type="money" symbol="$" currency="USD" lower="0" upper="9001" median="500">
|
117
|
+
<v:value id="0-1000" count="541" min="0" max="1000">less than $1,001</v:value>
|
118
|
+
<v:value id="1001-2000" count="70" min="1001" max="2000">$1,001 - $2,000</v:value>
|
119
|
+
<v:value id="2001-3000" count="43" min="2001" max="3000">$2,001 - $3,000</v:value>
|
120
|
+
<v:value id="3001-9000" count="29" min="3001" max="9000">$3,001 - $9,000</v:value>
|
121
|
+
<v:value id="9001-max" count="4" min="9001" max="max">$9,001+</v:value>
|
122
|
+
<v:value id="unknown" count="43" >unknown</v:value>
|
122
123
|
</v:attribute>
|
123
|
-
<content type="html"><ul><li><a href="/attributes/-/item_vehicle/bike?price=0-1000">less than $1,001</a>
|
124
|
+
<content type="html"><ul><li><a href="/attributes/-/item_vehicle/bike?price=0-1000">less than $1,001</a> 541</li><li><a href="/attributes/-/item_vehicle/bike?price=1001-2000">$1,001 - $2,000</a> 70</li><li><a href="/attributes/-/item_vehicle/bike?price=2001-3000">$2,001 - $3,000</a> 43</li><li><a href="/attributes/-/item_vehicle/bike?price=3001-9000">$3,001 - $9,000</a> 29</li><li><a href="/attributes/-/item_vehicle/bike?price=9001-max">$9,001+</a> 4</li><li><a href="/attributes/-/item_vehicle/bike?price=unknown">unknown</a> 43</li></ul></content>
|
124
125
|
</entry>
|
125
126
|
<entry>
|
126
127
|
<id>http://data.vast.com/attributes/category/-/item_vehicle/bike</id>
|
127
128
|
<title type='text'>SAMPLE - Category</title>
|
128
|
-
<updated>2011-03-
|
129
|
+
<updated>2011-03-21T21:14:45+01:00</updated>
|
129
130
|
<author>
|
130
131
|
<name>www.vast.com</name>
|
131
132
|
</author>
|
@@ -11,7 +11,7 @@
|
|
11
11
|
message: OK
|
12
12
|
headers:
|
13
13
|
date:
|
14
|
-
-
|
14
|
+
- Mon, 21 Mar 2011 20:15:45 GMT
|
15
15
|
server:
|
16
16
|
- Apache
|
17
17
|
x-powered-by:
|
@@ -25,17 +25,17 @@
|
|
25
25
|
age:
|
26
26
|
- "0"
|
27
27
|
expires:
|
28
|
-
-
|
28
|
+
- Mon, 21 Mar 2011 20:20:45 GMT
|
29
29
|
transfer-encoding:
|
30
30
|
- chunked
|
31
31
|
body: |
|
32
32
|
<?xml version="1.0" encoding="utf-8" standalone="no"?>
|
33
33
|
<feed xmlns="http://www.w3.org/2005/Atom" xmlns:v="http://data.vast.com/ns/categories">
|
34
34
|
<id>http://data.vast.com/categories</id>
|
35
|
-
<updated>2011-03-
|
35
|
+
<updated>2011-03-21T18:29:15+0100</updated>
|
36
36
|
<entry>
|
37
37
|
<id>http://data.vast.com/categories</id>
|
38
|
-
<updated>2011-03-
|
38
|
+
<updated>2011-03-21T18:29:15+0100</updated>
|
39
39
|
<title type="text">SAMPLE - Vast Categories</title>
|
40
40
|
<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>
|
41
41
|
<v:category count="1869094" id="jobs" name="Jobs"/>
|
@@ -301,7 +301,7 @@
|
|
301
301
|
- !ruby/struct:VCR::HTTPInteraction
|
302
302
|
request: !ruby/struct:VCR::Request
|
303
303
|
method: :get
|
304
|
-
uri: http://data.vast.com:80/listings
|
304
|
+
uri: http://data.vast.com:80/listings//-/item_vehicle/bike
|
305
305
|
body:
|
306
306
|
headers:
|
307
307
|
response: !ruby/struct:VCR::Response
|
@@ -310,7 +310,45 @@
|
|
310
310
|
message: OK
|
311
311
|
headers:
|
312
312
|
date:
|
313
|
-
-
|
313
|
+
- Mon, 21 Mar 2011 20:15:47 GMT
|
314
|
+
server:
|
315
|
+
- Apache
|
316
|
+
x-powered-by:
|
317
|
+
- PHP/5.2.14
|
318
|
+
content-type:
|
319
|
+
- text/html; charset=utf-8
|
320
|
+
accept-ranges:
|
321
|
+
- bytes
|
322
|
+
cache-control:
|
323
|
+
- private, max-age=300
|
324
|
+
age:
|
325
|
+
- "0"
|
326
|
+
expires:
|
327
|
+
- Mon, 21 Mar 2011 20:20:47 GMT
|
328
|
+
transfer-encoding:
|
329
|
+
- chunked
|
330
|
+
body: |
|
331
|
+
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
|
332
|
+
<html><head>
|
333
|
+
<title></title>
|
334
|
+
</head><body>
|
335
|
+
<h1></h1>
|
336
|
+
</body></html>
|
337
|
+
|
338
|
+
http_version: "1.1"
|
339
|
+
- !ruby/struct:VCR::HTTPInteraction
|
340
|
+
request: !ruby/struct:VCR::Request
|
341
|
+
method: :get
|
342
|
+
uri: http://data.vast.com:80/listings/555288039954342885/-/item_vehicle/bike
|
343
|
+
body:
|
344
|
+
headers:
|
345
|
+
response: !ruby/struct:VCR::Response
|
346
|
+
status: !ruby/struct:VCR::ResponseStatus
|
347
|
+
code: 200
|
348
|
+
message: OK
|
349
|
+
headers:
|
350
|
+
date:
|
351
|
+
- Mon, 21 Mar 2011 22:01:10 GMT
|
314
352
|
server:
|
315
353
|
- Apache
|
316
354
|
x-powered-by:
|
@@ -324,48 +362,48 @@
|
|
324
362
|
age:
|
325
363
|
- "0"
|
326
364
|
expires:
|
327
|
-
-
|
365
|
+
- Mon, 21 Mar 2011 22:06:10 GMT
|
328
366
|
transfer-encoding:
|
329
367
|
- chunked
|
330
368
|
body: |
|
331
369
|
<entry xmlns='http://www.w3.org/2005/Atom' xmlns:v='http://data.vast.com/ns/listings'>
|
332
|
-
<id>http://data.vast.com/listings
|
333
|
-
<updated>2011-03-
|
334
|
-
<published>2011-
|
370
|
+
<id>http://data.vast.com/listings/555288039954342885/-/item_vehicle/bike</id>
|
371
|
+
<updated>2011-03-18T09:04:04+01:00</updated>
|
372
|
+
<published>2011-02-14T09:03:26+01:00</published>
|
335
373
|
<author>
|
336
374
|
<name>www.sample.com</name>
|
337
375
|
</author>
|
338
|
-
<title type="text">SAMPLE -
|
376
|
+
<title type="text">SAMPLE - Vintage 25 Inch Univega</title>
|
339
377
|
<v:vertical>general</v:vertical>
|
340
378
|
<v:category>item_vehicle%2Cbike</v:category>
|
341
|
-
<v:item_id
|
342
|
-
<v:location precision="
|
343
|
-
<v:state>
|
344
|
-
<v:country>
|
345
|
-
<v:zip
|
379
|
+
<v:item_id>555288039954342885</v:item_id>
|
380
|
+
<v:location precision="zip">
|
381
|
+
<v:state>WA</v:state>
|
382
|
+
<v:country>United States</v:country>
|
383
|
+
<v:zip>98077</v:zip>
|
346
384
|
<v:distance>0</v:distance>
|
347
|
-
<v:city>
|
348
|
-
<v:lat precision="unknown"
|
349
|
-
<v:lon precision="unknown"
|
385
|
+
<v:city>Woodinville</v:city>
|
386
|
+
<v:lat precision="unknown">47.749870</v:lat>
|
387
|
+
<v:lon precision="unknown">-122.098319</v:lon>
|
350
388
|
<v:address></v:address>
|
351
389
|
</v:location>
|
352
390
|
<v:price type="money" symbol="$" currency="USD" value="0"/>
|
353
391
|
<v:currency type="text">USD</v:currency>
|
354
|
-
<link rel="self" type="application/atom+xml" href="http://data.vast.com/listings
|
355
|
-
<link rel="via" type="text/html" title="www.sample.com" href="http://details.vast.com/details/item_vehicle/bike/ob-
|
356
|
-
<link rel="alternate" type="text/html" title="
|
357
|
-
<link rel="http://feedback.vast.com" type="text/html" title="Report incorrect result" href="http://www.vast.com/ajax/report?id
|
392
|
+
<link rel="self" type="application/atom+xml" href="http://data.vast.com/listings/555288039954342885/-/item_vehicle/bike?apikey="/>
|
393
|
+
<link rel="via" type="text/html" title="www.sample.com" href="http://details.vast.com/details/item_vehicle/bike/ob-NzezewM0CURHmZaIMMyUBGiJ/"/>
|
394
|
+
<link rel="alternate" type="text/html" title="Vintage 25 Inch Univega" href="http://details.vast.com/details/item_vehicle/bike/ob-NzezewM0CURHmZaIMMyUBGiJ/"/>
|
395
|
+
<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="/>
|
358
396
|
<v:domain_name type="text">www.sample.com</v:domain_name>
|
359
397
|
<v:year type="number"></v:year>
|
360
|
-
<v:image_url type="image/jpeg">http://img.vast.com/128x96
|
361
|
-
<v:large_image_url type="image/jpeg">http://img.vast.com/320x240
|
362
|
-
<v:tiny_image_url type="image/jpeg">http://img.vast.com/59x44
|
398
|
+
<v:image_url type="image/jpeg">http://img.vast.com/128x96/555288039954342885</v:image_url>
|
399
|
+
<v:large_image_url type="image/jpeg">http://img.vast.com/320x240/555288039954342885</v:large_image_url>
|
400
|
+
<v:tiny_image_url type="image/jpeg">http://img.vast.com/59x44/555288039954342885</v:tiny_image_url>
|
363
401
|
<v:image_count>1</v:image_count>
|
364
402
|
<v:hasimage type="boolean">yes</v:hasimage>
|
365
403
|
<v:hosted type="boolean">no</v:hosted>
|
366
404
|
<v:hosted_type type="text">landing</v:hosted_type>
|
367
|
-
<v:description type="text">
|
368
|
-
<content type="html"><img src="http://img.vast.com/128x96
|
405
|
+
<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>
|
406
|
+
<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>
|
369
407
|
</entry>
|
370
408
|
|
371
409
|
http_version: "1.1"
|
data/test/test_vast_api.rb
CHANGED
@@ -49,15 +49,17 @@ describe VastApi do
|
|
49
49
|
|
50
50
|
it "find should raise an error if there is no category" do
|
51
51
|
bike = @listing.first
|
52
|
-
lambda {
|
52
|
+
lambda { VastApi.new.find(bike.id) }.must_raise ArgumentError
|
53
53
|
end
|
54
54
|
|
55
55
|
it "find should get a single item" do
|
56
56
|
bike = @listing.first
|
57
|
+
p bike.id
|
58
|
+
find_bike_cat = ''
|
57
59
|
VCR.use_cassette('find bike with category', :record => :new_episodes) do
|
58
|
-
find_bike_cat = @vast.find(bike.id
|
59
|
-
find_bike_cat.id.must_equal bike.id
|
60
|
+
find_bike_cat = @vast.find!(bike.id)
|
60
61
|
end
|
62
|
+
find_bike_cat.id.must_equal bike.id
|
61
63
|
end
|
62
64
|
end
|
63
65
|
|
@@ -69,7 +71,6 @@ describe VastApi do
|
|
69
71
|
end
|
70
72
|
|
71
73
|
it "should be able to fetch attributes" do
|
72
|
-
p @attributes
|
73
74
|
@attributes.size.must_be(:>, 0)
|
74
75
|
end
|
75
76
|
|
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.0.4"
|
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-21}
|
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 = [
|
@@ -27,7 +27,6 @@ Gem::Specification.new do |s|
|
|
27
27
|
"lib/vast_api.rb",
|
28
28
|
"lib/vast_api/attributes.rb",
|
29
29
|
"lib/vast_api/attributes/entry.rb",
|
30
|
-
"lib/vast_api/base.rb",
|
31
30
|
"lib/vast_api/categories.rb",
|
32
31
|
"lib/vast_api/categories/category.rb",
|
33
32
|
"lib/vast_api/listings.rb",
|
@@ -40,7 +39,7 @@ Gem::Specification.new do |s|
|
|
40
39
|
"test/test_vast_api.rb",
|
41
40
|
"vast_api.gemspec"
|
42
41
|
]
|
43
|
-
s.homepage = %q{http://github.com/
|
42
|
+
s.homepage = %q{http://github.com/carzen/vast_api}
|
44
43
|
s.licenses = ["MIT"]
|
45
44
|
s.require_paths = ["lib"]
|
46
45
|
s.rubygems_version = %q{1.6.1}
|
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.0.4
|
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-21 00:00:00 -04:00
|
15
15
|
default_executable:
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
@@ -133,7 +133,6 @@ files:
|
|
133
133
|
- lib/vast_api.rb
|
134
134
|
- lib/vast_api/attributes.rb
|
135
135
|
- lib/vast_api/attributes/entry.rb
|
136
|
-
- lib/vast_api/base.rb
|
137
136
|
- lib/vast_api/categories.rb
|
138
137
|
- lib/vast_api/categories/category.rb
|
139
138
|
- lib/vast_api/listings.rb
|
@@ -146,7 +145,7 @@ files:
|
|
146
145
|
- test/test_vast_api.rb
|
147
146
|
- vast_api.gemspec
|
148
147
|
has_rdoc: true
|
149
|
-
homepage: http://github.com/
|
148
|
+
homepage: http://github.com/carzen/vast_api
|
150
149
|
licenses:
|
151
150
|
- MIT
|
152
151
|
post_install_message:
|
@@ -159,7 +158,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
159
158
|
requirements:
|
160
159
|
- - ">="
|
161
160
|
- !ruby/object:Gem::Version
|
162
|
-
hash:
|
161
|
+
hash: 292590391515625799
|
163
162
|
segments:
|
164
163
|
- 0
|
165
164
|
version: "0"
|
data/lib/vast_api/base.rb
DELETED
@@ -1,43 +0,0 @@
|
|
1
|
-
require 'open-uri'
|
2
|
-
require 'nokogiri'
|
3
|
-
|
4
|
-
class VastApi
|
5
|
-
class Base < Array
|
6
|
-
attr_reader :xml, :url, :vast
|
7
|
-
|
8
|
-
def initialize(vast)
|
9
|
-
@vast = vast
|
10
|
-
@url = "#{API_URL}#{self.class.to_s.split('::')[1].downcase}/-/#{@vast.category}?#{@vast.query}"
|
11
|
-
@xml = Nokogiri::XML(open(@url))
|
12
|
-
populate
|
13
|
-
end
|
14
|
-
|
15
|
-
def attr(var_name)
|
16
|
-
if var = @xml.at(var_name)
|
17
|
-
var.text
|
18
|
-
elsif var = @xml.at('//v:'+var_name)
|
19
|
-
var.text
|
20
|
-
elsif var = @xml.at('//o:'+var_name)
|
21
|
-
var.text
|
22
|
-
else
|
23
|
-
nil
|
24
|
-
end
|
25
|
-
end
|
26
|
-
|
27
|
-
def attributes
|
28
|
-
@vast.attributes
|
29
|
-
end
|
30
|
-
|
31
|
-
def listings
|
32
|
-
@vast.listings
|
33
|
-
end
|
34
|
-
|
35
|
-
def categories
|
36
|
-
@vast.categories
|
37
|
-
end
|
38
|
-
private
|
39
|
-
|
40
|
-
def populate
|
41
|
-
end
|
42
|
-
end
|
43
|
-
end
|