Fix facebook the way it should be fixed
This commit is contained in:
parent
320f2d86ca
commit
c2f3855e31
1 changed files with 0 additions and 30 deletions
|
@ -1,30 +0,0 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
require 'net/http'
|
||||
require 'json'
|
||||
|
||||
usage 'fetch [facebook event id]'
|
||||
aliases :f
|
||||
summary 'Fetch an event from facebook'
|
||||
description 'Fetch an event from facebook'
|
||||
|
||||
run do |_opts, args, _cmd|
|
||||
fb_token = File.read('.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: #Fill in
|
||||
time: #{o['start_time']}
|
||||
end: #{o['end_time']}
|
||||
location: #{o['place']['name']}
|
||||
banner: #{o['cover']['source']}
|
||||
created_at: #Fill in
|
||||
facebook: 'https://www.facebook.com/events/#{event_id}/'
|
||||
---
|
||||
|
||||
#{o['description']}
|
||||
EOS
|
||||
end
|
Loading…
Reference in a new issue