summaryrefslogtreecommitdiff
path: root/app/helpers
diff options
context:
space:
mode:
authorAzul <azul@riseup.net>2016-10-08 10:12:52 +0200
committerAzul <azul@riseup.net>2016-10-08 10:12:52 +0200
commit6eb2dae802e5453e2a4361ab28f614cce9294f4c (patch)
tree37684b3f54c8d7a0e6ef4b406f04983f6f37efb6 /app/helpers
parente3158f56e9e17dc959c98825b7f005e0749b3c29 (diff)
parent016dbc4cbb10dd8bad3c99eb39697c538c07e8e3 (diff)
Merge remote-tracking branch 'pr/241' into develop
Diffstat (limited to 'app/helpers')
-rw-r--r--app/helpers/twitter_helper.rb14
1 files changed, 11 insertions, 3 deletions
diff --git a/app/helpers/twitter_helper.rb b/app/helpers/twitter_helper.rb
index f520286..7ce28be 100644
--- a/app/helpers/twitter_helper.rb
+++ b/app/helpers/twitter_helper.rb
@@ -22,7 +22,7 @@ module TwitterHelper
def update_twitter_info
twitter_user_info[0] = Time.now
twitter_user_info[1] = twitter_client.user(twitter_handle).name
- twitter_user_info[2] = twitter_client.user_timeline(twitter_handle, {:count => 200}).select{ |tweet| tweet.text.start_with?('RT','@')==false}.take(3)
+ twitter_user_info[2] = twitter_client.user_timeline(twitter_handle, {:count => 200}).select{ |tweet| tweet.text.start_with?('RT','@')==false}
if twitter_user_info[2] == nil
error_handling
twitter_user_info[3] = "The twitter handle does not exist or the account's tweets are protected. Please change the privacy settings accordingly or contact your provider-admin."
@@ -52,7 +52,7 @@ module TwitterHelper
def error_handling
twitter_user_info[2] = []
- return twitter_user_info
+ twitter_user_info
end
def cached_info
@@ -70,11 +70,19 @@ module TwitterHelper
cached_info[1]
end
+ def num_of_tweets
+ 3
+ end
+
def tweets
- cached_info[2]
+ cached_info[2].take(num_of_tweets)
end
def error_message
cached_info[3]
end
+
+ def all_tweets_count
+ twitter_user_info[2].count
+ end
end