summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoe Robinson <joe@lc8n.com>2019-02-16 23:09:42 +0000
committerJoe Robinson <joe@lc8n.com>2019-02-16 23:09:42 +0000
commitce388a75523cce88f97d6a1b20f3fd5635100896 (patch)
tree5e4a9af5357fef8ddc6543403e1fe631ea5a9ac6
parent0aad889aa7c9590dcaa9c0adff2d826f3114b4a4 (diff)
Formatted endpoint
-rw-r--r--scarecrow.rb13
1 files changed, 10 insertions, 3 deletions
diff --git a/scarecrow.rb b/scarecrow.rb
index b4fadf9..defc135 100644
--- a/scarecrow.rb
+++ b/scarecrow.rb
@@ -66,7 +66,14 @@ def handle_temp_message(msg)
end
get '/' do
- send_file File.join(settings.public_folder, 'index.html')
+ # send_file File.join(settings.public_folder, 'index.html')
+ temp_val = Temperature.last[:value]
+ humidity_val = Humidity.last[:value]
+ temp_time = Temperature.last[:timestamp]
+ humidity_time = Humidity.last[:timestamp]
+ time_formatted = temp_time.strftime("%A, %d %b %Y %l:%M %p")
+
+ return "#{temp_val}°C and #{humidity_val}% humidity at #{time_formatted}"
end
get '/temperature' do
@@ -75,8 +82,8 @@ get '/temperature' do
end
get '/humidity' do
- temp = Humidity.last[:value]
- "#{temp}"
+ humidity = Humidity.last[:value]
+ "#{humidity}"
end
init