Module | Twitter::Client::Tweets |
In: |
lib/twitter/client/tweets.rb
|
Defines methods related to tweets
Returns an oEmbed version of a single status, specified by ID or url to the tweet
@see dev.twitter.com/docs/api/1/get/statuses/oembed @rate_limited Yes @requires_authentication No unless the author of the status is protected @param id [Integer] The numerical ID of the desired status to be embedded. @param url [String] The url to the status to be embedded. ex: twitter.com/#!/twitter/status/25938088801 @param options [Hash] A customizable set of options. @option options [Integer] :maxwidth The maximum width in pixels that the embed should be rendered at. This value is constrained to be between 250 and 550 pixels. @option options [Boolean, String, Integer] :hide_media Specifies whether the embedded Tweet should automatically expand images which were uploaded via {dev.twitter.com/docs/api/1/post/statuses/update_with_media POST statuses/update_with_media}. When set to either true, t or 1 images will not be expanded. Defaults to false. @option options [Boolean, String, Integer] :hide_thread Specifies whether the embedded Tweet should automatically show the original message in the case that the embedded Tweet is a reply. When set to either true, t or 1 the original Tweet will not be shown. Defaults to false. @option options [Boolean, String, Integer] :omit_script Specifies whether the embedded Tweet HTML should include a <script> element pointing to widgets.js. In cases where a page already includes widgets.js, setting this value to true will prevent a redundant script element from being included. When set to either true, t or 1 the <script> element will not be included in the embed HTML, meaning that pages must include a reference to widgets.js manually. Defaults to false. @option options [String] :align Specifies whether the embedded Tweet should be left aligned, right aligned, or centered in the page. Valid values are left, right, center, and none. Defaults to none, meaning no alignment styles are specified for the Tweet. @option options [String] :related A value for the TWT related parameter, as described in {dev.twitter.com/docs/intents Web Intents}. This value will be forwarded to all Web Intents calls. @option options [String] :lang Language code for the rendered embed. This will affect the text and localization of the rendered HTML.
Retweets a tweet
@see dev.twitter.com/docs/api/1/post/statuses/retweet/:id @rate_limited Yes @requires_authentication Yes @param id [Integer] The numerical ID of the desired status. @param options [Hash] A customizable set of options. @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author‘s numerical ID when set to true, ‘t’ or 1. @option options [Boolean, String, Integer] :include_entities Include {dev.twitter.com/docs/tweet-entities Tweet Entities} when set to true, ‘t’ or 1. @return [Twitter::Status] The original tweet with retweet details embedded. @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Retweet the status with the ID 28561922516
Twitter.retweet(28561922516)
Show up to 100 users who retweeted the status
@see dev.twitter.com/docs/api/1/get/statuses/:id/retweeted_by @see dev.twitter.com/docs/api/1/get/statuses/:id/retweeted_by/ids @rate_limited Yes @requires_authentication Yes @param id [Integer] The numerical ID of the desired status. @param options [Hash] A customizable set of options. @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100. @option options [Integer] :page Specifies the page of results to retrieve. @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author‘s numerical ID when set to true, ‘t’ or 1. @option options [Boolean, String, Integer] :include_entities Include {dev.twitter.com/docs/tweet-entities Tweet Entities} when set to true, ‘t’ or 1. @option options [Boolean] :ids_only (‘false’) Only return user ids instead of full user objects. @return [Array] @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Show up to 100 users who retweeted the status with the ID 28561922516
Twitter.retweeters_of(28561922516)
Returns up to 100 of the first retweets of a given tweet
@see dev.twitter.com/docs/api/1/get/statuses/retweets/:id @rate_limited Yes @requires_authentication Yes @param id [Integer] The numerical ID of the desired status. @param options [Hash] A customizable set of options. @option options [Integer] :count Specifies the number of records to retrieve. Must be less than or equal to 100. @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author‘s numerical ID when set to true, ‘t’ or 1. @option options [Boolean, String, Integer] :include_entities Include {dev.twitter.com/docs/tweet-entities Tweet Entities} when set to true, ‘t’ or 1. @return [Array<Twitter::Status>] @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Return up to 100 of the first retweets of the status with the ID 28561922516
Twitter.retweets(28561922516)
Returns a single status, specified by ID
@see dev.twitter.com/docs/api/1/get/statuses/show/:id @rate_limited Yes @requires_authentication No unless the author of the status is protected @param id [Integer] The numerical ID of the desired status. @param options [Hash] A customizable set of options. @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author‘s numerical ID when set to true, ‘t’ or 1. @option options [Boolean, String, Integer] :include_entities Include {dev.twitter.com/docs/tweet-entities Tweet Entities} when set to true, ‘t’ or 1. @return [Twitter::Status] The requested status. @example Return the status with the ID 25938088801
Twitter.status(25938088801)
Destroys the specified status
@see dev.twitter.com/docs/api/1/post/statuses/destroy/:id @note The authenticating user must be the author of the specified status. @rate_limited No @requires_authentication Yes @param id [Integer] The numerical ID of the desired status. @param options [Hash] A customizable set of options. @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author‘s numerical ID when set to true, ‘t’ or 1. @option options [Boolean, String, Integer] :include_entities Include {dev.twitter.com/docs/tweet-entities Tweet Entities} when set to true, ‘t’ or 1. @return [Twitter::Status] The deleted status. @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Destroy the status with the ID 25938088801
Twitter.status_destroy(25938088801)
Updates the authenticating user‘s status
@see dev.twitter.com/docs/api/1/post/statuses/update @note A status update with text identical to the authenticating user‘s current status will be ignored to prevent duplicates. @rate_limited No @requires_authentication Yes @param status [String] The text of your status update, up to 140 characters. @param options [Hash] A customizable set of options. @option options [Integer] :in_reply_to_status_id The ID of an existing status that the update is in reply to. @option options [Float] :lat The latitude of the location this tweet refers to. This option will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there isn‘t a corresponding :long option. @option options [Float] :long The longitude of the location this tweet refers to. The valid ranges for longitude is -180.0 to +180.0 (East is positive) inclusive. This option will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding :lat option. @option options [String] :place_id A place in the world. These IDs can be retrieved from {Twitter::Client::Geo#reverse_geocode}. @option options [String] :display_coordinates Whether or not to put a pin on the exact coordinates a tweet has been sent from. @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author‘s numerical ID when set to true, ‘t’ or 1. @option options [Boolean, String, Integer] :include_entities Include {dev.twitter.com/docs/tweet-entities Tweet Entities} when set to true, ‘t’ or 1. @return [Twitter::Status] The created status. @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Update the authenticating user‘s status
Twitter.update("I'm tweeting with @gem!")
Updates with media the authenticating user‘s status
@see dev.twitter.com/docs/api/1/post/statuses/update_with_media @note A status update with text/media identical to the authenticating user‘s current status will NOT be ignored @requires_authentication Yes @rate_limited No @param status [String] The text of your status update, up to 140 characters. @param media [File] A File object with your picture (PNG, JPEG or GIF) @param options [Hash] A customizable set of options. @option options [Integer] :in_reply_to_status_id The ID of an existing status that the update is in reply to. @option options [Float] :lat The latitude of the location this tweet refers to. This option will be ignored unless it is inside the range -90.0 to +90.0 (North is positive) inclusive. It will also be ignored if there isn‘t a corresponding :long option. @option options [Float] :long The longitude of the location this tweet refers to. The valid ranges for longitude is -180.0 to +180.0 (East is positive) inclusive. This option will be ignored if outside that range, if it is not a number, if geo_enabled is disabled, or if there not a corresponding :lat option. @option options [String] :place_id A place in the world. These IDs can be retrieved from {Twitter::Client::Geo#reverse_geocode}. @option options [String] :display_coordinates Whether or not to put a pin on the exact coordinates a tweet has been sent from. @option options [Boolean, String, Integer] :trim_user Each tweet returned in a timeline will include a user object with only the author‘s numerical ID when set to true, ‘t’ or 1. @option options [Boolean, String, Integer] :include_entities Include {dev.twitter.com/pages/tweet_entities Tweet Entities} when set to true, ‘t’ or 1. @return [Twitter::Status] The created status. @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. @example Update the authenticating user‘s status
Twitter.update_with_media("I'm tweeting with @gem!", File.new('my_awesome_pic.jpeg')) Twitter.update_with_media("I'm tweeting with @gem!", {'io' => StringIO.new(pic), 'type' => 'jpg'})