Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Allow use of Twitter::Place instead of place_id

  • Loading branch information...
commit c2b31dd2385fefa30a9ddccf15415a713cf5953a 1 parent 4d05393
Erik Michaels-Ober authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 lib/twitter/rest/api/tweets.rb
11 lib/twitter/rest/api/tweets.rb
View
@@ -113,11 +113,14 @@ def destroy_status(*args)
# @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 A place in the world. These can be retrieved from {Twitter::REST::API::PlacesAndGeo#reverse_geocode}.
# @option options [String] :place_id A place in the world. These IDs can be retrieved from {Twitter::REST::API::PlacesAndGeo#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.
def update(status, options={})
- object_from_response(Twitter::Tweet, :post, "/1.1/statuses/update.json", options.merge(:status => status))
+ hash = options.dup
+ hash[:place_id] = hash.delete(:place).id unless hash[:place].nil?
+ object_from_response(Twitter::Tweet, :post, "/1.1/statuses/update.json", hash.merge(:status => status))
rescue Twitter::Error::Forbidden => error
handle_forbidden_error(Twitter::Error::AlreadyPosted, error)
end
@@ -184,14 +187,18 @@ def retweet!(*args)
# @param status [String] The text of your status update, up to 140 characters.
# @param media [File, Hash] A File object with your picture (PNG, JPEG or GIF)
# @param options [Hash] A customizable set of options.
+ # @option options [Boolean, String, Integer] :possibly_sensitive Set to true for content which may not be suitable for every audience.
# @option options [Integer] :in_reply_to_status_id The ID of an existing Tweet 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 A place in the world. These can be retrieved from {Twitter::REST::API::PlacesAndGeo#reverse_geocode}.
# @option options [String] :place_id A place in the world. These IDs can be retrieved from {Twitter::REST::API::PlacesAndGeo#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.
def update_with_media(status, media, options={})
- object_from_response(Twitter::Tweet, :post, "/1.1/statuses/update_with_media.json", options.merge('media[]' => media, 'status' => status))
+ hash = options.dup
+ hash[:place_id] = hash.delete(:place).id unless hash[:place].nil?
+ object_from_response(Twitter::Tweet, :post, "/1.1/statuses/update_with_media.json", hash.merge('media[]' => media, 'status' => status))
rescue Twitter::Error::Forbidden => error
handle_forbidden_error(Twitter::Error::AlreadyPosted, error)
end
Please sign in to comment.
Something went wrong with that request. Please try again.