placemaker 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile +8 -0
- data/Gemfile.lock +14 -0
- data/LICENSE +20 -0
- data/README.rdoc +76 -0
- data/Rakefile +28 -0
- data/lib/placemaker/client.rb +75 -0
- data/lib/placemaker/coordinates.rb +13 -0
- data/lib/placemaker/document.rb +44 -0
- data/lib/placemaker/extents.rb +25 -0
- data/lib/placemaker/location.rb +35 -0
- data/lib/placemaker/place_details.rb +28 -0
- data/lib/placemaker/reference.rb +34 -0
- data/lib/placemaker/xml_helper.rb +14 -0
- data/lib/placemaker/xml_parser.rb +33 -0
- data/lib/placemaker.rb +9 -0
- data/spec/fixtures/xml_rss_feed_result.xml +636 -0
- data/spec/placemaker/client_spec.rb +48 -0
- data/spec/placemaker/coordinates_spec.rb +14 -0
- data/spec/placemaker/document_spec.rb +51 -0
- data/spec/placemaker/extents_spec.rb +56 -0
- data/spec/placemaker/location_spec.rb +44 -0
- data/spec/placemaker/place_details_spec.rb +28 -0
- data/spec/placemaker/reference_spec.rb +40 -0
- data/spec/placemaker/xml_parser_spec.rb +36 -0
- data/spec/spec_helper.rb +14 -0
- metadata +130 -0
@@ -0,0 +1,636 @@
|
|
1
|
+
<?xml version="1.0" encoding="utf-8"?>
|
2
|
+
<contentlocation xmlns:yahoo="http://www.yahooapis.com/v1/base.rng" xmlns="http://wherein.yahooapis.com/v1/schema" xml:lang="en">
|
3
|
+
<processingTime>0.028125</processingTime>
|
4
|
+
<version> build 090508</version>
|
5
|
+
<documentLength>29700</documentLength>
|
6
|
+
<document>
|
7
|
+
</document>
|
8
|
+
<document>
|
9
|
+
</document>
|
10
|
+
<document>
|
11
|
+
<administrativeScope>
|
12
|
+
<woeId>2344681</woeId>
|
13
|
+
<type>State</type>
|
14
|
+
<name><![CDATA[Ciudad de Buenos Aires, AR]]></name>
|
15
|
+
<centroid>
|
16
|
+
<latitude>-34.5465</latitude>
|
17
|
+
<longitude>-58.4597</longitude>
|
18
|
+
</centroid>
|
19
|
+
</administrativeScope>
|
20
|
+
<geographicScope>
|
21
|
+
<woeId>2344681</woeId>
|
22
|
+
<type>State</type>
|
23
|
+
<name><![CDATA[Ciudad de Buenos Aires, AR]]></name>
|
24
|
+
<centroid>
|
25
|
+
<latitude>-34.5465</latitude>
|
26
|
+
<longitude>-58.4597</longitude>
|
27
|
+
</centroid>
|
28
|
+
</geographicScope>
|
29
|
+
<extents>
|
30
|
+
<center>
|
31
|
+
<latitude>-34.5545</latitude>
|
32
|
+
<longitude>-58.4691</longitude>
|
33
|
+
</center>
|
34
|
+
<southWest>
|
35
|
+
<latitude>-34.6944</latitude>
|
36
|
+
<longitude>-58.6389</longitude>
|
37
|
+
</southWest>
|
38
|
+
<northEast>
|
39
|
+
<latitude>-34.4146</latitude>
|
40
|
+
<longitude>-58.2992</longitude>
|
41
|
+
</northEast>
|
42
|
+
</extents>
|
43
|
+
<placeDetails>
|
44
|
+
<place>
|
45
|
+
<woeId>468739</woeId>
|
46
|
+
<type>Town</type>
|
47
|
+
<name><![CDATA[Buenos Aires, Ciudad de Buenos Aires, AR]]></name>
|
48
|
+
<centroid>
|
49
|
+
<latitude>-34.5545</latitude>
|
50
|
+
<longitude>-58.4691</longitude>
|
51
|
+
</centroid>
|
52
|
+
</place>
|
53
|
+
<matchType>0</matchType>
|
54
|
+
<weight>10</weight>
|
55
|
+
<confidence>5</confidence>
|
56
|
+
</placeDetails>
|
57
|
+
<referenceList>
|
58
|
+
<reference>
|
59
|
+
<woeIds>468739</woeIds>
|
60
|
+
<start>22</start>
|
61
|
+
<end>34</end>
|
62
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
63
|
+
<text><![CDATA[Buenos Aires]]></text>
|
64
|
+
<type>xpathwithcounts</type>
|
65
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[3]/title[1]]]></xpath>
|
66
|
+
</reference>
|
67
|
+
</referenceList>
|
68
|
+
</document>
|
69
|
+
<document>
|
70
|
+
</document>
|
71
|
+
<document>
|
72
|
+
<administrativeScope>
|
73
|
+
<woeId>2461487</woeId>
|
74
|
+
<type>Town</type>
|
75
|
+
<name><![CDATA[North Pole, AK, US]]></name>
|
76
|
+
<centroid>
|
77
|
+
<latitude>64.7491</latitude>
|
78
|
+
<longitude>-147.353</longitude>
|
79
|
+
</centroid>
|
80
|
+
</administrativeScope>
|
81
|
+
<geographicScope>
|
82
|
+
<woeId>2461487</woeId>
|
83
|
+
<type>Town</type>
|
84
|
+
<name><![CDATA[North Pole, AK, US]]></name>
|
85
|
+
<centroid>
|
86
|
+
<latitude>64.7491</latitude>
|
87
|
+
<longitude>-147.353</longitude>
|
88
|
+
</centroid>
|
89
|
+
</geographicScope>
|
90
|
+
<extents>
|
91
|
+
<center>
|
92
|
+
<latitude>64.7491</latitude>
|
93
|
+
<longitude>-147.353</longitude>
|
94
|
+
</center>
|
95
|
+
<southWest>
|
96
|
+
<latitude>64.726</latitude>
|
97
|
+
<longitude>-147.428</longitude>
|
98
|
+
</southWest>
|
99
|
+
<northEast>
|
100
|
+
<latitude>64.7778</latitude>
|
101
|
+
<longitude>-147.304</longitude>
|
102
|
+
</northEast>
|
103
|
+
</extents>
|
104
|
+
<placeDetails>
|
105
|
+
<place>
|
106
|
+
<woeId>2461487</woeId>
|
107
|
+
<type>Town</type>
|
108
|
+
<name><![CDATA[North Pole, AK, US]]></name>
|
109
|
+
<centroid>
|
110
|
+
<latitude>64.7491</latitude>
|
111
|
+
<longitude>-147.353</longitude>
|
112
|
+
</centroid>
|
113
|
+
</place>
|
114
|
+
<matchType>0</matchType>
|
115
|
+
<weight>1</weight>
|
116
|
+
<confidence>4</confidence>
|
117
|
+
</placeDetails>
|
118
|
+
<referenceList>
|
119
|
+
<reference>
|
120
|
+
<woeIds>2461487</woeIds>
|
121
|
+
<start>900</start>
|
122
|
+
<end>910</end>
|
123
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
124
|
+
<text><![CDATA[North Pole]]></text>
|
125
|
+
<type>xpathwithcounts</type>
|
126
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[5]/description[1]]]></xpath>
|
127
|
+
</reference>
|
128
|
+
</referenceList>
|
129
|
+
</document>
|
130
|
+
<document>
|
131
|
+
<administrativeScope>
|
132
|
+
<woeId>23424977</woeId>
|
133
|
+
<type>Country</type>
|
134
|
+
<name><![CDATA[United States]]></name>
|
135
|
+
<centroid>
|
136
|
+
<latitude>48.8907</latitude>
|
137
|
+
<longitude>-116.982</longitude>
|
138
|
+
</centroid>
|
139
|
+
</administrativeScope>
|
140
|
+
<geographicScope>
|
141
|
+
<woeId>24875662</woeId>
|
142
|
+
<type>Colloquial</type>
|
143
|
+
<name><![CDATA[Continental United States, US]]></name>
|
144
|
+
<centroid>
|
145
|
+
<latitude>37.1669</latitude>
|
146
|
+
<longitude>-95.9669</longitude>
|
147
|
+
</centroid>
|
148
|
+
</geographicScope>
|
149
|
+
<extents>
|
150
|
+
<center>
|
151
|
+
<latitude>38.8913</latitude>
|
152
|
+
<longitude>-77.0337</longitude>
|
153
|
+
</center>
|
154
|
+
<southWest>
|
155
|
+
<latitude>18.9108</latitude>
|
156
|
+
<longitude>-167.276</longitude>
|
157
|
+
</southWest>
|
158
|
+
<northEast>
|
159
|
+
<latitude>72.8961</latitude>
|
160
|
+
<longitude>-66.6879</longitude>
|
161
|
+
</northEast>
|
162
|
+
</extents>
|
163
|
+
<placeDetails>
|
164
|
+
<place>
|
165
|
+
<woeId>2442047</woeId>
|
166
|
+
<type>Town</type>
|
167
|
+
<name><![CDATA[Los Angeles, CA, US]]></name>
|
168
|
+
<centroid>
|
169
|
+
<latitude>34.0533</latitude>
|
170
|
+
<longitude>-118.245</longitude>
|
171
|
+
</centroid>
|
172
|
+
</place>
|
173
|
+
<matchType>0</matchType>
|
174
|
+
<weight>1</weight>
|
175
|
+
<confidence>9</confidence>
|
176
|
+
</placeDetails>
|
177
|
+
<placeDetails>
|
178
|
+
<place>
|
179
|
+
<woeId>2459115</woeId>
|
180
|
+
<type>Town</type>
|
181
|
+
<name><![CDATA[New York, NY, US]]></name>
|
182
|
+
<centroid>
|
183
|
+
<latitude>40.7145</latitude>
|
184
|
+
<longitude>-74.0071</longitude>
|
185
|
+
</centroid>
|
186
|
+
</place>
|
187
|
+
<matchType>0</matchType>
|
188
|
+
<weight>1</weight>
|
189
|
+
<confidence>9</confidence>
|
190
|
+
</placeDetails>
|
191
|
+
<placeDetails>
|
192
|
+
<place>
|
193
|
+
<woeId>2514815</woeId>
|
194
|
+
<type>Town</type>
|
195
|
+
<name><![CDATA[Washington, DC, US]]></name>
|
196
|
+
<centroid>
|
197
|
+
<latitude>38.8913</latitude>
|
198
|
+
<longitude>-77.0337</longitude>
|
199
|
+
</centroid>
|
200
|
+
</place>
|
201
|
+
<matchType>0</matchType>
|
202
|
+
<weight>1</weight>
|
203
|
+
<confidence>9</confidence>
|
204
|
+
</placeDetails>
|
205
|
+
<placeDetails>
|
206
|
+
<place>
|
207
|
+
<woeId>23424977</woeId>
|
208
|
+
<type>Country</type>
|
209
|
+
<name><![CDATA[United States]]></name>
|
210
|
+
<centroid>
|
211
|
+
<latitude>48.8907</latitude>
|
212
|
+
<longitude>-116.982</longitude>
|
213
|
+
</centroid>
|
214
|
+
</place>
|
215
|
+
<matchType>0</matchType>
|
216
|
+
<weight>1</weight>
|
217
|
+
<confidence>9</confidence>
|
218
|
+
</placeDetails>
|
219
|
+
<referenceList>
|
220
|
+
<reference>
|
221
|
+
<woeIds>23424977</woeIds>
|
222
|
+
<start>1997</start>
|
223
|
+
<end>2004</end>
|
224
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
225
|
+
<text><![CDATA[America]]></text>
|
226
|
+
<type>xpathwithcounts</type>
|
227
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[6]/description[1]]]></xpath>
|
228
|
+
</reference>
|
229
|
+
<reference>
|
230
|
+
<woeIds>2514815</woeIds>
|
231
|
+
<start>3315</start>
|
232
|
+
<end>3325</end>
|
233
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
234
|
+
<text><![CDATA[Washington]]></text>
|
235
|
+
<type>xpathwithcounts</type>
|
236
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[6]/description[1]]]></xpath>
|
237
|
+
</reference>
|
238
|
+
<reference>
|
239
|
+
<woeIds>2514815</woeIds>
|
240
|
+
<start>521</start>
|
241
|
+
<end>534</end>
|
242
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
243
|
+
<text><![CDATA[Washington DC]]></text>
|
244
|
+
<type>xpathwithcounts</type>
|
245
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[6]/description[1]]]></xpath>
|
246
|
+
</reference>
|
247
|
+
<reference>
|
248
|
+
<woeIds>2459115</woeIds>
|
249
|
+
<start>634</start>
|
250
|
+
<end>642</end>
|
251
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
252
|
+
<text><![CDATA[New York]]></text>
|
253
|
+
<type>xpathwithcounts</type>
|
254
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[6]/description[1]]]></xpath>
|
255
|
+
</reference>
|
256
|
+
<reference>
|
257
|
+
<woeIds>2442047</woeIds>
|
258
|
+
<start>938</start>
|
259
|
+
<end>949</end>
|
260
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
261
|
+
<text><![CDATA[Los Angeles]]></text>
|
262
|
+
<type>xpathwithcounts</type>
|
263
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[6]/description[1]]]></xpath>
|
264
|
+
</reference>
|
265
|
+
</referenceList>
|
266
|
+
</document>
|
267
|
+
<document>
|
268
|
+
<administrativeScope>
|
269
|
+
<woeId>2346016</woeId>
|
270
|
+
<type>State</type>
|
271
|
+
<name><![CDATA[Bayrut, LB]]></name>
|
272
|
+
<centroid>
|
273
|
+
<latitude>33.8881</latitude>
|
274
|
+
<longitude>35.5139</longitude>
|
275
|
+
</centroid>
|
276
|
+
</administrativeScope>
|
277
|
+
<geographicScope>
|
278
|
+
<woeId>2346016</woeId>
|
279
|
+
<type>State</type>
|
280
|
+
<name><![CDATA[Bayrut, LB]]></name>
|
281
|
+
<centroid>
|
282
|
+
<latitude>33.8881</latitude>
|
283
|
+
<longitude>35.5139</longitude>
|
284
|
+
</centroid>
|
285
|
+
</geographicScope>
|
286
|
+
<extents>
|
287
|
+
<center>
|
288
|
+
<latitude>33.8927</latitude>
|
289
|
+
<longitude>35.4853</longitude>
|
290
|
+
</center>
|
291
|
+
<southWest>
|
292
|
+
<latitude>33.8562</latitude>
|
293
|
+
<longitude>35.467</longitude>
|
294
|
+
</southWest>
|
295
|
+
<northEast>
|
296
|
+
<latitude>33.9073</latitude>
|
297
|
+
<longitude>35.5751</longitude>
|
298
|
+
</northEast>
|
299
|
+
</extents>
|
300
|
+
<placeDetails>
|
301
|
+
<place>
|
302
|
+
<woeId>1960307</woeId>
|
303
|
+
<type>Town</type>
|
304
|
+
<name><![CDATA[Beirut, Bayrut, LB]]></name>
|
305
|
+
<centroid>
|
306
|
+
<latitude>33.8927</latitude>
|
307
|
+
<longitude>35.4853</longitude>
|
308
|
+
</centroid>
|
309
|
+
</place>
|
310
|
+
<matchType>0</matchType>
|
311
|
+
<weight>1</weight>
|
312
|
+
<confidence>9</confidence>
|
313
|
+
</placeDetails>
|
314
|
+
<referenceList>
|
315
|
+
<reference>
|
316
|
+
<woeIds>1960307</woeIds>
|
317
|
+
<start>396</start>
|
318
|
+
<end>402</end>
|
319
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
320
|
+
<text><![CDATA[Beirut]]></text>
|
321
|
+
<type>xpathwithcounts</type>
|
322
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[7]/description[1]]]></xpath>
|
323
|
+
</reference>
|
324
|
+
</referenceList>
|
325
|
+
</document>
|
326
|
+
<document>
|
327
|
+
<administrativeScope>
|
328
|
+
<woeId>2459115</woeId>
|
329
|
+
<type>Town</type>
|
330
|
+
<name><![CDATA[New York, NY, US]]></name>
|
331
|
+
<centroid>
|
332
|
+
<latitude>40.7145</latitude>
|
333
|
+
<longitude>-74.0071</longitude>
|
334
|
+
</centroid>
|
335
|
+
</administrativeScope>
|
336
|
+
<geographicScope>
|
337
|
+
<woeId>24701780</woeId>
|
338
|
+
<type>Zone</type>
|
339
|
+
<name><![CDATA[646 New York, NY, US]]></name>
|
340
|
+
<centroid>
|
341
|
+
<latitude>40.791</latitude>
|
342
|
+
<longitude>-73.9659</longitude>
|
343
|
+
</centroid>
|
344
|
+
</geographicScope>
|
345
|
+
<extents>
|
346
|
+
<center>
|
347
|
+
<latitude>40.791</latitude>
|
348
|
+
<longitude>-73.9659</longitude>
|
349
|
+
</center>
|
350
|
+
<southWest>
|
351
|
+
<latitude>40.6838</latitude>
|
352
|
+
<longitude>-74.0477</longitude>
|
353
|
+
</southWest>
|
354
|
+
<northEast>
|
355
|
+
<latitude>40.8819</latitude>
|
356
|
+
<longitude>-73.9067</longitude>
|
357
|
+
</northEast>
|
358
|
+
</extents>
|
359
|
+
<placeDetails>
|
360
|
+
<place>
|
361
|
+
<woeId>12589342</woeId>
|
362
|
+
<type>County</type>
|
363
|
+
<name><![CDATA[Manhattan, New York, NY, US]]></name>
|
364
|
+
<centroid>
|
365
|
+
<latitude>40.791</latitude>
|
366
|
+
<longitude>-73.9659</longitude>
|
367
|
+
</centroid>
|
368
|
+
</place>
|
369
|
+
<matchType>0</matchType>
|
370
|
+
<weight>1</weight>
|
371
|
+
<confidence>8</confidence>
|
372
|
+
</placeDetails>
|
373
|
+
<referenceList>
|
374
|
+
<reference>
|
375
|
+
<woeIds>12589342</woeIds>
|
376
|
+
<start>1939</start>
|
377
|
+
<end>1948</end>
|
378
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
379
|
+
<text><![CDATA[Manhattan]]></text>
|
380
|
+
<type>xpathwithcounts</type>
|
381
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[8]/description[1]]]></xpath>
|
382
|
+
</reference>
|
383
|
+
</referenceList>
|
384
|
+
</document>
|
385
|
+
<document>
|
386
|
+
</document>
|
387
|
+
<document>
|
388
|
+
<administrativeScope>
|
389
|
+
<woeId>1968212</woeId>
|
390
|
+
<type>Town</type>
|
391
|
+
<name><![CDATA[Tel Aviv, Tel Aviv, IL]]></name>
|
392
|
+
<centroid>
|
393
|
+
<latitude>32.0451</latitude>
|
394
|
+
<longitude>34.7697</longitude>
|
395
|
+
</centroid>
|
396
|
+
</administrativeScope>
|
397
|
+
<geographicScope>
|
398
|
+
<woeId>1968212</woeId>
|
399
|
+
<type>Town</type>
|
400
|
+
<name><![CDATA[Tel Aviv, Tel Aviv, IL]]></name>
|
401
|
+
<centroid>
|
402
|
+
<latitude>32.0451</latitude>
|
403
|
+
<longitude>34.7697</longitude>
|
404
|
+
</centroid>
|
405
|
+
</geographicScope>
|
406
|
+
<extents>
|
407
|
+
<center>
|
408
|
+
<latitude>32.0451</latitude>
|
409
|
+
<longitude>34.7697</longitude>
|
410
|
+
</center>
|
411
|
+
<southWest>
|
412
|
+
<latitude>32.0312</latitude>
|
413
|
+
<longitude>34.7413</longitude>
|
414
|
+
</southWest>
|
415
|
+
<northEast>
|
416
|
+
<latitude>32.146</latitude>
|
417
|
+
<longitude>34.8533</longitude>
|
418
|
+
</northEast>
|
419
|
+
</extents>
|
420
|
+
<placeDetails>
|
421
|
+
<place>
|
422
|
+
<woeId>1968212</woeId>
|
423
|
+
<type>Town</type>
|
424
|
+
<name><![CDATA[Tel Aviv, Tel Aviv, IL]]></name>
|
425
|
+
<centroid>
|
426
|
+
<latitude>32.0451</latitude>
|
427
|
+
<longitude>34.7697</longitude>
|
428
|
+
</centroid>
|
429
|
+
</place>
|
430
|
+
<matchType>0</matchType>
|
431
|
+
<weight>10</weight>
|
432
|
+
<confidence>9</confidence>
|
433
|
+
</placeDetails>
|
434
|
+
<referenceList>
|
435
|
+
<reference>
|
436
|
+
<woeIds>1968212</woeIds>
|
437
|
+
<start>108</start>
|
438
|
+
<end>118</end>
|
439
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
440
|
+
<text><![CDATA[Tel Aviv's]]></text>
|
441
|
+
<type>xpathwithcounts</type>
|
442
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[10]/description[1]]]></xpath>
|
443
|
+
</reference>
|
444
|
+
<reference>
|
445
|
+
<woeIds>1968212</woeIds>
|
446
|
+
<start>16</start>
|
447
|
+
<end>26</end>
|
448
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
449
|
+
<text><![CDATA[Tel Aviv's]]></text>
|
450
|
+
<type>xpathwithcounts</type>
|
451
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[10]/title[1]]]></xpath>
|
452
|
+
</reference>
|
453
|
+
</referenceList>
|
454
|
+
</document>
|
455
|
+
<document>
|
456
|
+
<administrativeScope>
|
457
|
+
<woeId>23424925</woeId>
|
458
|
+
<type>Country</type>
|
459
|
+
<name><![CDATA[Portugal]]></name>
|
460
|
+
<centroid>
|
461
|
+
<latitude>39.566</latitude>
|
462
|
+
<longitude>-7.84516</longitude>
|
463
|
+
</centroid>
|
464
|
+
</administrativeScope>
|
465
|
+
<geographicScope>
|
466
|
+
<woeId>23424925</woeId>
|
467
|
+
<type>Country</type>
|
468
|
+
<name><![CDATA[Portugal]]></name>
|
469
|
+
<centroid>
|
470
|
+
<latitude>39.566</latitude>
|
471
|
+
<longitude>-7.84516</longitude>
|
472
|
+
</centroid>
|
473
|
+
</geographicScope>
|
474
|
+
<extents>
|
475
|
+
<center>
|
476
|
+
<latitude>39.566</latitude>
|
477
|
+
<longitude>-7.84516</longitude>
|
478
|
+
</center>
|
479
|
+
<southWest>
|
480
|
+
<latitude>30.0329</latitude>
|
481
|
+
<longitude>-31.266</longitude>
|
482
|
+
</southWest>
|
483
|
+
<northEast>
|
484
|
+
<latitude>42.1542</latitude>
|
485
|
+
<longitude>-6.19021</longitude>
|
486
|
+
</northEast>
|
487
|
+
</extents>
|
488
|
+
<placeDetails>
|
489
|
+
<place>
|
490
|
+
<woeId>23424925</woeId>
|
491
|
+
<type>Country</type>
|
492
|
+
<name><![CDATA[Portugal]]></name>
|
493
|
+
<centroid>
|
494
|
+
<latitude>39.566</latitude>
|
495
|
+
<longitude>-7.84516</longitude>
|
496
|
+
</centroid>
|
497
|
+
</place>
|
498
|
+
<matchType>0</matchType>
|
499
|
+
<weight>1</weight>
|
500
|
+
<confidence>8</confidence>
|
501
|
+
</placeDetails>
|
502
|
+
<referenceList>
|
503
|
+
<reference>
|
504
|
+
<woeIds>23424925</woeIds>
|
505
|
+
<start>598</start>
|
506
|
+
<end>606</end>
|
507
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
508
|
+
<text><![CDATA[Portugal]]></text>
|
509
|
+
<type>xpathwithcounts</type>
|
510
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[11]/description[1]]]></xpath>
|
511
|
+
</reference>
|
512
|
+
</referenceList>
|
513
|
+
</document>
|
514
|
+
<document>
|
515
|
+
<administrativeScope>
|
516
|
+
<woeId>761570</woeId>
|
517
|
+
<type>Town</type>
|
518
|
+
<name><![CDATA[Gijon, Asturias, ES]]></name>
|
519
|
+
<centroid>
|
520
|
+
<latitude>43.542</latitude>
|
521
|
+
<longitude>-5.6638</longitude>
|
522
|
+
</centroid>
|
523
|
+
</administrativeScope>
|
524
|
+
<geographicScope>
|
525
|
+
<woeId>761570</woeId>
|
526
|
+
<type>Town</type>
|
527
|
+
<name><![CDATA[Gijon, Asturias, ES]]></name>
|
528
|
+
<centroid>
|
529
|
+
<latitude>43.542</latitude>
|
530
|
+
<longitude>-5.6638</longitude>
|
531
|
+
</centroid>
|
532
|
+
</geographicScope>
|
533
|
+
<extents>
|
534
|
+
<center>
|
535
|
+
<latitude>43.542</latitude>
|
536
|
+
<longitude>-5.6638</longitude>
|
537
|
+
</center>
|
538
|
+
<southWest>
|
539
|
+
<latitude>43.495</latitude>
|
540
|
+
<longitude>-5.75073</longitude>
|
541
|
+
</southWest>
|
542
|
+
<northEast>
|
543
|
+
<latitude>43.571</latitude>
|
544
|
+
<longitude>-5.60209</longitude>
|
545
|
+
</northEast>
|
546
|
+
</extents>
|
547
|
+
<placeDetails>
|
548
|
+
<place>
|
549
|
+
<woeId>761570</woeId>
|
550
|
+
<type>Town</type>
|
551
|
+
<name><![CDATA[Gijon, Asturias, ES]]></name>
|
552
|
+
<centroid>
|
553
|
+
<latitude>43.542</latitude>
|
554
|
+
<longitude>-5.6638</longitude>
|
555
|
+
</centroid>
|
556
|
+
</place>
|
557
|
+
<matchType>0</matchType>
|
558
|
+
<weight>10</weight>
|
559
|
+
<confidence>10</confidence>
|
560
|
+
</placeDetails>
|
561
|
+
<referenceList>
|
562
|
+
<reference>
|
563
|
+
<woeIds>761570</woeIds>
|
564
|
+
<start>28</start>
|
565
|
+
<end>40</end>
|
566
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
567
|
+
<text><![CDATA[Gijon, Spain]]></text>
|
568
|
+
<type>xpathwithcounts</type>
|
569
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[12]/title[1]]]></xpath>
|
570
|
+
</reference>
|
571
|
+
</referenceList>
|
572
|
+
</document>
|
573
|
+
<document>
|
574
|
+
</document>
|
575
|
+
<document>
|
576
|
+
</document>
|
577
|
+
<document>
|
578
|
+
<administrativeScope>
|
579
|
+
<woeId>2459115</woeId>
|
580
|
+
<type>Town</type>
|
581
|
+
<name><![CDATA[New York, NY, US]]></name>
|
582
|
+
<centroid>
|
583
|
+
<latitude>40.7145</latitude>
|
584
|
+
<longitude>-74.0071</longitude>
|
585
|
+
</centroid>
|
586
|
+
</administrativeScope>
|
587
|
+
<geographicScope>
|
588
|
+
<woeId>24701780</woeId>
|
589
|
+
<type>Zone</type>
|
590
|
+
<name><![CDATA[646 New York, NY, US]]></name>
|
591
|
+
<centroid>
|
592
|
+
<latitude>40.791</latitude>
|
593
|
+
<longitude>-73.9659</longitude>
|
594
|
+
</centroid>
|
595
|
+
</geographicScope>
|
596
|
+
<extents>
|
597
|
+
<center>
|
598
|
+
<latitude>40.7145</latitude>
|
599
|
+
<longitude>-74.0071</longitude>
|
600
|
+
</center>
|
601
|
+
<southWest>
|
602
|
+
<latitude>40.4957</latitude>
|
603
|
+
<longitude>-74.2557</longitude>
|
604
|
+
</southWest>
|
605
|
+
<northEast>
|
606
|
+
<latitude>40.9176</latitude>
|
607
|
+
<longitude>-73.7004</longitude>
|
608
|
+
</northEast>
|
609
|
+
</extents>
|
610
|
+
<placeDetails>
|
611
|
+
<place>
|
612
|
+
<woeId>2459115</woeId>
|
613
|
+
<type>Town</type>
|
614
|
+
<name><![CDATA[New York, NY, US]]></name>
|
615
|
+
<centroid>
|
616
|
+
<latitude>40.7145</latitude>
|
617
|
+
<longitude>-74.0071</longitude>
|
618
|
+
</centroid>
|
619
|
+
</place>
|
620
|
+
<matchType>0</matchType>
|
621
|
+
<weight>1</weight>
|
622
|
+
<confidence>7</confidence>
|
623
|
+
</placeDetails>
|
624
|
+
<referenceList>
|
625
|
+
<reference>
|
626
|
+
<woeIds>2459115</woeIds>
|
627
|
+
<start>197</start>
|
628
|
+
<end>205</end>
|
629
|
+
<isPlaintextMarker>0</isPlaintextMarker>
|
630
|
+
<text><![CDATA[New York]]></text>
|
631
|
+
<type>xpathwithcounts</type>
|
632
|
+
<xpath><![CDATA[/rss[1]/channel[1]/item[15]/description[1]]]></xpath>
|
633
|
+
</reference>
|
634
|
+
</referenceList>
|
635
|
+
</document>
|
636
|
+
</contentlocation>
|
@@ -0,0 +1,48 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Placemaker::Client do
|
4
|
+
before do
|
5
|
+
@valid_opts = {
|
6
|
+
:document_url => 'http://www.example.com',
|
7
|
+
:document_type => 'text/plain'
|
8
|
+
}
|
9
|
+
end
|
10
|
+
|
11
|
+
describe "object initialization" do
|
12
|
+
it "should set appid to the value of ENV['PLACEMAKER_APPID']" do
|
13
|
+
ENV['PLACEMAKER_APPID'] = 'foo'
|
14
|
+
p = Placemaker::Client.new(@valid_opts)
|
15
|
+
p.appid.should == 'foo'
|
16
|
+
end
|
17
|
+
|
18
|
+
it "should initialize #documents to an empty array" do
|
19
|
+
p = Placemaker::Client.new(@valid_opts)
|
20
|
+
p.documents.should be_a(Array)
|
21
|
+
p.documents.should be_empty
|
22
|
+
end
|
23
|
+
|
24
|
+
it "should raise an argument error if the document_type is not correctly set" do
|
25
|
+
@valid_opts.delete(:document_type)
|
26
|
+
lambda {
|
27
|
+
Placemaker::Client.new(@valid_opts)
|
28
|
+
}.should raise_error(ArgumentError)
|
29
|
+
end
|
30
|
+
|
31
|
+
it "should set the appid to the value of options[:appid] if provided" do
|
32
|
+
ENV['PLACEMAKER_APPID'] = 'foo'
|
33
|
+
p = Placemaker::Client.new(@valid_opts.merge(:appid => 'fark', :document_url => 'foo'))
|
34
|
+
p.appid.should == 'fark'
|
35
|
+
end
|
36
|
+
|
37
|
+
it "should create methods to allow access to configuration parameters" do
|
38
|
+
p = Placemaker::Client.new(@valid_opts.merge(:document_content => 'foo'))
|
39
|
+
p.document_content.should == 'foo'
|
40
|
+
end
|
41
|
+
|
42
|
+
it "should raise an error if both document_content and document_url are nil" do
|
43
|
+
lambda {
|
44
|
+
p = Placemaker::Client.new
|
45
|
+
}.should raise_error(ArgumentError)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
require 'spec_helper'
|
2
|
+
|
3
|
+
describe Placemaker::Coordinates do
|
4
|
+
before do
|
5
|
+
@xml_str = File.read(File.join(File.dirname(__FILE__), %w[.. fixtures xml_rss_feed_result.xml]))
|
6
|
+
@xmlp = Placemaker::XmlParser.new(@xml_str)
|
7
|
+
@doc = @xmlp.documents[5]
|
8
|
+
@coords = @doc.place_details.first.place.centroid
|
9
|
+
end
|
10
|
+
|
11
|
+
it "should be a Placemaker::Coordinates object" do
|
12
|
+
@coords.should be_a(Placemaker::Coordinates)
|
13
|
+
end
|
14
|
+
end
|