Skip to content

Latest commit

 

History

History
60 lines (41 loc) · 1.82 KB

Update.md

File metadata and controls

60 lines (41 loc) · 1.82 KB

Update

These examples assume you have a configured Twitter REST client. Instructions on how to configure a client can be found in examples/Configuration.md.

If the authenticated user has granted read/write permission to your application, you may tweet as them.

client.update("I'm tweeting with @gem!")

Post an update in reply to another tweet.

client.update("I'm tweeting with @gem!", in_reply_to_status_id: 402712877960019968)

Post an update with precise coordinates.

client.update("I'm tweeting with @gem!", lat: 37.7821120598956, long: -122.400612831116, display_coordinates: true)

Post an update from a specific place. Place IDs can be retrieved using the #reverse_geocode method.

client.update("I'm tweeting with @gem!", place_id: "df51dec6f4ee2b2c")

Post an update with an image.

client.update_with_media("I'm tweeting with @gem!", File.new("/path/to/media.png"))

Post an update with a possibly-sensitive image.

client.update_with_media("I'm tweeting with @gem!", File.new("/path/to/sensitive-media.png"), possibly_sensitive: true)

Post an update with multiple images.

media = %w(/path/to/media1.png /path/to/media2.png).map { |filename| File.new(filename) }
client.update_with_media("I'm tweeting with @gem!", media)

For more information, see the documentation for the #update and #update_with_media methods.