Expand FB fetch script

This commit is contained in:
Wout Schellaert 2017-10-13 11:23:58 +02:00
parent 360d2ce4f2
commit d4303c9540

View file

@ -10,16 +10,19 @@ description 'Fetch an event from facebook'
run do |_opts, args, _cmd|
fb_token = File.read('.fb_token')
uri = URI("https://graph.facebook.com/v2.10/#{args[0]}?fields=cover,name,description,start_time,place,end_time&access_token=#{fb_token}")
event_id = args[0]
uri = URI("https://graph.facebook.com/v2.10/#{event_id}?fields=cover,name,description,start_time,place,end_time&access_token=#{fb_token}")
o = JSON.parse(Net::HTTP.get(uri))
puts <<~EOS
---
title: "#{o['name']}"
description: #TODO
time: #{o['start_time']}
location: #{o['place']['name']}
end: #{o['end_time']}
location: #{o['place']['name']}
banner: #{o['cover']['source']}
created_at: #TODO
facebook: 'https://www.facebook.com/events/#{event_id}/'
---
#{o['description']}