class Vicopo

Public Class Methods

get(search, protocol = 'https') click to toggle source
# File lib/vicopo.rb, line 5
def self.get(search, protocol = 'https')
        uri = URI(protocol + '://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
http(search) click to toggle source
# File lib/vicopo.rb, line 14
def self.http(search)
        return self.get(search, 'http')
end
https(search) click to toggle source
# File lib/vicopo.rb, line 17
def self.https(search)
        return self.get(search, 'https')
end