1
0
mirror of https://github.com/LaCasemate/fab-manager.git synced 2024-12-01 12:24:28 +01:00
fab-manager/app/controllers/api/feeds_controller.rb
Sylvain 0cd841da33 rubocop api controllers
TODO:
 - events controller
 - availabilies controller
 - members controller
 - plans controller
2019-01-16 16:28:25 +01:00

24 lines
676 B
Ruby

# frozen_string_literal: true
# API Controller to wrap social networks public feeds
class API::FeedsController < API::ApiController
respond_to :json
def twitter_timelines
limit = if params
params[:limit]
else
3
end
from_account = Setting.find_by(name: 'twitter_name').try(:value) || ENV['TWITTER_NAME']
begin
@tweet_news = Feed.twitter.user_timeline(from_account, count: limit)
rescue Twitter::Error::BadRequest => e
STDERR.puts "[WARNING] Unable to retrieve the twitter feed, please check your ENV configuration. Details: #{e.message}"
render status: :no_content
end
end
end