sg-ruby 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.document +5 -0
- data/.gitignore +21 -0
- data/LICENSE +20 -0
- data/README.rdoc +120 -0
- data/Rakefile +50 -0
- data/VERSION +1 -0
- data/lib/simple_geo.rb +23 -0
- data/lib/simple_geo/client.rb +166 -0
- data/lib/simple_geo/connection.rb +109 -0
- data/lib/simple_geo/endpoint.rb +67 -0
- data/lib/simple_geo/hash_utils.rb +24 -0
- data/lib/simple_geo/record.rb +57 -0
- data/lib/simplegeo.rb +2 -0
- data/sg-ruby.gemspec +81 -0
- data/spec/client_spec.rb +1165 -0
- data/spec/fixtures/contains.json +127 -0
- data/spec/fixtures/get_density_by_day.json +833 -0
- data/spec/fixtures/get_density_by_hour.json +36 -0
- data/spec/fixtures/get_history.json +13 -0
- data/spec/fixtures/get_nearby.json +84 -0
- data/spec/fixtures/get_record.json +38 -0
- data/spec/fixtures/get_records.json +197 -0
- data/spec/fixtures/layer_info.json +8 -0
- data/spec/fixtures/nearby_address.json +21 -0
- data/spec/fixtures/no_such_record.json +4 -0
- data/spec/fixtures/nonetype_not_iterable.json +4 -0
- data/spec/fixtures/overlaps.json +41 -0
- data/spec/spec.opts +1 -0
- data/spec/spec_helper.rb +29 -0
- metadata +145 -0
@@ -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,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,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,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
|
+
]
|