Class: Vicopo

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

Class Method Summary collapse

Class Method Details

.http(search) ⇒ Object



5
6
7
8
9
10
11
12
13
# File 'lib/vicopo.rb', line 5

def self.http(search)
	uri = URI('http://vicopo.selfbuild.fr/search/' + search.to_s)
	response = JSON.parse(Net::HTTP.get(uri))
	if response['cities']
		return response['cities']
	else
		raise 'No valid answear found.'
	end
end

.https(search) ⇒ Object



14
15
16
17
18
19
20
21
22
# File 'lib/vicopo.rb', line 14

def self.https(search)
	uri = URI('https://www.selfbuild.fr/vicopo/search/' + search.to_s)
	response = JSON.parse(Net::HTTP.get(uri))
	if response['cities']
		return response['cities']
	else
		raise 'No valid answear found.'
	end
end