This commit is contained in:
Anitha Palanisamy 2017-01-31 13:57:04 +00:00 committed by GitHub
commit f1e37df5a0
21 changed files with 264 additions and 3 deletions

View file

@ -14,6 +14,7 @@ class EventSchedule < ActiveRecord::Base
scope :confirmed, -> { joins(:event).where('state = ?', 'confirmed') }
scope :canceled, -> { joins(:event).where('state = ?', 'canceled') }
scope :withdrawn, -> { joins(:event).where('state = ?', 'withdrawn') }
scope :current, -> { where('start_time <= ?', Time.current).select{ |es| es.end_time >= Time.current }}
delegate :guid, to: :room, prefix: true

View file

@ -0,0 +1,21 @@
class TwitterWrapper
attr_accessor :client
def initialize
@client = Twitter::REST::Client.new do |config|
config.consumer_key = ENV['OSEM_TWITTER_CONSUMER_KEY']
config.consumer_secret = ENV['OSEM_TWITTER_CONSUMER_SECRET']
config.access_token = ENV['OSEM_TWITTER_ACCESS_TOKEN']
config.access_token_secret = ENV['OSEM_TWITTER_ACCESS_TOKEN_SECRET']
end
end
##
# Fetches tweets from twitter api based on search_term and no_of_tweets
#
def search_tweets(no_of_tweets, search_term)
@client.search(search_term, result_type: 'recent').take(no_of_tweets).collect
rescue
nil
end
end