Class: Weather_Forecast

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

Constant Summary collapse

API_KEY =
"e046860d9eefc1d12485b5cea5a7c262"

Class Method Summary collapse

Class Method Details

.get_forecast(latitude, longitude) ⇒ Object



14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/weather_forecast.rb', line 14

def self.get_forecast(latitude, longitude)
	url = "https://api.forecast.io/forecast/#{API_KEY}/#{latitude},#{longitude}"
	puts url

	response = HTTParty.get(url)

json = JSON.parse(response.body)

puts json

return json
end

.get_test_jsonObject



27
28
29
# File 'lib/weather_forecast.rb', line 27

def self.get_test_json
	self.get_forecast(:test_lat, :test_long)
end

.hiObject



10
11
12
# File 'lib/weather_forecast.rb', line 10

def self.hi
  puts "Hello world!"
end