Class: Geon::Wikimapia

Inherits:
Object
  • Object
show all
Defined in:
lib/geon/wikimapia.rb

Constant Summary collapse

HOST =
'api.wikimapia.org'

Instance Method Summary collapse

Constructor Details

#initialize(key, args = {}) ⇒ Wikimapia



8
9
10
11
12
# File 'lib/geon/wikimapia.rb', line 8

def initialize(key, args = {})
  loader = args[:loader] ? args[:loader] : HttpLoader.new(HOST)
  @api   = WikimapiaApi.new(loader, key)

end

Instance Method Details

#categoriesObject



42
43
44
45
46
47
# File 'lib/geon/wikimapia.rb', line 42

def categories
  raw = @api.category_getall
  categories = raw['categories']

  categories
end

#category(id) ⇒ Object



53
54
55
56
57
# File 'lib/geon/wikimapia.rb', line 53

def category(id)
  raw = @api.category_getbyid(id)

  raw['category']
end

#languagesObject



59
60
61
62
63
# File 'lib/geon/wikimapia.rb', line 59

def languages
  raw = @api.api_getlanguages

  raw['languages']
end

#nearest_places(lat, long) ⇒ Object



14
15
16
17
18
19
# File 'lib/geon/wikimapia.rb', line 14

def nearest_places(lat, long)
  raw    = @api.place_getnearest(lat, long)
  places = raw['places']

  places
end

#place(id) ⇒ Object



21
22
23
# File 'lib/geon/wikimapia.rb', line 21

def place(id)
  @api.place_getbyid(id)
end

#places_on_area(lon_min, lat_min, lon_max, lat_max) ⇒ Object



26
27
28
29
30
31
# File 'lib/geon/wikimapia.rb', line 26

def places_on_area(lon_min, lat_min, lon_max, lat_max)
  raw    = @api.place_getbyarea(lon_min, lat_min, lon_max, lat_max)
  places = raw['places']

  places
end

#search_places(query) ⇒ Object

doesn’t work



34
35
36
37
38
39
# File 'lib/geon/wikimapia.rb', line 34

def search_places(query)
  raw    = @api.place_search(query)
  places = raw['places']

  places
end

#street(id) ⇒ Object



49
50
51
# File 'lib/geon/wikimapia.rb', line 49

def street(id)
  @api.street_getbyid(id)
end