Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Add back custom retweet_count accessor

  • Loading branch information...
commit f82a90627be4b6618cb0d1c26df463acd2e13c49 1 parent ad4bc77
@sferik authored
View
2  lib/twitter/action.rb
@@ -4,6 +4,6 @@
module Twitter
class Action < Twitter::Base
include Twitter::Creatable
- attr_reader :max_position, :min_position
+ attr_reader :max_position, :min_position
end
end
View
2  lib/twitter/configuration.rb
@@ -3,7 +3,7 @@
module Twitter
class Configuration < Twitter::Base
- attr_reader :characters_reserved_per_media, :max_media_per_upload,
+ attr_reader :characters_reserved_per_media, :max_media_per_upload,
:non_username_paths, :photo_size_limit, :short_url_length, :short_url_length_https
# Returns an array of photo sizes
View
2  lib/twitter/direct_message.rb
@@ -5,7 +5,7 @@
module Twitter
class DirectMessage < Twitter::Identifiable
include Twitter::Creatable
- attr_reader :text
+ attr_reader :text
# @param other [Twitter::DirectMessage]
# @return [Boolean]
View
2  lib/twitter/entity.rb
@@ -2,6 +2,6 @@
module Twitter
class Entity < Twitter::Base
- attr_reader :indices
+ attr_reader :indices
end
end
View
2  lib/twitter/entity/hashtag.rb
@@ -2,6 +2,6 @@
module Twitter
class Entity::Hashtag < Twitter::Entity
- attr_reader :text
+ attr_reader :text
end
end
View
2  lib/twitter/entity/url.rb
@@ -2,6 +2,6 @@
module Twitter
class Entity::Url < Twitter::Entity
- attr_reader :display_url, :expanded_url, :url
+ attr_reader :display_url, :expanded_url, :url
end
end
View
2  lib/twitter/entity/user_mention.rb
@@ -2,6 +2,6 @@
module Twitter
class Entity::UserMention < Twitter::Entity
- attr_reader :id, :name, :screen_name
+ attr_reader :id, :name, :screen_name
end
end
View
2  lib/twitter/favorite.rb
@@ -4,7 +4,7 @@
module Twitter
class Favorite < Twitter::Action
- attr_reader :target_objects
+ attr_reader :target_objects
# A collection of users who favorited a status
#
View
2  lib/twitter/follow.rb
@@ -3,7 +3,7 @@
module Twitter
class Follow < Twitter::Action
- attr_reader :target_objects
+ attr_reader :target_objects
# A collection of users who followed a user
#
View
2  lib/twitter/language.rb
@@ -2,6 +2,6 @@
module Twitter
class Language < Twitter::Base
- attr_reader :code, :name, :status
+ attr_reader :code, :name, :status
end
end
View
2  lib/twitter/list.rb
@@ -5,7 +5,7 @@
module Twitter
class List < Twitter::Identifiable
include Twitter::Creatable
- attr_reader :description, :following, :full_name, :member_count,
+ attr_reader :description, :following, :full_name, :member_count,
:mode, :name, :slug, :subscriber_count, :uri
alias :following? :following
View
2  lib/twitter/list_member_added.rb
@@ -4,7 +4,7 @@
module Twitter
class ListMemberAdded < Twitter::Action
- attr_reader :target_objects
+ attr_reader :target_objects
# A collection of users who added a user to a list
#
View
2  lib/twitter/metadata.rb
@@ -2,6 +2,6 @@
module Twitter
class Metadata < Twitter::Base
- attr_reader :result_type
+ attr_reader :result_type
end
end
View
2  lib/twitter/oembed.rb
@@ -2,7 +2,7 @@
module Twitter
class OEmbed < Twitter::Identifiable
- attr_reader :author_name,:author_url, :cache_age, :height, :html,
+ attr_reader :author_name,:author_url, :cache_age, :height, :html,
:provider_name, :provider_url, :type, :width, :url, :version
end
end
View
2  lib/twitter/photo.rb
@@ -3,7 +3,7 @@
module Twitter
class Photo < Twitter::Identifiable
- attr_reader :display_url, :expanded_url, :indices, :media_url,
+ attr_reader :display_url, :expanded_url, :indices, :media_url,
:media_url_https, :url
# @param other [Twitter::Photo]
View
2  lib/twitter/place.rb
@@ -3,7 +3,7 @@
module Twitter
class Place < Twitter::Identifiable
- attr_reader :attributes, :country, :full_name, :name, :url, :woeid
+ attr_reader :attributes, :country, :full_name, :name, :url, :woeid
alias :woe_id :woeid
# @param other [Twitter::Place]
View
2  lib/twitter/point.rb
@@ -2,7 +2,7 @@
module Twitter
class Point < Twitter::Base
- attr_reader :coordinates
+ attr_reader :coordinates
# @param other [Twitter::Point]
# @return [Boolean]
View
2  lib/twitter/polygon.rb
@@ -2,7 +2,7 @@
module Twitter
class Polygon < Twitter::Base
- attr_reader :coordinates
+ attr_reader :coordinates
# @param other [Twitter::Polygon]
# @return [Boolean]
View
2  lib/twitter/rate_limit_status.rb
@@ -2,7 +2,7 @@
module Twitter
class RateLimitStatus < Twitter::Base
- attr_reader :hourly_limit, :remaining_hits, :reset_time_in_seconds
+ attr_reader :hourly_limit, :remaining_hits, :reset_time_in_seconds
# Time when the authenticating user's rate limit will be reset
#
View
1  lib/twitter/request.rb
@@ -3,6 +3,7 @@
module Twitter
# Defines HTTP request methods
module Request
+
# Perform an HTTP DELETE request
def delete(path, params={}, options={})
request(:delete, path, params, options)
View
2  lib/twitter/saved_search.rb
@@ -4,7 +4,7 @@
module Twitter
class SavedSearch < Twitter::Identifiable
include Twitter::Creatable
- attr_reader :name, :position, :query
+ attr_reader :name, :position, :query
# @param other [Twitter::SavedSearch]
# @return [Boolean]
View
2  lib/twitter/search_results.rb
@@ -2,7 +2,7 @@
module Twitter
class SearchResults < Twitter::Base
- attr_reader :completed_in, :max_id, :next_page, :page, :query,
+ attr_reader :completed_in, :max_id, :next_page, :page, :query,
:refresh_url, :results_per_page, :since_id
# @return [Array<Twitter::Status>]
View
2  lib/twitter/settings.rb
@@ -3,7 +3,7 @@
module Twitter
class Settings < Twitter::Base
- attr_reader :always_use_https, :discoverable_by_email, :geo_enabled,
+ attr_reader :always_use_https, :discoverable_by_email, :geo_enabled,
:language, :protected, :screen_name, :show_all_inline_media, :sleep_time,
:time_zone
alias :protected? :protected
View
2  lib/twitter/size.rb
@@ -2,7 +2,7 @@
module Twitter
class Size < Twitter::Base
- attr_reader :h, :resize, :w
+ attr_reader :h, :resize, :w
alias :height :h
alias :width :w
View
9 lib/twitter/status.rb
@@ -15,7 +15,7 @@
module Twitter
class Status < Twitter::Identifiable
include Twitter::Creatable
- attr_reader :favorited, :favoriters, :favoriters_count, :from_user,
+ attr_reader :favorited, :favoriters, :favoriters_count, :from_user,
: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,
:iso_language_code, :profile_image_url, :profile_image_url_https,
@@ -97,6 +97,13 @@ def retweeted_status
@retweeted_status ||= self.class.new(@attrs['retweeted_status']) unless @attrs['retweeted_status'].nil?
end
+ # @note If retweeters_count is > 50 it will return the string 50+.
+ # @return [String]
+ def retweeters_count
+ @attrs['retweet_count'] || @attrs['retweeters_count']
+ end
+ alias :retweet_count :retweeters_count
+
# @note Must include entities in your request for this method to work
# @return [Array<Twitter::Entity::Url>]
def urls
View
2  lib/twitter/suggestion.rb
@@ -3,7 +3,7 @@
module Twitter
class Suggestion < Twitter::Base
- attr_reader :name, :size, :slug
+ attr_reader :name, :size, :slug
# @param other [Twitter::Suggestion]
# @return [Boolean]
View
2  lib/twitter/trend.rb
@@ -2,7 +2,7 @@
module Twitter
class Trend < Twitter::Base
- attr_reader :events, :name, :promoted_content, :query, :url
+ attr_reader :events, :name, :promoted_content, :query, :url
# @param other [Twitter::Trend]
# @return [Boolean]
View
2  lib/twitter/user.rb
@@ -8,7 +8,7 @@ module Twitter
class User < Twitter::Identifiable
include Twitter::Authenticatable
include Twitter::Creatable
- attr_reader :all_replies, :blocking, :can_dm, :connections,
+ attr_reader :all_replies, :blocking, :can_dm, :connections,
:contributors_enabled, :default_profile, :default_profile_image,
:description, :favourites_count, :follow_request_sent, :followed_by,
:followers_count, :following, :friends_count, :geo_enabled,
View
29 spec/twitter/status_spec.rb
@@ -40,18 +40,6 @@
end
end
- describe "#favoriters_count" do
- it "should return the count of favoriters when favoriters_count is set" do
- status = Twitter::Status.new('favoriters_count' => '1')
- status.favoriters_count.should be_a String
- status.favoriters_count.should == "1"
- end
- it "should return nil when not set" do
- status = Twitter::Status.new
- status.favoriters_count.should be_nil
- end
- end
-
describe "#from_user" do
it "should return a screen name when from_user is set" do
status = Twitter::Status.new('from_user' => 'sferik')
@@ -183,19 +171,12 @@
end
end
- describe "#repliers_count" do
- it "should return the count of favoriters when repliers_count is set" do
- status = Twitter::Status.new('repliers_count' => '1')
- status.repliers_count.should be_a String
- status.repliers_count.should == "1"
- end
- it "should return nil when not set" do
- status = Twitter::Status.new
- status.repliers_count.should be_nil
- end
- end
-
describe "#retweeters_count" do
+ it "should return the count of favoriters when retweet_count is set" do
+ status = Twitter::Status.new('retweet_count' => '1')
+ status.retweeters_count.should be_a String
+ status.retweeters_count.should == "1"
+ end
it "should return the count of favoriters when retweeters_count is set" do
status = Twitter::Status.new('retweeters_count' => '1')
status.retweeters_count.should be_a String
Please sign in to comment.
Something went wrong with that request. Please try again.