Skip to content

Commit

Permalink
Move version out of endpoint and into path
Browse files Browse the repository at this point in the history
  • Loading branch information
sferik committed Sep 4, 2011
1 parent 1cc1f3c commit d156fd5
Show file tree
Hide file tree
Showing 49 changed files with 453 additions and 453 deletions.
22 changes: 11 additions & 11 deletions lib/twitter/client/account.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ module Account
# @example Return the requesting user if authentication was successful
# Twitter.verify_credentials
def verify_credentials(options={})
response = get('account/verify_credentials', options)
response = get('1/account/verify_credentials', options)
format.to_s.downcase == 'xml' ? response['user'] : response
end

Expand All @@ -34,7 +34,7 @@ def verify_credentials(options={})
# @example Return the remaining number of API requests available to the requesting user
# Twitter.rate_limit_status
def rate_limit_status(options={})
response = get('account/rate_limit_status', options)
response = get('1/account/rate_limit_status', options)
format.to_s.downcase == 'xml' ? response['hash'] : response
end

Expand All @@ -50,7 +50,7 @@ def rate_limit_status(options={})
# @example End the session of the authenticating user
# Twitter.end_session
def end_session(options={})
response = post('account/end_session', options)
response = post('1/account/end_session', options)
format.to_s.downcase == 'xml' ? response['hash'] : response
end

Expand All @@ -68,7 +68,7 @@ def end_session(options={})
# @example Turn SMS updates on for the authenticating user
# Twitter.update_delivery_device('sms')
def update_delivery_device(device, options={})
response = post('account/update_delivery_device', options.merge(:device => device))
response = post('1/account/update_delivery_device', options.merge(:device => device))
format.to_s.downcase == 'xml' ? response['user'] : response
end

Expand All @@ -90,7 +90,7 @@ def update_delivery_device(device, options={})
# @example Set authenticating user's profile background to black
# Twitter.update_profile_colors(:profile_background_color => '000000')
def update_profile_colors(options={})
response = post('account/update_profile_colors', options)
response = post('1/account/update_profile_colors', options)
format.to_s.downcase == 'xml' ? response['user'] : response
end

Expand All @@ -109,7 +109,7 @@ def update_profile_colors(options={})
# @example Update the authenticating user's profile image
# Twitter.update_profile_image(File.new("me.jpeg"))
def update_profile_image(image, options={})
response = post('account/update_profile_image', options.merge(:image => image))
response = post('1/account/update_profile_image', options.merge(:image => image))
format.to_s.downcase == 'xml' ? response['user'] : response
end

Expand All @@ -128,7 +128,7 @@ def update_profile_image(image, options={})
# @example Update the authenticating user's profile background image
# Twitter.update_profile_background_image(File.new("we_concept_bg2.png"))
def update_profile_background_image(image, options={})
response = post('account/update_profile_background_image', options.merge(:image => image))
response = post('1/account/update_profile_background_image', options.merge(:image => image))
format.to_s.downcase == 'xml' ? response['user'] : response
end

Expand All @@ -150,7 +150,7 @@ def update_profile_background_image(image, options={})
# @example Set authenticating user's name to Erik Michaels-Ober
# Twitter.update_profile(:name => "Erik Michaels-Ober")
def update_profile(options={})
response = post('account/update_profile', options)
response = post('1/account/update_profile', options)
format.to_s.downcase == 'xml' ? response['user'] : response
end

Expand All @@ -166,7 +166,7 @@ def update_profile(options={})
# @example Return the totals for the authenticating user.
# Twitter.totals
def totals()
response = get('account/totals')
response = get('1/account/totals')
format.to_s.downcase == 'xml' ? response['hash'] : response
end

Expand All @@ -193,9 +193,9 @@ def totals()
def settings(options = {})
case options.length
when 0
response = get('account/settings')
response = get('1/account/settings')
else
response = post('account/settings', options)
response = post('1/account/settings', options)
end
format.to_s.downcase == 'xml' ? response['hash'] : response
end
Expand Down
10 changes: 5 additions & 5 deletions lib/twitter/client/block.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ module Block
# Twitter.block(7505382) # Same as above
def block(user, options={})
merge_user_into_options!(user, options)
response = post('blocks/create', options)
response = post('1/blocks/create', options)
format.to_s.downcase == 'xml' ? response['user'] : response
end

Expand All @@ -40,7 +40,7 @@ def block(user, options={})
# Twitter.unblock(7505382) # Same as above
def unblock(user, options={})
merge_user_into_options!(user, options)
response = delete('blocks/destroy', options)
response = delete('1/blocks/destroy', options)
format.to_s.downcase == 'xml' ? response['user'] : response
end

Expand All @@ -57,7 +57,7 @@ def unblock(user, options={})
# Twitter.block?(7505382) # Same as above
def block?(user, options={})
merge_user_into_options!(user, options)
get('blocks/exists', options, :raw)
get('1/blocks/exists', options, :raw)
true
rescue Twitter::NotFound
false
Expand Down Expand Up @@ -94,7 +94,7 @@ def block_exists?(user, options={})
# @example Return an array of user objects that the authenticating user is blocking
# Twitter.blocking
def blocking(options={})
response = get('blocks/blocking', options)
response = get('1/blocks/blocking', options)
format.to_s.downcase == 'xml' ? response['users'] : response
end

Expand All @@ -110,7 +110,7 @@ def blocking(options={})
# @example Return an array of numeric user ids the authenticating user is blocking
# Twitter.blocking_ids
def blocked_ids(options={})
response = get('blocks/blocking/ids', options)
response = get('1/blocks/blocking/ids', options)
format.to_s.downcase == 'xml' ? response['ids']['id'].map{|id| id.to_i} : response
end
end
Expand Down
8 changes: 4 additions & 4 deletions lib/twitter/client/direct_messages.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ module DirectMessages
# @example Return the 20 most recent direct messages sent to the authenticating user
# Twitter.direct_messages
def direct_messages(options={})
response = get('direct_messages', options)
response = get('1/direct_messages', options)
format.to_s.downcase == 'xml' ? response['direct_messages'] : response
end

Expand All @@ -40,7 +40,7 @@ def direct_messages(options={})
# @example Return the 20 most recent direct messages sent by the authenticating user
# Twitter.direct_messages_sent
def direct_messages_sent(options={})
response = get('direct_messages/sent', options)
response = get('1/direct_messages/sent', options)
format.to_s.downcase == 'xml' ? response['direct_messages'] : response
end

Expand All @@ -61,7 +61,7 @@ def direct_messages_sent(options={})
# Twitter.direct_message_create(7505382, "I'm sending you this message via the Twitter Ruby Gem!") # Same as above
def direct_message_create(user, text, options={})
merge_user_into_options!(user, options)
response = post('direct_messages/new', options.merge(:text => text))
response = post('1/direct_messages/new', options.merge(:text => text))
format.to_s.downcase == 'xml' ? response['direct_message'] : response
end

Expand All @@ -80,7 +80,7 @@ def direct_message_create(user, text, options={})
# @example Destroys the direct message with the ID 1825785544
# Twitter.direct_message_destroy(1825785544)
def direct_message_destroy(id, options={})
response = delete("direct_messages/destroy/#{id}", options)
response = delete("1/direct_messages/destroy/#{id}", options)
format.to_s.downcase == 'xml' ? response['direct_message'] : response
end
end
Expand Down
6 changes: 3 additions & 3 deletions lib/twitter/client/favorites.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ module Favorites
def favorites(*args)
options = args.last.is_a?(Hash) ? args.pop : {}
user = args.first
response = get(['favorites', user].compact.join('/'), options)
response = get([1, 'favorites', user].compact.join('/'), options)
format.to_s.downcase == 'xml' ? response['statuses'] : response
end

Expand All @@ -46,7 +46,7 @@ def favorites(*args)
# @example Favorite the status with the ID 25938088801
# Twitter.favorite_create(25938088801)
def favorite_create(id, options={})
response = post("favorites/create/#{id}", options)
response = post("1/favorites/create/#{id}", options)
format.to_s.downcase == 'xml' ? response['status'] : response
end

Expand All @@ -64,7 +64,7 @@ def favorite_create(id, options={})
# @example Un-favorite the status with the ID 25938088801
# Twitter.favorite_destroy(25938088801)
def favorite_destroy(id, options={})
response = delete("favorites/destroy/#{id}", options)
response = delete("1/favorites/destroy/#{id}", options)
format.to_s.downcase == 'xml' ? response['status'] : response
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/client/friends_and_followers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ def friend_ids(*args)
options.merge!(args.last.is_a?(Hash) ? args.pop : {})
user = args.first
merge_user_into_options!(user, options)
response = get('friends/ids', options)
response = get('1/friends/ids', options)
format.to_s.downcase == 'xml' ? Hashie::Mash.new(:ids => response['id_list']['ids']['id'].map{|id| id.to_i}) : response
end

Expand Down Expand Up @@ -66,7 +66,7 @@ def follower_ids(*args)
options.merge!(args.last.is_a?(Hash) ? args.pop : {})
user = args.first
merge_user_into_options!(user, options)
response = get('followers/ids', options)
response = get('1/followers/ids', options)
format.to_s.downcase == 'xml' ? Hashie::Mash.new(:ids => response['id_list']['ids']['id'].map{|id| id.to_i}) : response
end
end
Expand Down
12 changes: 6 additions & 6 deletions lib/twitter/client/friendship.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def follow(user, options={})
# Twitter always turns on notifications if the "follow" option is present, even if it's set to false
# so only send follow if it's true
options.merge!(:follow => true) if options.delete(:follow)
response = post('friendships/create', options)
response = post('1/friendships/create', options)
format.to_s.downcase == 'xml' ? response['user'] : response
end
alias :friendship_create :follow
Expand All @@ -41,7 +41,7 @@ def follow(user, options={})
# Twitter.unfollow("sferik")
def unfollow(user, options={})
merge_user_into_options!(user, options)
response = delete('friendships/destroy', options)
response = delete('1/friendships/destroy', options)
format.to_s.downcase == 'xml' ? response['user'] : response
end
alias :friendship_destroy :unfollow
Expand All @@ -61,7 +61,7 @@ def unfollow(user, options={})
# @example Return true if @sferik follows @pengwynn
# Twitter.friendship?("sferik", "pengwynn")
def friendship?(user_a, user_b, options={})
response = get('friendships/exists', options.merge(:user_a => user_a, :user_b => user_b))
response = get('1/friendships/exists', options.merge(:user_a => user_a, :user_b => user_b))
format.to_s.downcase == 'xml' ? !%w(0 false).include?(response['friends']) : response
end

Expand Down Expand Up @@ -101,7 +101,7 @@ def friendship_exists?(user_a, user_b, options={})
# Twitter.friendship(:source_screen_name => "sferik", :target_screen_name => "pengwynn")
# Twitter.friendship(:source_id => 7505382, :target_id => 14100886)
def friendship(options={})
get('friendships/show', options)['relationship']
get('1/friendships/show', options)['relationship']
end
alias :friendship_show :friendship

Expand All @@ -119,7 +119,7 @@ def friendship(options={})
# Twitter.friendships_incoming
def friendships_incoming(options={})
options = {:cursor => -1}.merge(options)
response = get('friendships/incoming', options)
response = get('1/friendships/incoming', options)
format.to_s.downcase == 'xml' ? Hashie::Mash.new(:ids => response['id_list']['ids']['id'].map{|id| id.to_i}) : response
end

Expand All @@ -137,7 +137,7 @@ def friendships_incoming(options={})
# Twitter.friendships_outgoing
def friendships_outgoing(options={})
options = {:cursor => -1}.merge(options)
response = get('friendships/outgoing', options)
response = get('1/friendships/outgoing', options)
format.to_s.downcase == 'xml' ? Hashie::Mash.new(:ids => response['id_list']['ids']['id'].map{|id| id.to_i}) : response
end
end
Expand Down
10 changes: 5 additions & 5 deletions lib/twitter/client/geo.rb
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ module Geo
# @example Return an array of places near the IP address 74.125.19.104
# Twitter.places_nearby(:ip => "74.125.19.104")
def places_nearby(options={})
get('geo/search', options, :json)['result']['places']
get('1/geo/search', options, :json)['result']['places']
end
alias :geo_search :places_nearby

Expand All @@ -44,7 +44,7 @@ def places_nearby(options={})
# @example Return an array of places similar to Twitter HQ
# Twitter.places_similar(:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ")
def places_similar(options={})
get('geo/similar_places', options, :json)['result']
get('1/geo/similar_places', options, :json)['result']
end

# Searches for up to 20 places that can be used as a place_id
Expand All @@ -64,7 +64,7 @@ def places_similar(options={})
# @example Return an array of places within the specified region
# Twitter.reverse_geocode(:lat => "37.7821120598956", :long => "-122.400612831116")
def reverse_geocode(options={})
get('geo/reverse_geocode', options, :json)['result']['places']
get('1/geo/reverse_geocode', options, :json)['result']['places']
end

# Returns all the information about a known place
Expand All @@ -79,7 +79,7 @@ def reverse_geocode(options={})
# @example Return all the information about Twitter HQ
# Twitter.place("247f43d441defc03")
def place(place_id, options={})
get("geo/id/#{place_id}", options, :json)
get("1/geo/id/#{place_id}", options, :json)
end

# Creates a new place at the given latitude and longitude
Expand All @@ -99,7 +99,7 @@ def place(place_id, options={})
# @example Create a new place
# Twitter.place_create(:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581")
def place_create(options={})
post('geo/place', options, :json)
post('1/geo/place', options, :json)
end
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/client/help.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Help
# @example Return the current configuration used by Twitter
# Twitter.configuration
def configuration(options={})
response = get('help/configuration', options)
response = get('1/help/configuration', options)
format.to_s.downcase == 'xml' ? response['configuration'] : response
end

Expand All @@ -28,7 +28,7 @@ def configuration(options={})
# @example Return the list of languages Twitter supports
# Twitter.languages
def languages(options={})
response = get('help/languages', options)
response = get('1/help/languages', options)
format.to_s.downcase == 'xml' ? response['languages']['language'] : response
end
end
Expand Down
4 changes: 2 additions & 2 deletions lib/twitter/client/legal.rb
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ module Legal
# @example Return {https://twitter.com/tos Twitter's Terms of Service}
# Twitter.tos
def tos(options={})
get('legal/tos', options)['tos']
get('1/legal/tos', options)['tos']
end

# Returns {https://twitter.com/privacy Twitter's Privacy Policy}
Expand All @@ -27,7 +27,7 @@ def tos(options={})
# @example Return {https://twitter.com/privacy Twitter's Privacy Policy}
# Twitter.privacy
def privacy(options={})
get('legal/privacy', options)['privacy']
get('1/legal/privacy', options)['privacy']
end
end
end
Expand Down
Loading

0 comments on commit d156fd5

Please sign in to comment.