Skip to content

Commit

Permalink
Remove Twitter::Tweet#favoriters, #repliers, #repliers_count, and #re…
Browse files Browse the repository at this point in the history
…tweeters

Closes #419.
  • Loading branch information
sferik committed Jun 25, 2013
1 parent 7f97081 commit 77cc963
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 67 deletions.
32 changes: 6 additions & 26 deletions lib/twitter/tweet.rb
Original file line number Diff line number Diff line change
Expand Up @@ -8,32 +8,26 @@ class Tweet < Twitter::Identity
extend Forwardable
include Twitter::Creatable
include Twitter::Exceptable
attr_reader :favorite_count, :favorited, :favoriters, :from_user_id,
:from_user_name, :in_reply_to_screen_name, :in_reply_to_attrs_id,
:in_reply_to_status_id, :in_reply_to_user_id, :lang, :repliers,
:retweeted, :retweeters, :source, :text, :to_user, :to_user_id,
:to_user_name, :truncated
attr_reader :favorite_count, :favorited, :from_user_id, :from_user_name,
:in_reply_to_screen_name, :in_reply_to_attrs_id, :in_reply_to_status_id,
:in_reply_to_user_id, :lang, :retweet_count, :retweeted, :source, :text,
:to_user, :to_user_id, :to_user_name, :truncated
alias in_reply_to_tweet_id in_reply_to_status_id
alias favorites_count favorite_count
alias favourite_count favorite_count
alias favourites_count favorite_count
alias favoriters_count favorite_count
alias favouriters_count favorite_count
alias favourited favorited
alias favourited? favorited?
alias favouriters favoriters
alias retweeters_count retweet_count
def_delegators :user, :profile_image_url, :profile_image_url_https

# @return [Boolean]
def entities?
!@attrs[:entities].nil?
end

# @return [Integer]
def favoriters_count
favoriters_count = @attrs[:favoriters_count]
favoriters_count.to_i if favoriters_count
end

# @return [String]
def from_user
@attrs[:from_user] || user && user.screen_name
Expand Down Expand Up @@ -81,13 +75,6 @@ def place
@place ||= Twitter::Place.fetch_or_new(@attrs[:place])
end

# @return [Integer]
def repliers_count
repliers_count = @attrs[:repliers_count]
repliers_count.to_i if repliers_count
end
alias reply_count repliers_count

# @return [Boolean]
def reply?
!!in_reply_to_status_id
Expand All @@ -107,13 +94,6 @@ def retweeted_status
alias retweeted_tweet retweeted_status
alias retweet retweeted_status

# @return [String]
def retweeters_count
retweeters_count = (@attrs[:retweet_count] || @attrs[:retweeters_count])
retweeters_count.to_i if retweeters_count
end
alias retweet_count retweeters_count

# @note Must include entities in your request for this method to work
# @return [Array<Twitter::Entity::Symbol>]
def symbols
Expand Down
41 changes: 0 additions & 41 deletions spec/twitter/tweet_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -60,18 +60,6 @@
end
end

describe "#favoriters_count" do
it "returns the count of favoriters when favoriters_count is set" do
tweet = Twitter::Tweet.new(:id => 28669546014, :favoriters_count => '1')
expect(tweet.favoriters_count).to be_an Integer
expect(tweet.favoriters_count).to eq 1
end
it "returns nil when not set" do
tweet = Twitter::Tweet.new(:id => 28669546014)
expect(tweet.favoriters_count).to be_nil
end
end

describe "#from_user" do
it "returns a screen name when from_user is set" do
tweet = Twitter::Tweet.new(:id => 28669546014, :from_user => 'sferik')
Expand Down Expand Up @@ -196,18 +184,6 @@
end
end

describe "#repliers_count" do
it "returns the count of favoriters when repliers_count is set" do
tweet = Twitter::Tweet.new(:id => 28669546014, :repliers_count => '1')
expect(tweet.repliers_count).to be_an Integer
expect(tweet.repliers_count).to eq 1
end
it "returns nil when not set" do
tweet = Twitter::Tweet.new(:id => 28669546014)
expect(tweet.repliers_count).to be_nil
end
end

describe "#reply?" do
it "returns true when there is an in-reply-to status" do
tweet = Twitter::Tweet.new(:id => 28669546014, :in_reply_to_status_id => 114749583439036416)
Expand Down Expand Up @@ -242,23 +218,6 @@
end
end

describe "#retweeters_count" do
it "returns the count of favoriters when retweet_count is set" do
tweet = Twitter::Tweet.new(:id => 28669546014, :retweet_count => '1')
expect(tweet.retweeters_count).to be_an Integer
expect(tweet.retweeters_count).to eq 1
end
it "returns the count of favoriters when retweeters_count is set" do
tweet = Twitter::Tweet.new(:id => 28669546014, :retweeters_count => '1')
expect(tweet.retweeters_count).to be_an Integer
expect(tweet.retweeters_count).to eq 1
end
it "returns nil when not set" do
tweet = Twitter::Tweet.new(:id => 28669546014)
expect(tweet.retweeters_count).to be_nil
end
end

describe "#symbols" do
it "returns an Array of Entity::Symbol when symbols are set" do
symbols_array = [
Expand Down

0 comments on commit 77cc963

Please sign in to comment.