use URI::open
This commit is contained in:
@@ -81,7 +81,7 @@ class Reading < ActiveRecord::Base
|
||||
|
||||
url = "https://mijn.easyenergy.com/nl/api/tariff/getapxtariffs?startTimestamp=%s&endTimestamp=%s&grouping=" % [date.strftime("%F %T"),date.advance(:hours => 24).strftime("%F %T")]
|
||||
#p urlvandaag
|
||||
json = JSON.load(open(url))
|
||||
json = JSON.load(URI::open(url))
|
||||
# advancing with 1 hrs (to offset for something?)
|
||||
json.map{|t| [DateTime.parse(t["Timestamp"]).strftime("%F-%H"), [t["TariffUsage"], t["TariffReturn"]]]}.to_h
|
||||
end
|
||||
|
||||
Reference in New Issue
Block a user