simplegeo 0.5 → 0.5.1

Sign up to get free protection for your applications and to get access to all the features.
data/lib/simple_geo.rb CHANGED
@@ -9,7 +9,6 @@ require 'simple_geo/client'
9
9
  require 'simple_geo/record'
10
10
 
11
11
  module SimpleGeo
12
- API_VERSION = '1.0'.freeze
13
12
  REALM = "http://api.simplegeo.com"
14
13
  VERSION = File.read(File.join(File.dirname(__FILE__), '..', 'VERSION'))
15
14
 
@@ -5,7 +5,7 @@ module SimpleGeo
5
5
  class << self
6
6
 
7
7
  def feature(id)
8
- endpoint_url "features/#{id}.json"
8
+ endpoint_url "features/#{id}.json", '1.0'
9
9
  end
10
10
 
11
11
  def get_layers()
@@ -17,38 +17,34 @@ module SimpleGeo
17
17
  end
18
18
 
19
19
  def record(layer, id)
20
- endpoint_url "records/#{layer}/#{id}.json"
20
+ endpoint_url "records/#{layer}/#{id}.json", '0.1'
21
21
  end
22
22
 
23
23
  def records(layer, ids)
24
24
  ids = ids.join(',') if ids.is_a? Array
25
- endpoint_url "records/#{layer}/#{ids}.json"
25
+ endpoint_url "records/#{layer}/#{ids}.json", '0.1'
26
26
  end
27
27
 
28
28
  def add_records(layer)
29
- endpoint_url "records/#{layer}.json"
29
+ endpoint_url "records/#{layer}.json", '0.1'
30
30
  end
31
31
 
32
32
  def history(layer, id)
33
- endpoint_url "records/#{layer}/#{id}/history.json"
33
+ endpoint_url "records/#{layer}/#{id}/history.json", '0.1'
34
34
  end
35
35
 
36
36
  def nearby_geohash(layer, geohash)
37
- endpoint_url "records/#{layer}/nearby/#{geohash}.json"
37
+ endpoint_url "records/#{layer}/nearby/#{geohash}.json", '0.1'
38
38
  end
39
39
 
40
40
  def nearby_coordinates(layer, lat, lon)
41
- endpoint_url "records/#{layer}/nearby/#{lat},#{lon}.json"
41
+ endpoint_url "records/#{layer}/nearby/#{lat},#{lon}.json", '0.1'
42
42
  end
43
43
 
44
44
  def nearby_ip_address(layer, ip)
45
- endpoint_url "records/#{layer}/nearby/#{ip}.json"
45
+ endpoint_url "records/#{layer}/nearby/#{ip}.json", '0.1'
46
46
  end
47
47
 
48
- def nearby_address(lat, lon)
49
- endpoint_url "nearby/address/#{lat},#{lon}.json"
50
- end
51
-
52
48
  def context(lat, lon)
53
49
  endpoint_url "context/#{lat},#{lon}.json", '1.0'
54
50
  end
@@ -98,32 +94,7 @@ module SimpleGeo
98
94
  end
99
95
  end
100
96
 
101
- def density(lat, lon, day, hour=nil)
102
- if hour.nil?
103
- path = "density/#{day}/#{lat},#{lon}.json"
104
- else
105
- path = "density/#{day}/#{hour}/#{lat},#{lon}.json"
106
- end
107
- endpoint_url path
108
- end
109
-
110
- def contains(lat, lon)
111
- endpoint_url "contains/#{lat},#{lon}.json"
112
- end
113
-
114
- def contains_ip_address(ip)
115
- endpoint_url "contains/#{ip}.json"
116
- end
117
-
118
- def overlaps(south, west, north, east)
119
- endpoint_url "overlaps/#{south},#{west},#{north},#{east}.json"
120
- end
121
-
122
- def boundary(id)
123
- endpoint_url "boundary/#{id}.json"
124
- end
125
-
126
- def endpoint_url(path, version = API_VERSION)
97
+ def endpoint_url(path, version)
127
98
  [REALM, version, path].join('/')
128
99
  end
129
100
  end
metadata CHANGED
@@ -1,12 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: simplegeo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 1
4
+ hash: 9
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 5
9
- version: "0.5"
9
+ - 1
10
+ version: 0.5.1
10
11
  platform: ruby
11
12
  authors:
12
13
  - Andrew Mager