New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add home timeline option to twitter user agent #1321
Add home timeline option to twitter user agent #1321
Conversation
@@ -5,13 +5,19 @@ class TwitterUserAgent < Agent | |||
cannot_receive_events! | |||
|
|||
description <<-MD | |||
The Twitter User Agent follows the timeline of a specified Twitter user. | |||
There are two options in using the Twitter User Agent. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The first line of the description is shown in the new agent dropdown. It would be nice if you could condense the second and third line into a short description explaining both options the agent has.
Very nice addition @Jngai! |
@dsander Will you take a look please? |
@dsander I fixed my error and the test passed but I still need a quick look. |
errors.add(:base, "expected_update_period_in_days is required") unless options['expected_update_period_in_days'].present? | ||
|
||
errors.add(:base, "username is required") unless options['choose_home_time_line'] == 'true' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This will cause the validation to fail even if a username
is provided, i think you want
errors.add(:base, "username is required") if options['username'].blank? && !boolify(options['choose_home_time_line'])
@dsander I put in another commit to fix the rest of your suggestions. thank you. |
@@ -82,6 +84,10 @@ def starting_at | |||
end | |||
end | |||
|
|||
def choose_home_time_line? | |||
interpolated[:choose_home_time_line] == "true" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
use boolify
here too
boolify(interpolated['choose_home_time_line'])
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line change actually sent the agent malfunctioning.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What did using boolify(interpolated['choose_home_time_line'])
break?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
sorry it was actually me I set it to equal == true
. I just made a commit for this. I just tested it locally and everything is working.
else | ||
tweets = twitter.user_timeline(interpolated['username'], opts) | ||
|
||
tweets.each do |tweet| |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this loop the same as the one above? If it is, maybe something like this would work?
if choose_home_time_line?
tweets = twitter.home_timeline(opts)
else
tweets = twitter.user_timeline(interpolated['username'], opts)
end
tweets.each do |tweet|
...
@cantino Hi I am done with the changes and the spec passed. The boolify change actually sent the agent malfunctioning. I just tested this locally and verified it. The agent worked now that I reverted that line change. |
@cantino I added that boolify line change. I accidentally set it to true. |
…er_user_agent Add home timeline option to twitter user agent
Looks great, thanks @Jngai! |
Fixes #1249.