class Request::HistoryBulk
Clases segun API
Public Class Methods
new()
click to toggle source
# File lib/ecraft-ow/request.rb, line 11 def initialize @app_id = '1df2f62250291f78ccc5dabfec972da0' @base_url = 'http://api.openweathermap.org/data/2.5/' end
Public Instance Methods
by_city(city)
click to toggle source
# File lib/ecraft-ow/request.rb, line 16 def by_city(city) url = URI("#{@base_url}weather?q=" + city + "&appid=#{@app_id}") http = Net::HTTP.new(url.host, url.port) request = Net::HTTP::Get.new(url) response = http.request(request) response = response.read_body response = JSON.parse(response) ap response end