Skip to content

Commit

Permalink
Replace totals with user aliases
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Oct 14, 2011
1 parent 6a6a501 commit 1ad0928
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 34 deletions.
13 changes: 0 additions & 13 deletions lib/twitter/client/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -138,19 +138,6 @@ def update_profile(options={})
Twitter::User.new(user)
end

# Returns the current count of friends, followers, updates (statuses) and favorites of the authenticating user.
#
# @see https://dev.twitter.com/docs/api/1/get/account/totals
# @rate_limited Yes
# @requires_authentication Yes
# @return [Hash] the current count of friends, followers, updates, and favorites of the authenticating user.
# @raise [Twitter::Unauthorized] Error raised when supplied user credentials are not valid.
# @example Return the totals for the authenticating user.
# Twitter.totals
def totals(options={})
get("/1/account/totals.json", options)
end

# Updates the authenticating user's settings.
# Or, if no options supplied, returns settings (including current trend, geo and sleep time information) for the authenticating user.
#
Expand Down
8 changes: 8 additions & 0 deletions lib/twitter/user.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,14 +23,22 @@ class User < Twitter::Base
alias :default_profile_image? :default_profile_image
alias :follow_request_sent? :follow_request_sent
alias :following? :following
alias :favorites :favourites_count
alias :favorites_count :favourites_count
alias :favourites :favourites_count
alias :followers :followers_count
alias :friends :friends_count
alias :geo_enabled? :geo_enabled
alias :is_translator? :is_translator
alias :listed :listed_count
alias :notifications? :notifications
alias :profile_background_tile? :profile_background_tile
alias :profile_use_background_image? :profile_use_background_image
alias :protected? :protected
alias :statuses :statuses_count
alias :translator :is_translator
alias :translator? :is_translator
alias :updates :statuses_count
alias :verified? :verified

def initialize(user={})
Expand Down
21 changes: 0 additions & 21 deletions spec/twitter/client/account_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -177,27 +177,6 @@
end
end

describe ".totals" do

before do
stub_get("/1/account/totals.json").
to_return(:body => fixture("totals.json"), :headers => {:content_type => "application/json; charset=utf-8"})
end

it "should get the correct resource" do
@client.totals
a_get("/1/account/totals.json").
should have_been_made
end

it "should return a hash" do
totals = @client.totals
totals.should be_a Hash
totals['favorites'].should == 2811
end

end

describe ".settings" do

before do
Expand Down

0 comments on commit 1ad0928

Please sign in to comment.