Last active
May 28, 2017 07:56
-
-
Save phensalves/12aec6cd6b643eb595826715bb063ebe to your computer and use it in GitHub Desktop.
controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class TweetsController < ApplicationController | |
def most_relevants | |
process_most_relevants | |
end | |
def most_mentions | |
process_most_mentions | |
end | |
private | |
def process_most_relevants | |
prepare_hash | |
sort_most_relevants(@elegible_tweets) | |
@elegible_tweets = @tweets_sorted | |
@elegible_tweets = beautify_json_response(@elegible_tweets) | |
end | |
def process_most_mentions | |
prepare_hash | |
sort_most_relevants(@elegible_tweets) | |
@elegible_tweets = @tweets_sorted | |
group_tweets_by_user(@elegible_tweets) | |
@elegible_tweets = @tweets_grouped_by_user | |
@elegible_tweets = beautify_json_response(@elegible_tweets) | |
end | |
def prepare_hash | |
connect_to_api | |
build_tweets_hash(@elegible_tweets) | |
@elegible_tweets = @tweets_array | |
end | |
def connect_to_api | |
super | |
end | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment