Permalink
Browse files

Remove support for IO hash syntax

As far as I can tell, this code doesn't work, so removing it shouldn't
break anything. I'm willing to add it back if someone writes tests that
actually exercise the code.
  • Loading branch information...
1 parent 79dc819 commit bfe842d714a77b8edda90d0e2b547be434dc0148 @sferik committed Aug 26, 2012
Showing with 2 additions and 22 deletions.
  1. +1 −1 README.md
  2. +0 −3 lib/twitter/api.rb
  3. +1 −1 lib/twitter/client.rb
  4. +0 −3 lib/twitter/request/multipart_with_file.rb
  5. +0 −14 spec/twitter/api/statuses_spec.rb
View
@@ -273,7 +273,7 @@ Here are some fun facts about the 3.0 release:
* The entire library is implemented in just 2,000 lines of code
* With over 5,000 lines of specs, the spec-to-code ratio is over 2.5:1
-* The spec suite contains 673 examples and runs in under 2 seconds on a MacBook
+* The spec suite contains 671 examples and runs in under 2 seconds on a MacBook
* This project has 100% C0 code coverage (the tests execute every line of
source code at least once)
* At the time of release, this library is comprehensive: you can request all
View
@@ -264,7 +264,6 @@ def update_profile(options={})
# @option options [Boolean] :tile Whether or not to tile the background image. If set to true the background image will be displayed tiled. The image will not be tiled otherwise.
# @example Update the authenticating user's profile background image
# Twitter.update_profile_background_image(File.new("we_concept_bg2.png"))
- # Twitter.update_profile_background_image(:io => StringIO.new(pic), :type => 'jpg')
def update_profile_background_image(image, options={})
object_from_response(Twitter::User, :post, "/1/account/update_profile_background_image.json", options.merge(:image => image))
end
@@ -300,7 +299,6 @@ def update_profile_colors(options={})
# @param options [Hash] A customizable set of options.
# @example Update the authenticating user's profile image
# Twitter.update_profile_image(File.new("me.jpeg"))
- # Twitter.update_profile_image(:io => StringIO.new(pic), :type => 'jpg')
def update_profile_image(image, options={})
object_from_response(Twitter::User, :post, "/1/account/update_profile_image.json", options.merge(:image => image))
end
@@ -2165,7 +2163,6 @@ def update(status, 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.
# @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'})
def update_with_media(status, media, options={})
object_from_response(Twitter::Tweet, :post, "/1/statuses/update_with_media.json", options.merge('media[]' => media, 'status' => status), :endpoint => @media_endpoint)
end
View
@@ -92,7 +92,7 @@ def request(method, path, params={}, options={})
def auth_header(method, uri, params={})
# When posting a file, don't sign any params
- signature_params = [:post, :put].include?(method.to_sym) && params.values.any?{|value| value.respond_to?(:to_io) || (value.is_a?(Hash) && (value[:io].is_a?(IO) || value[:io].is_a?(StringIO)))} ? {} : params
+ signature_params = [:post, :put].include?(method.to_sym) && params.values.any?{|value| value.respond_to?(:to_io)} ? {} : params
SimpleOAuth::Header.new(method, uri, signature_params, credentials)
end
@@ -15,9 +15,6 @@ def call(env)
if value.respond_to?(:to_io)
env[:body][key] = Faraday::UploadIO.new(value, mime_type(value.path), value.path)
env[:request_headers][CONTENT_TYPE] = self.class.mime_type
- elsif value.is_a?(Hash) && (value[:io].is_a?(IO) || value[:io].is_a?(StringIO))
- env[:body][key] = Faraday::UploadIO.new(value[:io], mime_type('.' + value[:type]), '')
- env[:request_headers][CONTENT_TYPE] = self.class.mime_type
end
end
end
@@ -537,20 +537,6 @@
should have_been_made
end
end
- context "an IO" do
- it "requests the correct resource" do
- @client.update_with_media("You always have options", {:io => IO.sysopen(fixture_path + "/we_concept_bg2.png"), :type => 'png'})
- a_post("/1/statuses/update_with_media.json", "https://upload.twitter.com").
- should have_been_made
- end
- end
- context "a StringIO" do
- it "requests the correct resource" do
- @client.update_with_media("You always have options", {:io => StringIO.new, :type => 'png'})
- a_post("/1/statuses/update_with_media.json", "https://upload.twitter.com").
- should have_been_made
- end
- end
end
describe "#oembed" do

0 comments on commit bfe842d

Please sign in to comment.