simplegeo 0.0.3 → 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,36 @@
1
+ {
2
+ "geometry": {
3
+ "type": "Polygon",
4
+ "coordinates": [
5
+ [
6
+ 37.7587890625,
7
+ -122.4267578125
8
+ ],
9
+ [
10
+ 37.759765625,
11
+ -122.4267578125
12
+ ],
13
+ [
14
+ 37.759765625,
15
+ -122.42578125
16
+ ],
17
+ [
18
+ 37.7587890625,
19
+ -122.42578125
20
+ ],
21
+ [
22
+ 37.7587890625,
23
+ -122.4267578125
24
+ ]
25
+ ]
26
+ },
27
+ "type": "Feature",
28
+ "properties": {
29
+ "hour": 16,
30
+ "trending_rank": 0,
31
+ "local_rank": 8,
32
+ "city_rank": 10,
33
+ "worldwide_rank": 8,
34
+ "dayname": "sat"
35
+ }
36
+ }
@@ -0,0 +1,13 @@
1
+ {
2
+ "type": "GeometryCollection",
3
+ "geometries": [
4
+ {
5
+ "type": "Point",
6
+ "coordinates": [
7
+ -122.42608,
8
+ 37.759650000000001
9
+ ],
10
+ "created": 1269832510
11
+ }
12
+ ]
13
+ }
@@ -0,0 +1,84 @@
1
+ {
2
+ "next_cursor": "QVSEifz7gri4J0w8FSQJ06Z5S5lOw6gZ75Co-fBbBQJEr7XMqN32bjMKNc9kwLKqKyqtVvxR_t5hgWW6XDgPnPTY",
3
+ "type": "FeatureCollection",
4
+ "features": [
5
+ {
6
+ "distance": 0,
7
+ "created": 1269832510,
8
+ "geometry": {
9
+ "type": "Point",
10
+ "coordinates": [
11
+ -122.42608,
12
+ 37.759650000000001
13
+ ]
14
+ },
15
+ "id": "5373629",
16
+ "layerLink": {
17
+ "href": "http://api.simplegeo.com/0.1/layer/com.simplegeo.global.geonames.json"
18
+ },
19
+ "type": "Feature",
20
+ "properties": {
21
+ "layer": "com.simplegeo.global.geonames",
22
+ "elevation": "22",
23
+ "gtopo30": "60",
24
+ "feature_code": "PRK",
25
+ "last_modified": "2006-01-15",
26
+ "country_code": "US",
27
+ "alternatenames": "",
28
+ "timezone": "America/Los_Angeles",
29
+ "population": "0",
30
+ "name": "Mission Dolores Park",
31
+ "feature_class": "L",
32
+ "cc2": "",
33
+ "admin1": "CA",
34
+ "admin3": "",
35
+ "admin2": "075",
36
+ "admin4": "",
37
+ "asciiname": "Mission Dolores Park",
38
+ "type": "place"
39
+ },
40
+ "selfLink": {
41
+ "href": "http://api.simplegeo.com/0.1/records/com.simplegeo.global.geonames/5373629.json"
42
+ }
43
+ },
44
+ {
45
+ "distance": 57.557068918956581,
46
+ "created": 1269832039,
47
+ "geometry": {
48
+ "type": "Point",
49
+ "coordinates": [
50
+ -122.42552999999999,
51
+ 37.759369999999997
52
+ ]
53
+ },
54
+ "id": "5352852",
55
+ "layerLink": {
56
+ "href": "http://api.simplegeo.com/0.1/layer/com.simplegeo.global.geonames.json"
57
+ },
58
+ "type": "Feature",
59
+ "properties": {
60
+ "layer": "com.simplegeo.global.geonames",
61
+ "elevation": "23",
62
+ "gtopo30": "60",
63
+ "feature_code": "CH",
64
+ "last_modified": "2006-01-15",
65
+ "country_code": "US",
66
+ "alternatenames": "",
67
+ "timezone": "America/Los_Angeles",
68
+ "population": "0",
69
+ "name": "Golden Gate Lutheran Church",
70
+ "feature_class": "S",
71
+ "cc2": "",
72
+ "admin1": "CA",
73
+ "admin3": "",
74
+ "admin2": "075",
75
+ "admin4": "",
76
+ "asciiname": "Golden Gate Lutheran Church",
77
+ "type": "place"
78
+ },
79
+ "selfLink": {
80
+ "href": "http://api.simplegeo.com/0.1/records/com.simplegeo.global.geonames/5352852.json"
81
+ }
82
+ }
83
+ ]
84
+ }
@@ -0,0 +1,38 @@
1
+ {
2
+ "type": "Feature",
3
+ "id": "5373629",
4
+ "created": 1269832510,
5
+ "geometry": {
6
+ "type": "Point",
7
+ "coordinates": [
8
+ -122.42608,
9
+ 37.759650000000001
10
+ ]
11
+ },
12
+ "properties": {
13
+ "layer": "com.simplegeo.global.geonames",
14
+ "elevation": "22",
15
+ "gtopo30": "60",
16
+ "feature_code": "PRK",
17
+ "last_modified": "2006-01-15",
18
+ "country_code": "US",
19
+ "alternatenames": "",
20
+ "timezone": "America/Los_Angeles",
21
+ "population": "0",
22
+ "name": "Mission Dolores Park",
23
+ "feature_class": "L",
24
+ "cc2": "",
25
+ "admin1": "CA",
26
+ "admin3": "",
27
+ "admin2": "075",
28
+ "admin4": "",
29
+ "asciiname": "Mission Dolores Park",
30
+ "type": "place"
31
+ },
32
+ "layerLink": {
33
+ "href": "http://api.simplegeo.com/0.1/layer/com.simplegeo.global.geonames.json"
34
+ },
35
+ "selfLink": {
36
+ "href": "http://api.simplegeo.com/0.1/records/com.simplegeo.global.geonames/5373629.json"
37
+ }
38
+ }
@@ -0,0 +1,197 @@
1
+ {
2
+ "type": "FeatureCollection",
3
+ "features": [
4
+ {
5
+ "created": 1271985142,
6
+ "geometry": {
7
+ "type": "Point",
8
+ "coordinates": [
9
+ -122.419043,
10
+ 37.760350000000003
11
+ ]
12
+ },
13
+ "id": "41530629",
14
+ "layerLink": {
15
+ "href": "http://api.simplegeo.com/0.1/layer/com.simplegeo.us.business.json"
16
+ },
17
+ "type": "Feature",
18
+ "properties": {
19
+ "carrier_route": "C036",
20
+ "pubdate": "2009-12-01",
21
+ "ll_match_level": "R",
22
+ "street_name": "Mission",
23
+ "std_name": "Beauty Bar",
24
+ "val_flag": "C",
25
+ "census_block_id": "002",
26
+ "company_headings": [
27
+ {
28
+ "normalized_id": "138001000",
29
+ "condensed_name": "BARS GRILLS & PUBS",
30
+ "condensed_id": "138001000",
31
+ "normalized_name": "BARS GRILLS & PUBS",
32
+ "category_id": "138000000",
33
+ "category_name": "Bars, Taverns & Cocktail Lounges"
34
+ }
35
+ ],
36
+ "company_sics": [
37
+ {
38
+ "sic_4": "7231",
39
+ "relevancy": "1",
40
+ "description": "BEAUTY SHOPS",
41
+ "naics": "812112",
42
+ "sic": "72310000",
43
+ "industry_class": "7",
44
+ "sic_4_description": "BEAUTY SHOPS",
45
+ "naics_description": "BEAUTY SALONS"
46
+ },
47
+ {
48
+ "sic_4": "5813",
49
+ "relevancy": "2",
50
+ "description": "BAR (DRINKING PLACES)",
51
+ "naics": "72241",
52
+ "sic": "58130101",
53
+ "industry_class": "5",
54
+ "sic_4_description": "DRINKING PLACES",
55
+ "naics_description": "DRINKING PLACES (ALCOHOLIC BEVERAGES)"
56
+ },
57
+ {
58
+ "sic_4": "5812",
59
+ "relevancy": "3",
60
+ "description": "GRILLS, ( EATING PLACES)",
61
+ "naics": "722211",
62
+ "sic": "58120310",
63
+ "industry_class": "5",
64
+ "sic_4_description": "EATING PLACES",
65
+ "naics_description": "LIMITED-SERVICE RESTAURANTS"
66
+ }
67
+ ],
68
+ "city": "San Francisco",
69
+ "county_fips": "075",
70
+ "zip": "94110",
71
+ "mlsc": "4",
72
+ "dso": "1",
73
+ "state": "CA",
74
+ "dpv_confirm": "Y",
75
+ "exppubcity": "San Francisco",
76
+ "housenumber": "2299",
77
+ "msa": "7360",
78
+ "phone_number": "0323",
79
+ "exchange": "285",
80
+ "area_code": "415",
81
+ "censustract": "020800",
82
+ "state_fips": "06",
83
+ "street_type": "St",
84
+ "business_name": "Beauty Bar",
85
+ "plus4": "1811",
86
+ "val_date": "2010-03-22",
87
+ "type": "place",
88
+ "confidence_score": "100",
89
+ "time_zone": "4",
90
+ "cbsa": "41860",
91
+ "dpc": "996",
92
+ "company_phones": [
93
+ {
94
+ "phone_number": "0323",
95
+ "phone_type": "P",
96
+ "val_date": "2010-03-22",
97
+ "dnc": "",
98
+ "exchange": "285",
99
+ "areacode": "415",
100
+ "val_flag": "C"
101
+ }
102
+ ],
103
+ "census_block_group": "2",
104
+ "z4_type": "S"
105
+ },
106
+ "selfLink": {
107
+ "href": "http://api.simplegeo.com/0.1/records/com.simplegeo.us.business/41530629.json"
108
+ }
109
+ },
110
+ {
111
+ "created": 1271985146,
112
+ "geometry": {
113
+ "type": "Point",
114
+ "coordinates": [
115
+ -122.420646,
116
+ 37.755470000000003
117
+ ]
118
+ },
119
+ "id": "41531696",
120
+ "layerLink": {
121
+ "href": "http://api.simplegeo.com/0.1/layer/com.simplegeo.us.business.json"
122
+ },
123
+ "type": "Feature",
124
+ "properties": {
125
+ "carrier_route": "C010",
126
+ "pubdate": "2009-12-01",
127
+ "ll_match_level": "R",
128
+ "street_name": "22nd",
129
+ "std_name": "Latin American Club",
130
+ "val_flag": "C",
131
+ "census_block_id": "004",
132
+ "company_headings": [
133
+ {
134
+ "normalized_id": "138004000",
135
+ "condensed_name": "NIGHT CLUBS",
136
+ "condensed_id": "138004000",
137
+ "normalized_name": "NIGHT CLUBS",
138
+ "category_id": "138000000",
139
+ "category_name": "Bars, Taverns & Cocktail Lounges"
140
+ }
141
+ ],
142
+ "company_sics": [
143
+ {
144
+ "sic_4": "5813",
145
+ "relevancy": "1",
146
+ "description": "NIGHT CLUBS",
147
+ "naics": "72241",
148
+ "sic": "58130200",
149
+ "industry_class": "5",
150
+ "sic_4_description": "DRINKING PLACES",
151
+ "naics_description": "DRINKING PLACES (ALCOHOLIC BEVERAGES)"
152
+ }
153
+ ],
154
+ "city": "San Francisco",
155
+ "county_fips": "075",
156
+ "zip": "94110",
157
+ "mlsc": "4",
158
+ "dso": "1",
159
+ "state": "CA",
160
+ "dpv_confirm": "Y",
161
+ "housenumber": "3286",
162
+ "msa": "7360",
163
+ "phone_number": "2732",
164
+ "exchange": "647",
165
+ "area_code": "415",
166
+ "censustract": "020800",
167
+ "state_fips": "06",
168
+ "street_type": "St",
169
+ "business_name": "Latin American Club",
170
+ "plus4": "3033",
171
+ "val_date": "2010-03-22",
172
+ "dnc": "T",
173
+ "type": "place",
174
+ "confidence_score": "100",
175
+ "time_zone": "4",
176
+ "cbsa": "41860",
177
+ "dpc": "862",
178
+ "company_phones": [
179
+ {
180
+ "phone_number": "2732",
181
+ "phone_type": "P",
182
+ "val_date": "2010-03-22",
183
+ "dnc": "T",
184
+ "exchange": "647",
185
+ "areacode": "415",
186
+ "val_flag": "C"
187
+ }
188
+ ],
189
+ "census_block_group": "4",
190
+ "z4_type": "S"
191
+ },
192
+ "selfLink": {
193
+ "href": "http://api.simplegeo.com/0.1/records/com.simplegeo.us.business/41531696.json"
194
+ }
195
+ }
196
+ ]
197
+ }
@@ -0,0 +1,8 @@
1
+ {
2
+ "callback_urls": [],
3
+ "name": "io.path.testlayer",
4
+ "selfLink": {
5
+ "href": "http://api.simplegeo.com/0.1/layer/io.path.testlayer.json"
6
+ },
7
+ "public": false
8
+ }
@@ -0,0 +1,21 @@
1
+ {
2
+ "geometry": {
3
+ "type": "Point",
4
+ "coordinates": [
5
+ -122.42608,
6
+ 37.759650000000001
7
+ ]
8
+ },
9
+ "type": "Feature",
10
+ "properties": {
11
+ "state_name": "California",
12
+ "street_number": "580",
13
+ "country": "US",
14
+ "street": "Dolores St",
15
+ "postal_code": "",
16
+ "county_name": "San Francisco",
17
+ "county_code": "075",
18
+ "state_code": "CA",
19
+ "place_name": "San Francisco"
20
+ }
21
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "message": "No such record.",
3
+ "code": 404
4
+ }
@@ -0,0 +1,4 @@
1
+ {
2
+ "message": "'NoneType' object is not iterable",
3
+ "code": 500
4
+ }
@@ -0,0 +1,41 @@
1
+ [
2
+ {
3
+ "bounds":
4
+ [
5
+ -122.998802,
6
+ 42.002634,
7
+ -122.597843,
8
+ 42.266379000000001
9
+ ],
10
+ "type": "Census Tract",
11
+ "id": "Census_Tract:41029002300:9r2xt4",
12
+ "abbr": "",
13
+ "name": "41029002300"
14
+ },
15
+ {
16
+ "bounds":
17
+ [
18
+ -123.858086,
19
+ 41.995095999999997,
20
+ -123.22998200000001,
21
+ 42.272435999999999
22
+ ],
23
+ "type": "Census Tract",
24
+ "id": "Census_Tract:41033361600:9r2psc",
25
+ "abbr": "",
26
+ "name": "41033361600"
27
+ },
28
+ {
29
+ "bounds":
30
+ [
31
+ -123.231629,
32
+ 42.003022000000001,
33
+ -122.907515,
34
+ 42.433349
35
+ ],
36
+ "type": "Census Tract",
37
+ "id": "Census_Tract:41029003002:9r2ryf",
38
+ "abbr": "",
39
+ "name": "41029003002"
40
+ }
41
+ ]
data/spec/spec_helper.rb CHANGED
@@ -1,15 +1,29 @@
1
1
  $LOAD_PATH.unshift(File.dirname(__FILE__))
2
2
  $LOAD_PATH.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))
3
- require 'simplegeo'
3
+ require 'rubygems'
4
+ require 'simple_geo'
4
5
  require 'spec'
5
6
  require 'spec/autorun'
6
- require 'yaml'
7
+ require 'fakeweb'
7
8
 
8
9
  Spec::Runner.configure do |config|
9
- config.before(:all) do
10
- @test_keys = YAML::load_file(File.join(File.dirname(__FILE__), "test_keys.yml"))
11
- if @test_keys['key'] == 'key' || @test_keys['secret'] == 'secret'
12
- raise 'test keys not set! add your keys to test_keys.yml'
13
- end
10
+
11
+ # don't allow any external connections
12
+ FakeWeb.allow_net_connect = false
13
+
14
+ config.before(:each) do
15
+ FakeWeb.clean_registry
16
+ end
17
+ end
18
+
19
+ def fixture_file(filename)
20
+ file_path = File.expand_path(File.dirname(__FILE__) + "/fixtures/" + filename)
21
+ File.read(file_path)
22
+ end
23
+
24
+ def stub_request(method, url, options={})
25
+ if options[:fixture_file]
26
+ options[:body] = fixture_file(options.delete(:fixture_file))
14
27
  end
28
+ FakeWeb.register_uri(method, url, options)
15
29
  end