Class: PopulationGrowthClient

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

Overview

Population growth client

Class Method Summary collapse

Class Method Details

.search_zip(zip_code) ⇒ Object

Search population growth by zip code



7
8
9
10
11
12
# File 'lib/population_growth_client.rb', line 7

def self.search_zip(zip_code)
  url = 'http://population-growth-ps.herokuapp.com/search-zip/'
  uri = URI(url + zip_code.to_s)
  response = Net::HTTP.get_response(uri)
  JSON.parse(response.body) if response.code == '200'
end