-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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 ability to publish media on Twitter #2161
base: master
Are you sure you want to change the base?
Conversation
@@ -59,7 +61,8 @@ def receive(incoming_events) | |||
end | |||
end | |||
|
|||
def publish_tweet(text) | |||
def publish_tweet(text, media) | |||
return twitter.update_with_media(text, File.new(open(media))) unless media.blank? |
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.
I assume we are requiring open-uri
somewhere and this also works with URLs?
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.
I presume it is required by rails.
I am not entirely satisfied with the test coverage to be honest. I would have liked to refactor the test to stub the twitter API instead of the publish_tweet method so the internals of this method would have been covered. Maybe when I have more time.
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.
We do require it in a few files, I think it would make sense to either move the require
s to an initializer or add it to this Agent as well.
I would have liked to refactor the test to stub the twitter API instead of the publish_tweet method so the internals of this method would have been covered. Maybe when I have more time.
Good idea!
Tried and it works on my instance. Is the |
Just a quick fix to allow posting images to Twitter.