Class: Wandre::Wandrelist

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

Instance Method Summary collapse

Instance Method Details

#search(username) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
# File 'lib/wandrecities/wandre.rb', line 7

def search(username)
  url = 'https://wandre.space/api/search?q=#{CGI::escape username}'
  uri = URI(url)
  response = Net::HTTP.get(uri)
  JSON.parse(response)
   #response = RestClient::Request.new(

     #   method: :get,

     #   url: "https://wandre.space/api/search?q=#{CGI::escape username}",

     #   content_type: :json).execute

   #serialize Hash.from_json response

end