diff --git a/lib/twitter/api/undocumented.rb b/lib/twitter/api/undocumented.rb index 92274dc65..e2f481c84 100644 --- a/lib/twitter/api/undocumented.rb +++ b/lib/twitter/api/undocumented.rb @@ -38,45 +38,6 @@ def following_followers_of(*args) cursor_from_response_with_user(:users, Twitter::User, :get, "/users/following_followers_of.json", args, :following_followers_of) end - # Returns activity summary for a Tweet - # - # @note Undocumented - # @rate_limited Yes - # @authentication Requires user context - # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. - # @return [Twitter::Tweet] The requested Tweet. - # @param id [Integer] A Tweet ID. - # @param options [Hash] A customizable set of options. - # @example Return activity summary for the Tweet with the ID 25938088801 - # Twitter.status_activity(25938088801) - def status_activity(id, options={}) - response = get("/i/statuses/#{id}/activity/summary.json", options) - response[:body].merge!(:id => id) if response[:body] - Twitter::Tweet.from_response(response) - end - alias tweet_activity status_activity - - # Returns activity summary for Tweets - # - # @note Undocumented - # @rate_limited Yes - # @authentication Requires user context - # @raise [Twitter::Error::Unauthorized] Error raised when supplied user credentials are not valid. - # @return [Array] The requested Tweets. - # @overload statuses_activity(*ids) - # @param ids [Array, Set] An array of Tweet IDs. - # @example Return activity summary for the Tweet with the ID 25938088801 - # Twitter.statuses_activity(25938088801) - # @overload statuses_activity(*ids, options) - # @param ids [Array, Set] An array of Tweet IDs. - # @param options [Hash] A customizable set of options. - def statuses_activity(*args) - arguments = Twitter::API::Arguments.new(args) - arguments.flatten.threaded_map do |id| - status_activity(id, arguments.options) - end - end - # Returns Tweets count for a URL # # @note Undocumented diff --git a/spec/fixtures/activity_summary.json b/spec/fixtures/activity_summary.json deleted file mode 100644 index 714c5b8c7..000000000 --- a/spec/fixtures/activity_summary.json +++ /dev/null @@ -1 +0,0 @@ -{"retweeters_count":"1","repliers":[15395778],"retweeters":[5407632],"favoriters_count":"2","repliers_count":"1","favoriters":[5407632,15395778]} \ No newline at end of file diff --git a/spec/twitter/api/undocumented_spec.rb b/spec/twitter/api/undocumented_spec.rb index 53204c967..3990cb961 100644 --- a/spec/twitter/api/undocumented_spec.rb +++ b/spec/twitter/api/undocumented_spec.rb @@ -80,38 +80,7 @@ end end - describe "#status_activity" do - before do - stub_get("/i/statuses/25938088801/activity/summary.json").to_return(:body => fixture("activity_summary.json"), :headers => {:content_type => "application/json; charset=utf-8"}) - end - it "requests the correct resource" do - @client.status_activity(25938088801) - expect(a_get("/i/statuses/25938088801/activity/summary.json")).to have_been_made - end - it "returns a Tweet" do - tweet = @client.status_activity(25938088801) - expect(tweet).to be_a Twitter::Tweet - expect(tweet.retweeters_count).to eq 1 - end - end - - describe "#statuses_activity" do - before do - stub_get("/i/statuses/25938088801/activity/summary.json").to_return(:body => fixture("activity_summary.json"), :headers => {:content_type => "application/json; charset=utf-8"}) - end - it "requests the correct resource" do - @client.statuses_activity(25938088801) - expect(a_get("/i/statuses/25938088801/activity/summary.json")).to have_been_made - end - it "returns an array of Tweets" do - tweets = @client.statuses_activity(25938088801) - expect(tweets).to be_an Array - expect(tweets.first).to be_a Twitter::Tweet - expect(tweets.first.retweeters_count).to eq 1 - end - end - - describe "#statuses_activity" do + describe "#tweet_count" do before do stub_request(:get, "https://cdn.api.twitter.com/1/urls/count.json").with(:query => {:url => "http://twitter.com"}).to_return(:body => fixture("count.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end