From d156fd54a8591b44b22f72890099fce0ce4d58c8 Mon Sep 17 00:00:00 2001 From: Erik Michaels-Ober Date: Sun, 4 Sep 2011 14:03:43 -0400 Subject: [PATCH] Move version out of endpoint and into path --- lib/twitter/client/account.rb | 22 ++-- lib/twitter/client/block.rb | 10 +- lib/twitter/client/direct_messages.rb | 8 +- lib/twitter/client/favorites.rb | 6 +- lib/twitter/client/friends_and_followers.rb | 4 +- lib/twitter/client/friendship.rb | 12 +- lib/twitter/client/geo.rb | 10 +- lib/twitter/client/help.rb | 4 +- lib/twitter/client/legal.rb | 4 +- lib/twitter/client/list.rb | 16 +-- lib/twitter/client/list_members.rb | 10 +- lib/twitter/client/list_subscribers.rb | 8 +- lib/twitter/client/local_trends.rb | 4 +- lib/twitter/client/notification.rb | 4 +- lib/twitter/client/saved_searches.rb | 8 +- lib/twitter/client/search.rb | 4 +- lib/twitter/client/spam_reporting.rb | 2 +- lib/twitter/client/timeline.rb | 16 +-- lib/twitter/client/trends.rb | 8 +- lib/twitter/client/tweets.rb | 14 +-- lib/twitter/client/urls.rb | 2 +- lib/twitter/client/user.rb | 26 ++--- lib/twitter/configuration.rb | 4 +- spec/faraday/response_spec.rb | 6 +- spec/twitter/base_spec.rb | 4 +- spec/twitter/client/account_spec.rb | 44 ++++---- spec/twitter/client/block_spec.rb | 22 ++-- spec/twitter/client/direct_messages_spec.rb | 16 +-- spec/twitter/client/favorites_spec.rb | 16 +-- .../client/friends_and_followers_spec.rb | 16 +-- spec/twitter/client/friendship_spec.rb | 34 +++--- spec/twitter/client/geo_spec.rb | 20 ++-- spec/twitter/client/help_spec.rb | 8 +- spec/twitter/client/legal_spec.rb | 8 +- spec/twitter/client/list_members_spec.rb | 92 ++++++++-------- spec/twitter/client/list_spec.rb | 104 +++++++++--------- spec/twitter/client/list_subscribers_spec.rb | 72 ++++++------ spec/twitter/client/local_trends_spec.rb | 12 +- spec/twitter/client/notification_spec.rb | 8 +- spec/twitter/client/saved_searches_spec.rb | 16 +-- spec/twitter/client/search_spec.rb | 8 +- spec/twitter/client/spam_reporting_spec.rb | 4 +- spec/twitter/client/timeline_spec.rb | 44 ++++---- spec/twitter/client/trends_spec.rb | 16 +-- spec/twitter/client/tweets_spec.rb | 28 ++--- spec/twitter/client/urls_spec.rb | 4 +- spec/twitter/client/user_spec.rb | 90 +++++++-------- spec/twitter/client_spec.rb | 4 +- spec/twitter_spec.rb | 4 +- 49 files changed, 453 insertions(+), 453 deletions(-) diff --git a/lib/twitter/client/account.rb b/lib/twitter/client/account.rb index 93a9376e7..d6d1c0703 100644 --- a/lib/twitter/client/account.rb +++ b/lib/twitter/client/account.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/lib/twitter/client/block.rb b/lib/twitter/client/block.rb index 57bb1fd00..684dbacbe 100644 --- a/lib/twitter/client/block.rb +++ b/lib/twitter/client/block.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/lib/twitter/client/direct_messages.rb b/lib/twitter/client/direct_messages.rb index fc936dae4..1a3674c04 100644 --- a/lib/twitter/client/direct_messages.rb +++ b/lib/twitter/client/direct_messages.rb @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/lib/twitter/client/favorites.rb b/lib/twitter/client/favorites.rb index 29363edc8..41850f453 100644 --- a/lib/twitter/client/favorites.rb +++ b/lib/twitter/client/favorites.rb @@ -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 @@ -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 @@ -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 diff --git a/lib/twitter/client/friends_and_followers.rb b/lib/twitter/client/friends_and_followers.rb index 1ac87ab65..326b5219e 100644 --- a/lib/twitter/client/friends_and_followers.rb +++ b/lib/twitter/client/friends_and_followers.rb @@ -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 @@ -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 diff --git a/lib/twitter/client/friendship.rb b/lib/twitter/client/friendship.rb index 957d408b7..aa0714483 100644 --- a/lib/twitter/client/friendship.rb +++ b/lib/twitter/client/friendship.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/lib/twitter/client/geo.rb b/lib/twitter/client/geo.rb index a0093d013..cc419ffeb 100644 --- a/lib/twitter/client/geo.rb +++ b/lib/twitter/client/geo.rb @@ -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 @@ -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 @@ -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 @@ -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 @@ -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 diff --git a/lib/twitter/client/help.rb b/lib/twitter/client/help.rb index 5348d834a..954638a15 100644 --- a/lib/twitter/client/help.rb +++ b/lib/twitter/client/help.rb @@ -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 @@ -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 diff --git a/lib/twitter/client/legal.rb b/lib/twitter/client/legal.rb index f8d6b2ef4..7a245065d 100644 --- a/lib/twitter/client/legal.rb +++ b/lib/twitter/client/legal.rb @@ -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} @@ -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 diff --git a/lib/twitter/client/list.rb b/lib/twitter/client/list.rb index 47847a6ba..7ff73af5e 100644 --- a/lib/twitter/client/list.rb +++ b/lib/twitter/client/list.rb @@ -35,7 +35,7 @@ def list_create(*args) if screen_name = args.pop warn "#{caller.first}: [DEPRECATION] Calling #list_create with a screen_name is deprecated and will be removed in the next major version. Please omit the screen_name argument." end - response = post("lists/create", options.merge(:name => name)) + response = post("1/lists/create", options.merge(:name => name)) format.to_s.downcase == 'xml' ? response['list'] : response end @@ -74,7 +74,7 @@ def list_update(*args) user = args.pop || get_screen_name merge_list_into_options!(list, options) merge_owner_into_options!(user, options) - response = post("lists/update", options) + response = post("1/lists/update", options) format.to_s.downcase == 'xml' ? response['list'] : response end @@ -105,7 +105,7 @@ def lists(*args) options = {:cursor => -1}.merge(args.last.is_a?(Hash) ? args.pop : {}) user = args.first merge_user_into_options!(user, options) if user - response = get("lists", options) + response = get("1/lists", options) format.to_s.downcase == 'xml' ? response['lists_list'] : response end @@ -141,7 +141,7 @@ def list(*args) user = args.pop || get_screen_name merge_list_into_options!(list, options) merge_owner_into_options!(user, options) - response = get("lists/show", options) + response = get("1/lists/show", options) format.to_s.downcase == 'xml' ? response['list'] : response end @@ -177,7 +177,7 @@ def list_delete(*args) user = args.pop || get_screen_name merge_list_into_options!(list, options) merge_owner_into_options!(user, options) - response = delete("lists/destroy", options) + response = delete("1/lists/destroy", options) format.to_s.downcase == 'xml' ? response['list'] : response end @@ -222,7 +222,7 @@ def list_timeline(*args) user = args.pop || get_screen_name merge_list_into_options!(list, options) merge_owner_into_options!(user, options) - response = get("lists/statuses", options) + response = get("1/lists/statuses", options) format.to_s.downcase == 'xml' ? response['statuses'] : response end @@ -252,7 +252,7 @@ def memberships(*args) options = {:cursor => -1}.merge(args.last.is_a?(Hash) ? args.pop : {}) user = args.pop || get_screen_name merge_user_into_options!(user, options) - response = get("lists/memberships", options) + response = get("1/lists/memberships", options) format.to_s.downcase == 'xml' ? response['lists_list'] : response end @@ -282,7 +282,7 @@ def subscriptions(*args) options = {:cursor => -1}.merge(args.last.is_a?(Hash) ? args.pop : {}) user = args.pop || get_screen_name merge_user_into_options!(user, options) - response = get("lists/subscriptions", options) + response = get("1/lists/subscriptions", options) format.to_s.downcase == 'xml' ? response['lists_list'] : response end end diff --git a/lib/twitter/client/list_members.rb b/lib/twitter/client/list_members.rb index 19ec77d49..aeae35651 100644 --- a/lib/twitter/client/list_members.rb +++ b/lib/twitter/client/list_members.rb @@ -39,7 +39,7 @@ def list_members(*args) user = args.pop || get_screen_name merge_list_into_options!(list, options) merge_owner_into_options!(user, options) - response = get("lists/members", options) + response = get("1/lists/members", options) format.to_s.downcase == 'xml' ? response['users_list'] : response end @@ -78,7 +78,7 @@ def list_add_member(*args) merge_list_into_options!(list, options) merge_owner_into_options!(user, options) merge_user_into_options!(user_to_add, options) - response = post("lists/members/create", options) + response = post("1/lists/members/create", options) format.to_s.downcase == 'xml' ? response['list'] : response end @@ -119,7 +119,7 @@ def list_add_members(*args) merge_list_into_options!(list, options) merge_owner_into_options!(user, options) merge_users_into_options!(Array(users_to_add), options) - response = post("lists/members/create_all", options) + response = post("1/lists/members/create_all", options) format.to_s.downcase == 'xml' ? response['list'] : response end @@ -158,7 +158,7 @@ def list_remove_member(*args) merge_list_into_options!(list, options) merge_owner_into_options!(user, options) merge_user_into_options!(user_to_remove, options) - response = post("lists/members/destroy", options) + response = post("1/lists/members/destroy", options) format.to_s.downcase == 'xml' ? response['list'] : response end @@ -193,7 +193,7 @@ def list_member?(*args) merge_list_into_options!(list, options) merge_owner_into_options!(user, options) merge_user_into_options!(user_to_check, options) - get("lists/members/show", options, :raw) + get("1/lists/members/show", options, :raw) true rescue Twitter::NotFound, Twitter::Forbidden false diff --git a/lib/twitter/client/list_subscribers.rb b/lib/twitter/client/list_subscribers.rb index da17a4d44..23a68e8af 100644 --- a/lib/twitter/client/list_subscribers.rb +++ b/lib/twitter/client/list_subscribers.rb @@ -38,7 +38,7 @@ def list_subscribers(*args) user = args.pop || get_screen_name merge_list_into_options!(list, options) merge_owner_into_options!(user, options) - response = get("lists/subscribers", options) + response = get("1/lists/subscribers", options) format.to_s.downcase == 'xml' ? response['users_list'] : response end @@ -72,7 +72,7 @@ def list_subscribe(*args) user = args.pop || get_screen_name merge_list_into_options!(list, options) merge_owner_into_options!(user, options) - response = post("lists/subscribers/create", options) + response = post("1/lists/subscribers/create", options) format.to_s.downcase == 'xml' ? response['list'] : response end @@ -106,7 +106,7 @@ def list_unsubscribe(*args) user = args.pop || get_screen_name merge_list_into_options!(list, options) merge_owner_into_options!(user, options) - response = post("lists/subscribers/destroy", options) + response = post("1/lists/subscribers/destroy", options) format.to_s.downcase == 'xml' ? response['list'] : response end @@ -145,7 +145,7 @@ def list_subscriber?(*args) merge_list_into_options!(list, options) merge_owner_into_options!(user, options) merge_user_into_options!(user_to_check, options) - get("lists/subscribers/show", options, :raw) + get("1/lists/subscribers/show", options, :raw) true rescue Twitter::NotFound, Twitter::Forbidden false diff --git a/lib/twitter/client/local_trends.rb b/lib/twitter/client/local_trends.rb index 4f8c65728..1b1844253 100644 --- a/lib/twitter/client/local_trends.rb +++ b/lib/twitter/client/local_trends.rb @@ -17,7 +17,7 @@ module LocalTrends # @example Return the locations that Twitter has trending topic information for # Twitter.trend_locations def trend_locations(options={}) - response = get('trends/available', options) + response = get('1/trends/available', options) format.to_s.downcase == 'xml' ? response['locations'] : response end @@ -34,7 +34,7 @@ def trend_locations(options={}) # @example Return the top 10 trending topics for San Francisco # Twitter.local_trends(2487956) def local_trends(woeid=1, options={}) - response = get("trends/#{woeid}", options) + response = get("1/trends/#{woeid}", options) format.to_s.downcase == 'xml' ? response['matching_trends'].first.trend : response.first.trends.map{|trend| trend.name} end end diff --git a/lib/twitter/client/notification.rb b/lib/twitter/client/notification.rb index 60a0578d1..d6d0cf8ee 100644 --- a/lib/twitter/client/notification.rb +++ b/lib/twitter/client/notification.rb @@ -18,7 +18,7 @@ module Notification # Twitter.enable_notifications(7505382) # Same as above def enable_notifications(user, options={}) merge_user_into_options!(user, options) - response = post('notifications/follow', options) + response = post('1/notifications/follow', options) format.to_s.downcase == 'xml' ? response['user'] : response end @@ -38,7 +38,7 @@ def enable_notifications(user, options={}) # Twitter.disable_notifications(7505382) # Same as above def disable_notifications(user, options={}) merge_user_into_options!(user, options) - response = post('notifications/leave', options) + response = post('1/notifications/leave', options) format.to_s.downcase == 'xml' ? response['user'] : response end end diff --git a/lib/twitter/client/saved_searches.rb b/lib/twitter/client/saved_searches.rb index 4a5c72f8b..8c3f332de 100644 --- a/lib/twitter/client/saved_searches.rb +++ b/lib/twitter/client/saved_searches.rb @@ -14,7 +14,7 @@ module SavedSearches # @example Return the authenticated user's saved search queries # Twitter.saved_searches def saved_searches(options={}) - response = get('saved_searches', options) + response = get('1/saved_searches', options) format.to_s.downcase == 'xml' ? response['saved_searches'] : response end @@ -31,7 +31,7 @@ def saved_searches(options={}) # @example Retrieve the data for a saved search owned by the authenticating user with the ID 16129012 # Twitter.saved_search(16129012) def saved_search(id, options={}) - response = get("saved_searches/show/#{id}", options) + response = get("1/saved_searches/show/#{id}", options) format.to_s.downcase == 'xml' ? response['saved_search'] : response end @@ -48,7 +48,7 @@ def saved_search(id, options={}) # @example Create a saved search for the authenticated user with the query "twitter" # Twitter.saved_search_create("twitter") def saved_search_create(query, options={}) - response = post('saved_searches/create', options.merge(:query => query)) + response = post('1/saved_searches/create', options.merge(:query => query)) format.to_s.downcase == 'xml' ? response['saved_search'] : response end @@ -66,7 +66,7 @@ def saved_search_create(query, options={}) # @example Destroys a saved search for the authenticated user with the ID 16129012 # Twitter.saved_search_destroy(16129012) def saved_search_destroy(id, options={}) - response = delete("saved_searches/destroy/#{id}", options) + response = delete("1/saved_searches/destroy/#{id}", options) format.to_s.downcase == 'xml' ? response['saved_search'] : response end end diff --git a/lib/twitter/client/search.rb b/lib/twitter/client/search.rb index c9fbc11d0..6c6c1ed48 100644 --- a/lib/twitter/client/search.rb +++ b/lib/twitter/client/search.rb @@ -17,7 +17,7 @@ module Search # @example Return recent images related to twitter # Twitter.image_facets('twitter') def image_facets(q, options={}) - response = get('search/image_facets', options.merge(:q => q)) + response = get('i/search/image_facets', options.merge(:q => q)) format.to_s.downcase == 'xml' ? response['statuses'] : response end @@ -36,7 +36,7 @@ def image_facets(q, options={}) # @example Return recent videos related to twitter # Twitter.video_facets('twitter') def video_facets(q, options={}) - response = get('search/video_facets', options.merge(:q => q)) + response = get('i/search/video_facets', options.merge(:q => q)) format.to_s.downcase == 'xml' ? response['statuses'] : response end end diff --git a/lib/twitter/client/spam_reporting.rb b/lib/twitter/client/spam_reporting.rb index b1fc25585..f75003c31 100644 --- a/lib/twitter/client/spam_reporting.rb +++ b/lib/twitter/client/spam_reporting.rb @@ -19,7 +19,7 @@ module SpamReporting # Twitter.report_spam(14589771) # Same as above def report_spam(user, options={}) merge_user_into_options!(user, options) - response = post('report_spam', options) + response = post('1/report_spam', options) format.to_s.downcase == 'xml' ? response['user'] : response end end diff --git a/lib/twitter/client/timeline.rb b/lib/twitter/client/timeline.rb index 87a86b2a7..9ba911e6f 100644 --- a/lib/twitter/client/timeline.rb +++ b/lib/twitter/client/timeline.rb @@ -17,7 +17,7 @@ module Timeline # @example Return the 20 most recent statuses, including retweets if they exist, from non-protected users # Twitter.public_timeline def public_timeline(options={}) - response = get('statuses/public_timeline', options) + response = get('1/statuses/public_timeline', options) format.to_s.downcase == 'xml' ? response['statuses'] : response end @@ -41,7 +41,7 @@ def public_timeline(options={}) # @example Return the 20 most recent statuses, including retweets if they exist, posted by the authenticating user and the users they follow # Twitter.home_timeline def home_timeline(options={}) - response = get('statuses/home_timeline', options) + response = get('1/statuses/home_timeline', options) format.to_s.downcase == 'xml' ? response['statuses'] : response end @@ -96,7 +96,7 @@ def user_timeline(*args) options = args.last.is_a?(Hash) ? args.pop : {} user = args.first || get_screen_name merge_user_into_options!(user, options) - response = get('statuses/user_timeline', options) + response = get('1/statuses/user_timeline', options) format.to_s.downcase == 'xml' ? response['statuses'] : response end @@ -120,7 +120,7 @@ def user_timeline(*args) # @example Return the 20 most recent mentions (statuses containing @username) for the authenticating user # Twitter.mentions def mentions(options={}) - response = get('statuses/mentions', options) + response = get('1/statuses/mentions', options) format.to_s.downcase == 'xml' ? response['statuses'] : response end @@ -142,7 +142,7 @@ def mentions(options={}) # @example Return the 20 most recent retweets posted by the authenticating user # Twitter.retweeted_by_me def retweeted_by_me(options={}) - response = get('statuses/retweeted_by_me', options) + response = get('1/statuses/retweeted_by_me', options) format.to_s.downcase == 'xml' ? response['statuses'] : response end @@ -164,7 +164,7 @@ def retweeted_by_me(options={}) # @example Return the 20 most recent retweets posted by users followed by the authenticating user # Twitter.retweeted_to_me def retweeted_to_me(options={}) - response = get('statuses/retweeted_to_me', options) + response = get('1/statuses/retweeted_to_me', options) format.to_s.downcase == 'xml' ? response['statuses'] : response end @@ -186,7 +186,7 @@ def retweeted_to_me(options={}) # @example Return the 20 most recent tweets of the authenticated user that have been retweeted by others # Twitter.retweets_of_me def retweets_of_me(options={}) - response = get('statuses/retweets_of_me', options) + response = get('1/statuses/retweets_of_me', options) format.to_s.downcase == 'xml' ? response['statuses'] : response end @@ -213,7 +213,7 @@ def media_timeline(*args) options = args.last.is_a?(Hash) ? args.pop : {} user = args.first || get_screen_name merge_user_into_options!(user, options) - response = get('statuses/media_timeline', options) + response = get('1/statuses/media_timeline', options) format.to_s.downcase == 'xml' ? response['statuses'] : response end end diff --git a/lib/twitter/client/trends.rb b/lib/twitter/client/trends.rb index c2ae3b620..abfd10591 100644 --- a/lib/twitter/client/trends.rb +++ b/lib/twitter/client/trends.rb @@ -14,7 +14,7 @@ module Trends # @example Return the top ten topics that are currently trending on Twitter # Twitter.trends def trends(options={}) - get('trends', options, :json)['trends'] + get('1/trends', options, :json)['trends'] end # Returns the current top 10 trending topics on Twitter @@ -29,7 +29,7 @@ def trends(options={}) # @example Return the current top 10 trending topics on Twitter # Twitter.trends_current def trends_current(options={}) - get('trends/current', options, :json)['trends'] + get('1/trends/current', options, :json)['trends'] end # Returns the top 20 trending topics for each hour in a given day @@ -45,7 +45,7 @@ def trends_current(options={}) # @example Return the top 20 trending topics for each hour of October 24, 2010 # Twitter.trends_daily(Date.parse("2010-10-24")) def trends_daily(date=Date.today, options={}) - get('trends/daily', options.merge(:date => date.strftime('%Y-%m-%d')), :json)['trends'] + get('1/trends/daily', options.merge(:date => date.strftime('%Y-%m-%d')), :json)['trends'] end # Returns the top 30 trending topics for each day in a given week @@ -61,7 +61,7 @@ def trends_daily(date=Date.today, options={}) # @example Return the top ten topics that are currently trending on Twitter # Twitter.trends_weekly(Date.parse("2010-10-24")) def trends_weekly(date=Date.today, options={}) - get('trends/weekly', options.merge(:date => date.strftime('%Y-%m-%d')), :json)['trends'] + get('1/trends/weekly', options.merge(:date => date.strftime('%Y-%m-%d')), :json)['trends'] end end end diff --git a/lib/twitter/client/tweets.rb b/lib/twitter/client/tweets.rb index 247310df3..d3c98b1c9 100644 --- a/lib/twitter/client/tweets.rb +++ b/lib/twitter/client/tweets.rb @@ -17,7 +17,7 @@ module Tweets # @example Return the status with the ID 25938088801 # Twitter.status(25938088801) def status(id, options={}) - response = get("statuses/show/#{id}", options) + response = get("1/statuses/show/#{id}", options) format.to_s.downcase == 'xml' ? response['status'] : response end @@ -42,7 +42,7 @@ def status(id, options={}) # @example Update the authenticating user's status # Twitter.update("I just posted a status update via the Twitter Ruby Gem!") def update(status, options={}) - response = post('statuses/update', options.merge(:status => status)) + response = post('1/statuses/update', options.merge(:status => status)) format.to_s.downcase == 'xml' ? response['status'] : response end @@ -72,7 +72,7 @@ def update(status, options={}) # download the pic and put the response in a StringIO object # Twitter.update("I just posted a status update with a pic via the Twitter Ruby Gem!", {'io' => StringIO.new(pic), 'type' => 'jpg'}) def update_with_media(status, image, options={}) - response = post('statuses/update_with_media', options.merge('media[]' => image, 'status' => status), format, media_endpoint) + response = post('1/statuses/update_with_media', options.merge('media[]' => image, 'status' => status), format, media_endpoint) format.to_s.downcase == 'xml' ? response['status'] : response end @@ -92,7 +92,7 @@ def update_with_media(status, image, options={}) # @example Destroy the status with the ID 25938088801 # Twitter.status_destroy(25938088801) def status_destroy(id, options={}) - response = delete("statuses/destroy/#{id}", options) + response = delete("1/statuses/destroy/#{id}", options) format.to_s.downcase == 'xml' ? response['status'] : response end @@ -112,7 +112,7 @@ def status_destroy(id, options={}) # @example Retweet the status with the ID 28561922516 # Twitter.retweet(28561922516) def retweet(id, options={}) - response = post("statuses/retweet/#{id}", options) + response = post("1/statuses/retweet/#{id}", options) format.to_s.downcase == 'xml' ? response['status'] : response end @@ -132,7 +132,7 @@ def retweet(id, options={}) # @example Return up to 100 of the first retweets of the status with the ID 28561922516 # Twitter.retweets(28561922516) def retweets(id, options={}) - response = get("statuses/retweets/#{id}", options) + response = get("1/statuses/retweets/#{id}", options) format.to_s.downcase == 'xml' ? response['statuses'] : response end @@ -156,7 +156,7 @@ def retweets(id, options={}) # Twitter.retweeters_of(28561922516) def retweeters_of(id, options={}) ids_only = !!options.delete(:ids_only) - response = get("statuses/#{id}/retweeted_by#{'/ids' if ids_only}", options) + response = get("1/statuses/#{id}/retweeted_by#{'/ids' if ids_only}", options) format.to_s.downcase == 'xml' ? response['users'] : response end end diff --git a/lib/twitter/client/urls.rb b/lib/twitter/client/urls.rb index de40b032b..378110551 100644 --- a/lib/twitter/client/urls.rb +++ b/lib/twitter/client/urls.rb @@ -17,7 +17,7 @@ module Urls # Twitter.resolve(['http://t.co/uw5bn1w', 'http://t.co/dXvMz9i']) # Same as above def resolve(*args) options = args.last.is_a?(Hash) ? args.pop : {} - get("urls/resolve", options.merge("urls[]" => args), :json) + get("1/urls/resolve", options.merge("urls[]" => args), :json) end end end diff --git a/lib/twitter/client/user.rb b/lib/twitter/client/user.rb index 4b6c1aa27..f64b004d3 100644 --- a/lib/twitter/client/user.rb +++ b/lib/twitter/client/user.rb @@ -21,7 +21,7 @@ def user(*args) options = args.last.is_a?(Hash) ? args.pop : {} user = args.first || get_screen_name merge_user_into_options!(user, options) - response = get('users/show', options) + response = get('1/users/show', options) format.to_s.downcase == 'xml' ? response['user'] : response end @@ -36,7 +36,7 @@ def user(*args) # @rate_limited Yes def user?(user, options={}) merge_user_into_options!(user, options) - get('users/show', options, :raw) + get('1/users/show', options, :raw) true rescue Twitter::NotFound false @@ -62,7 +62,7 @@ def users(*args) options = args.last.is_a?(Hash) ? args.pop : {} users = args merge_users_into_options!(Array(users), options) - response = get('users/lookup', options) + response = get('1/users/lookup', options) format.to_s.downcase == 'xml' ? response['users'] : response end @@ -82,7 +82,7 @@ def users(*args) # @example Return users that match "Erik Michaels-Ober" # Twitter.user_search("Erik Michaels-Ober") def user_search(query, options={}) - response = get('users/search', options.merge(:q => query)) + response = get('1/users/search', options.merge(:q => query)) format.to_s.downcase == 'xml' ? response['users'] : response end @@ -114,7 +114,7 @@ def user_search(query, options={}) def suggestions(*args) options = args.last.is_a?(Hash) ? args.pop : {} slug = args.first - response = get(['users/suggestions', slug].compact.join('/'), options) + response = get([1, 'users', 'suggestions', slug].compact.join('/'), options) xml_key = slug ? 'category' : 'suggestions' format.to_s.downcase == 'xml' ? response[xml_key] : response end @@ -136,7 +136,7 @@ def suggestions(*args) def profile_image(*args) options = args.last.is_a?(Hash) ? args.pop : {} screen_name = args.first || get_screen_name - get("users/profile_image/#{screen_name}", options, :raw).headers['location'] + get("1/users/profile_image/#{screen_name}", options, :raw).headers['location'] end # Returns a user's friends @@ -172,9 +172,9 @@ def friends(*args) user = args.first if user merge_user_into_options!(user, options) - response = get('statuses/friends', options) + response = get('1/statuses/friends', options) else - response = get('statuses/friends', options) + response = get('1/statuses/friends', options) end format.to_s.downcase == 'xml' ? response['users_list'] : response end @@ -212,9 +212,9 @@ def followers(*args) user = args.first if user merge_user_into_options!(user, options) - response = get('statuses/followers', options) + response = get('1/statuses/followers', options) else - response = get('statuses/followers', options) + response = get('1/statuses/followers', options) end format.to_s.downcase == 'xml' ? response['users_list'] : response end @@ -234,7 +234,7 @@ def followers(*args) # Twitter.recommendations def recommendations(options={}) options[:excluded] = options[:excluded].join(',') if options[:excluded].is_a?(Array) - response = get('users/recommendations', options) + response = get('1/users/recommendations', options) format.to_s.downcase == 'xml' ? response['userrecommendations'] : response end @@ -269,9 +269,9 @@ def contributees(*args) user = args.pop || get_screen_name if user merge_user_into_options!(user, options) - response = get('users/contributees', options) + response = get('1/users/contributees', options) else - response = get('users/contributees', options) + response = get('1/users/contributees', options) end format.to_s.downcase == 'xml' ? response['users'] : response end diff --git a/lib/twitter/configuration.rb b/lib/twitter/configuration.rb index 5e751eb44..74d58373a 100644 --- a/lib/twitter/configuration.rb +++ b/lib/twitter/configuration.rb @@ -34,7 +34,7 @@ module Configuration # @see http://en.blog.wordpress.com/2009/12/12/twitter-api/ # @see http://staff.tumblr.com/post/287703110/api # @see http://developer.typepad.com/typepad-twitter-api/twitter-api.html - DEFAULT_ENDPOINT = 'https://api.twitter.com/i/'.freeze + DEFAULT_ENDPOINT = 'https://api.twitter.com/'.freeze # The response format appended to the path and sent in the 'Accept' header if none is set # @@ -62,7 +62,7 @@ module Configuration DEFAULT_GATEWAY = nil # This endpoint will be used by default when updating statuses with media - DEFAULT_MEDIA_ENDPOINT = 'https://upload.twitter.com/1/'.freeze + DEFAULT_MEDIA_ENDPOINT = 'https://upload.twitter.com/'.freeze # @private attr_accessor *VALID_OPTIONS_KEYS diff --git a/spec/faraday/response_spec.rb b/spec/faraday/response_spec.rb index 7f32e76f6..c108b4241 100644 --- a/spec/faraday/response_spec.rb +++ b/spec/faraday/response_spec.rb @@ -19,7 +19,7 @@ if (status >= 500) context "when HTTP status is #{status}" do before do - stub_get('statuses/user_timeline.json'). + stub_get("1/statuses/user_timeline.json"). with(:query => {:screen_name => 'sferik'}). to_return(:status => status) end @@ -35,7 +35,7 @@ context "when HTTP status is #{status} and body is #{body||='nil'}" do before do body_message = '{"'+body+'":"test"}' unless body.nil? - stub_get('statuses/user_timeline.json'). + stub_get("1/statuses/user_timeline.json"). with(:query => {:screen_name => 'sferik'}). to_return(:status => status, :body => body_message) end @@ -53,7 +53,7 @@ context "when response status is 404 from lookup" do before do - stub_get("users/lookup.json"). + stub_get("1/users/lookup.json"). with(:query => {:screen_name => "not_on_twitter"}). to_return(:status => 404, :body => fixture('no_user_matches.json')) end diff --git a/spec/twitter/base_spec.rb b/spec/twitter/base_spec.rb index 6b0ce0d13..5462eacc7 100644 --- a/spec/twitter/base_spec.rb +++ b/spec/twitter/base_spec.rb @@ -9,13 +9,13 @@ describe ".home_timeline" do before do - stub_get("statuses/home_timeline.json"). + stub_get("1/statuses/home_timeline.json"). to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.home_timeline - a_get("statuses/home_timeline.json"). + a_get("1/statuses/home_timeline.json"). should have_been_made end end diff --git a/spec/twitter/client/account_spec.rb b/spec/twitter/client/account_spec.rb index 5bb0d3e11..84906a680 100644 --- a/spec/twitter/client/account_spec.rb +++ b/spec/twitter/client/account_spec.rb @@ -10,13 +10,13 @@ describe ".verify_credentials" do before do - stub_get("account/verify_credentials.#{format}"). + stub_get("1/account/verify_credentials.#{format}"). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.verify_credentials - a_get("account/verify_credentials.#{format}"). + a_get("1/account/verify_credentials.#{format}"). should have_been_made end @@ -30,13 +30,13 @@ describe ".rate_limit_status" do before do - stub_get("account/rate_limit_status.#{format}"). + stub_get("1/account/rate_limit_status.#{format}"). to_return(:body => fixture("rate_limit_status.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.rate_limit_status - a_get("account/rate_limit_status.#{format}"). + a_get("1/account/rate_limit_status.#{format}"). should have_been_made end @@ -50,13 +50,13 @@ describe ".end_session" do before do - stub_post("account/end_session.#{format}"). + stub_post("1/account/end_session.#{format}"). to_return(:body => fixture("end_session.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.end_session - a_post("account/end_session.#{format}"). + a_post("1/account/end_session.#{format}"). should have_been_made end @@ -70,14 +70,14 @@ describe ".update_delivery_device" do before do - stub_post("account/update_delivery_device.#{format}"). + stub_post("1/account/update_delivery_device.#{format}"). with(:body => {:device => "sms"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.update_delivery_device("sms") - a_post("account/update_delivery_device.#{format}"). + a_post("1/account/update_delivery_device.#{format}"). with(:body => {:device => "sms"}). should have_been_made end @@ -92,14 +92,14 @@ describe ".update_profile_colors" do before do - stub_post("account/update_profile_colors.#{format}"). + stub_post("1/account/update_profile_colors.#{format}"). with(:body => {:profile_background_color => "000000"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.update_profile_colors(:profile_background_color => "000000") - a_post("account/update_profile_colors.#{format}"). + a_post("1/account/update_profile_colors.#{format}"). with(:body => {:profile_background_color => "000000"}). should have_been_made end @@ -114,13 +114,13 @@ describe ".update_profile_image" do before do - stub_post("account/update_profile_image.#{format}"). + stub_post("1/account/update_profile_image.#{format}"). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.update_profile_image(fixture("me.jpeg")) - a_post("account/update_profile_image.#{format}"). + a_post("1/account/update_profile_image.#{format}"). should have_been_made end @@ -134,13 +134,13 @@ describe ".update_profile_background_image" do before do - stub_post("account/update_profile_background_image.#{format}"). + stub_post("1/account/update_profile_background_image.#{format}"). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.update_profile_background_image(fixture("we_concept_bg2.png")) - a_post("account/update_profile_background_image.#{format}"). + a_post("1/account/update_profile_background_image.#{format}"). should have_been_made end @@ -154,14 +154,14 @@ describe ".update_profile" do before do - stub_post("account/update_profile.#{format}"). + stub_post("1/account/update_profile.#{format}"). with(:body => {:url => "http://github.com/sferik/"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.update_profile(:url => "http://github.com/sferik/") - a_post("account/update_profile.#{format}"). + a_post("1/account/update_profile.#{format}"). with(:body => {:url => "http://github.com/sferik/"}). should have_been_made end @@ -175,13 +175,13 @@ describe ".totals" do before do - stub_get("account/totals.#{format}"). + stub_get("1/account/totals.#{format}"). to_return(:body => fixture("totals.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.totals - a_get("account/totals.#{format}"). + a_get("1/account/totals.#{format}"). should have_been_made end @@ -190,22 +190,22 @@ describe ".settings" do before do - stub_get("account/settings.#{format}"). + stub_get("1/account/settings.#{format}"). to_return(:body => fixture("settings.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) - stub_post("account/settings.#{format}"). + stub_post("1/account/settings.#{format}"). with(:body => {:trend_location_woeid => "23424803"}). to_return(:body => fixture("settings.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource on GET" do @client.settings - a_get("account/settings.#{format}"). + a_get("1/account/settings.#{format}"). should have_been_made end it "should get the correct resource on POST" do @client.settings(:trend_location_woeid => "23424803") - a_post("account/settings.#{format}"). + a_post("1/account/settings.#{format}"). with(:body => {:trend_location_woeid => "23424803"}). should have_been_made end diff --git a/spec/twitter/client/block_spec.rb b/spec/twitter/client/block_spec.rb index 250f96b21..e16d20294 100644 --- a/spec/twitter/client/block_spec.rb +++ b/spec/twitter/client/block_spec.rb @@ -10,14 +10,14 @@ describe ".block" do before do - stub_post("blocks/create.#{format}"). + stub_post("1/blocks/create.#{format}"). with(:body => {:screen_name => "sferik"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.block("sferik") - a_post("blocks/create.#{format}"). + a_post("1/blocks/create.#{format}"). should have_been_made end @@ -31,14 +31,14 @@ describe ".unblock" do before do - stub_delete("blocks/destroy.#{format}"). + stub_delete("1/blocks/destroy.#{format}"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.unblock("sferik") - a_delete("blocks/destroy.#{format}"). + a_delete("1/blocks/destroy.#{format}"). with(:query => {:screen_name => "sferik"}). should have_been_made end @@ -53,17 +53,17 @@ describe ".block?" do before do - stub_get("blocks/exists.json"). + stub_get("1/blocks/exists.json"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"}) - stub_get("blocks/exists.json"). + stub_get("1/blocks/exists.json"). with(:query => {:screen_name => "pengwynn"}). to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.block?("sferik") - a_get("blocks/exists.json"). + a_get("1/blocks/exists.json"). with(:query => {:screen_name => "sferik"}). should have_been_made end @@ -83,13 +83,13 @@ describe ".blocking" do before do - stub_get("blocks/blocking.#{format}"). + stub_get("1/blocks/blocking.#{format}"). to_return(:body => fixture("users.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.blocking - a_get("blocks/blocking.#{format}"). + a_get("1/blocks/blocking.#{format}"). should have_been_made end @@ -104,13 +104,13 @@ describe ".blocked_ids" do before do - stub_get("blocks/blocking/ids.#{format}"). + stub_get("1/blocks/blocking/ids.#{format}"). to_return(:body => fixture("ids.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.blocked_ids - a_get("blocks/blocking/ids.#{format}"). + a_get("1/blocks/blocking/ids.#{format}"). should have_been_made end diff --git a/spec/twitter/client/direct_messages_spec.rb b/spec/twitter/client/direct_messages_spec.rb index 65cd98fcb..204e6862a 100644 --- a/spec/twitter/client/direct_messages_spec.rb +++ b/spec/twitter/client/direct_messages_spec.rb @@ -10,13 +10,13 @@ describe ".direct_messages" do before do - stub_get("direct_messages.#{format}"). + stub_get("1/direct_messages.#{format}"). to_return(:body => fixture("direct_messages.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.direct_messages - a_get("direct_messages.#{format}"). + a_get("1/direct_messages.#{format}"). should have_been_made end @@ -31,13 +31,13 @@ describe ".direct_messages_sent" do before do - stub_get("direct_messages/sent.#{format}"). + stub_get("1/direct_messages/sent.#{format}"). to_return(:body => fixture("direct_messages.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.direct_messages_sent - a_get("direct_messages/sent.#{format}"). + a_get("1/direct_messages/sent.#{format}"). should have_been_made end @@ -52,14 +52,14 @@ describe ".direct_message_create" do before do - stub_post("direct_messages/new.#{format}"). + stub_post("1/direct_messages/new.#{format}"). with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}). to_return(:body => fixture("direct_message.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.direct_message_create("pengwynn", "Creating a fixture for the Twitter gem") - a_post("direct_messages/new.#{format}"). + a_post("1/direct_messages/new.#{format}"). with(:body => {:screen_name => "pengwynn", :text => "Creating a fixture for the Twitter gem"}). should have_been_made end @@ -74,13 +74,13 @@ describe ".direct_message_destroy" do before do - stub_delete("direct_messages/destroy/1825785544.#{format}"). + stub_delete("1/direct_messages/destroy/1825785544.#{format}"). to_return(:body => fixture("direct_message.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.direct_message_destroy(1825785544) - a_delete("direct_messages/destroy/1825785544.#{format}"). + a_delete("1/direct_messages/destroy/1825785544.#{format}"). should have_been_made end diff --git a/spec/twitter/client/favorites_spec.rb b/spec/twitter/client/favorites_spec.rb index 1c64a4fd7..f3eba4595 100644 --- a/spec/twitter/client/favorites_spec.rb +++ b/spec/twitter/client/favorites_spec.rb @@ -12,13 +12,13 @@ context "with a screen name passed" do before do - stub_get("favorites/sferik.#{format}"). + stub_get("1/favorites/sferik.#{format}"). to_return(:body => fixture("favorites.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.favorites("sferik") - a_get("favorites/sferik.#{format}"). + a_get("1/favorites/sferik.#{format}"). should have_been_made end @@ -33,13 +33,13 @@ context "without arguments passed" do before do - stub_get("favorites.#{format}"). + stub_get("1/favorites.#{format}"). to_return(:body => fixture("favorites.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.favorites - a_get("favorites.#{format}"). + a_get("1/favorites.#{format}"). should have_been_made end @@ -56,13 +56,13 @@ describe ".favorite_create" do before do - stub_post("favorites/create/25938088801.#{format}"). + stub_post("1/favorites/create/25938088801.#{format}"). to_return(:body => fixture("status.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.favorite_create(25938088801) - a_post("favorites/create/25938088801.#{format}"). + a_post("1/favorites/create/25938088801.#{format}"). should have_been_made end @@ -76,13 +76,13 @@ describe ".favorite_destroy" do before do - stub_delete("favorites/destroy/25938088801.#{format}"). + stub_delete("1/favorites/destroy/25938088801.#{format}"). to_return(:body => fixture("status.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.favorite_destroy(25938088801) - a_delete("favorites/destroy/25938088801.#{format}"). + a_delete("1/favorites/destroy/25938088801.#{format}"). should have_been_made end diff --git a/spec/twitter/client/friends_and_followers_spec.rb b/spec/twitter/client/friends_and_followers_spec.rb index abef594cd..f0498f340 100644 --- a/spec/twitter/client/friends_and_followers_spec.rb +++ b/spec/twitter/client/friends_and_followers_spec.rb @@ -12,14 +12,14 @@ context "with a screen_name passed" do before do - stub_get("friends/ids.#{format}"). + stub_get("1/friends/ids.#{format}"). with(:query => {:screen_name => "sferik", :cursor => "-1"}). to_return(:body => fixture("id_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.friend_ids("sferik") - a_get("friends/ids.#{format}"). + a_get("1/friends/ids.#{format}"). with(:query => {:screen_name => "sferik", :cursor => "-1"}). should have_been_made end @@ -35,14 +35,14 @@ context "without arguments passed" do before do - stub_get("friends/ids.#{format}"). + stub_get("1/friends/ids.#{format}"). with(:query => {:cursor => "-1"}). to_return(:body => fixture("id_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.friend_ids - a_get("friends/ids.#{format}"). + a_get("1/friends/ids.#{format}"). with(:query => {:cursor => "-1"}). should have_been_made end @@ -62,14 +62,14 @@ context "with a screen_name passed" do before do - stub_get("followers/ids.#{format}"). + stub_get("1/followers/ids.#{format}"). with(:query => {:screen_name => "sferik", :cursor => "-1"}). to_return(:body => fixture("id_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.follower_ids("sferik") - a_get("followers/ids.#{format}"). + a_get("1/followers/ids.#{format}"). with(:query => {:screen_name => "sferik", :cursor => "-1"}). should have_been_made end @@ -85,14 +85,14 @@ context "without arguments passed" do before do - stub_get("followers/ids.#{format}"). + stub_get("1/followers/ids.#{format}"). with(:query => {:cursor => "-1"}). to_return(:body => fixture("id_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.follower_ids - a_get("followers/ids.#{format}"). + a_get("1/followers/ids.#{format}"). with(:query => {:cursor => "-1"}). should have_been_made end diff --git a/spec/twitter/client/friendship_spec.rb b/spec/twitter/client/friendship_spec.rb index 6cf263ef1..b90e3fb23 100644 --- a/spec/twitter/client/friendship_spec.rb +++ b/spec/twitter/client/friendship_spec.rb @@ -12,14 +12,14 @@ context "with :follow => true passed" do before do - stub_post("friendships/create.#{format}"). + stub_post("1/friendships/create.#{format}"). with(:body => {:screen_name => "sferik", :follow => "true"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.follow("sferik", :follow => true) - a_post("friendships/create.#{format}"). + a_post("1/friendships/create.#{format}"). with(:body => {:screen_name => "sferik", :follow => "true"}). should have_been_made end @@ -34,14 +34,14 @@ context "with :follow => false passed" do before do - stub_post("friendships/create.#{format}"). + stub_post("1/friendships/create.#{format}"). with(:body => {:screen_name => "sferik"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.follow("sferik", :follow => false) - a_post("friendships/create.#{format}"). + a_post("1/friendships/create.#{format}"). with(:body => {:screen_name => "sferik"}). should have_been_made end @@ -56,14 +56,14 @@ context "without :follow passed" do before do - stub_post("friendships/create.#{format}"). + stub_post("1/friendships/create.#{format}"). with(:body => {:screen_name => "sferik"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.follow("sferik") - a_post("friendships/create.#{format}"). + a_post("1/friendships/create.#{format}"). with(:body => {:screen_name => "sferik"}). should have_been_made end @@ -80,14 +80,14 @@ describe ".unfollow" do before do - stub_delete("friendships/destroy.#{format}"). + stub_delete("1/friendships/destroy.#{format}"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.unfollow("sferik") - a_delete("friendships/destroy.#{format}"). + a_delete("1/friendships/destroy.#{format}"). with(:query => {:screen_name => "sferik"}). should have_been_made end @@ -102,17 +102,17 @@ describe ".friendship?" do before do - stub_get("friendships/exists.#{format}"). + stub_get("1/friendships/exists.#{format}"). with(:query => {:user_a => "sferik", :user_b => "pengwynn"}). to_return(:body => fixture("true.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) - stub_get("friendships/exists.#{format}"). + stub_get("1/friendships/exists.#{format}"). with(:query => {:user_a => "pengwynn", :user_b => "sferik"}). to_return(:body => fixture("false.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.friendship?("sferik", "pengwynn") - a_get("friendships/exists.#{format}"). + a_get("1/friendships/exists.#{format}"). with(:query => {:user_a => "sferik", :user_b => "pengwynn"}). should have_been_made end @@ -132,14 +132,14 @@ describe ".friendship" do before do - stub_get("friendships/show.#{format}"). + stub_get("1/friendships/show.#{format}"). with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"}). to_return(:body => fixture("relationship.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.friendship(:source_screen_name => "sferik", :target_screen_name => "pengwynn") - a_get("friendships/show.#{format}"). + a_get("1/friendships/show.#{format}"). with(:query => {:source_screen_name => "sferik", :target_screen_name => "pengwynn"}). should have_been_made end @@ -154,14 +154,14 @@ describe ".friendships_incoming" do before do - stub_get("friendships/incoming.#{format}"). + stub_get("1/friendships/incoming.#{format}"). with(:query => {:cursor => "-1"}). to_return(:body => fixture("id_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.friendships_incoming - a_get("friendships/incoming.#{format}"). + a_get("1/friendships/incoming.#{format}"). with(:query => {:cursor => "-1"}). should have_been_made end @@ -177,14 +177,14 @@ describe ".friendships_outgoing" do before do - stub_get("friendships/outgoing.#{format}"). + stub_get("1/friendships/outgoing.#{format}"). with(:query => {:cursor => "-1"}). to_return(:body => fixture("id_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.friendships_outgoing - a_get("friendships/outgoing.#{format}"). + a_get("1/friendships/outgoing.#{format}"). with(:query => {:cursor => "-1"}). should have_been_made end diff --git a/spec/twitter/client/geo_spec.rb b/spec/twitter/client/geo_spec.rb index 2e5fccd1d..1351a2783 100644 --- a/spec/twitter/client/geo_spec.rb +++ b/spec/twitter/client/geo_spec.rb @@ -10,14 +10,14 @@ describe ".places_nearby" do before do - stub_get("geo/search.json"). + stub_get("1/geo/search.json"). with(:query => {:ip => "74.125.19.104"}). to_return(:body => fixture("places.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.places_nearby(:ip => "74.125.19.104") - a_get("geo/search.json"). + a_get("1/geo/search.json"). with(:query => {:ip => "74.125.19.104"}). should have_been_made end @@ -33,14 +33,14 @@ describe ".places_similar" do before do - stub_get("geo/similar_places.json"). + stub_get("1/geo/similar_places.json"). with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ"}). to_return(:body => fixture("places.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.places_similar(:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ") - a_get("geo/similar_places.json"). + a_get("1/geo/similar_places.json"). with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116", :name => "Twitter HQ"}). should have_been_made end @@ -56,14 +56,14 @@ describe ".reverse_geocode" do before do - stub_get("geo/reverse_geocode.json"). + stub_get("1/geo/reverse_geocode.json"). with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116"}). to_return(:body => fixture("places.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.reverse_geocode(:lat => "37.7821120598956", :long => "-122.400612831116") - a_get("geo/reverse_geocode.json"). + a_get("1/geo/reverse_geocode.json"). with(:query => {:lat => "37.7821120598956", :long => "-122.400612831116"}). should have_been_made end @@ -79,13 +79,13 @@ describe ".place" do before do - stub_get("geo/id/247f43d441defc03.json"). + stub_get("1/geo/id/247f43d441defc03.json"). to_return(:body => fixture("place.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.place("247f43d441defc03") - a_get("geo/id/247f43d441defc03.json"). + a_get("1/geo/id/247f43d441defc03.json"). should have_been_made end @@ -99,14 +99,14 @@ describe ".place_create" do before do - stub_post("geo/place.json"). + stub_post("1/geo/place.json"). with(:body => {:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581"}). to_return(:body => fixture("place.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.place_create(:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581") - a_post("geo/place.json"). + a_post("1/geo/place.json"). with(:body => {:name => "@sferik's Apartment", :token => "22ff5b1f7159032cf69218c4d8bb78bc", :contained_within => "41bcb736f84a799e", :lat => "37.783699", :long => "-122.393581"}). should have_been_made end diff --git a/spec/twitter/client/help_spec.rb b/spec/twitter/client/help_spec.rb index 60628906b..84c35575c 100644 --- a/spec/twitter/client/help_spec.rb +++ b/spec/twitter/client/help_spec.rb @@ -10,13 +10,13 @@ describe ".configuration" do before do - stub_get("help/configuration.#{format}"). + stub_get("1/help/configuration.#{format}"). to_return(:body => fixture("configuration.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.configuration - a_get("help/configuration.#{format}"). + a_get("1/help/configuration.#{format}"). should have_been_made end @@ -30,13 +30,13 @@ describe ".languages" do before do - stub_get("help/languages.#{format}"). + stub_get("1/help/languages.#{format}"). to_return(:body => fixture("languages.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.languages - a_get("help/languages.#{format}"). + a_get("1/help/languages.#{format}"). should have_been_made end diff --git a/spec/twitter/client/legal_spec.rb b/spec/twitter/client/legal_spec.rb index baf67ef78..623da0ab5 100644 --- a/spec/twitter/client/legal_spec.rb +++ b/spec/twitter/client/legal_spec.rb @@ -10,13 +10,13 @@ describe ".tos" do before do - stub_get("legal/tos.#{format}"). + stub_get("1/legal/tos.#{format}"). to_return(:body => fixture("tos.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.tos - a_get("legal/tos.#{format}"). + a_get("1/legal/tos.#{format}"). should have_been_made end @@ -30,13 +30,13 @@ describe ".privacy" do before do - stub_get("legal/privacy.#{format}"). + stub_get("1/legal/privacy.#{format}"). to_return(:body => fixture("privacy.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.privacy - a_get("legal/privacy.#{format}"). + a_get("1/legal/privacy.#{format}"). should have_been_made end diff --git a/spec/twitter/client/list_members_spec.rb b/spec/twitter/client/list_members_spec.rb index d8a150a53..83528a400 100644 --- a/spec/twitter/client/list_members_spec.rb +++ b/spec/twitter/client/list_members_spec.rb @@ -12,14 +12,14 @@ context "with screen name" do before do - stub_get("lists/members.#{format}"). + stub_get("1/lists/members.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}). to_return(:body => fixture("users_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_members("sferik", "presidents") - a_get("lists/members.#{format}"). + a_get("1/lists/members.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}). should have_been_made end @@ -35,14 +35,14 @@ context "with an Integer user_id passed" do before do - stub_get("lists/members.#{format}"). + stub_get("1/lists/members.#{format}"). with(:query => {:owner_id => '12345678', :slug => 'presidents', :cursor => "-1"}). to_return(:body => fixture("users_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_members(12345678, 'presidents') - a_get("lists/members.#{format}"). + a_get("1/lists/members.#{format}"). with(:query => {:owner_id => '12345678', :slug => 'presidents', :cursor => "-1"}). should have_been_made end @@ -53,14 +53,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_get("lists/members.#{format}"). + stub_get("1/lists/members.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}). to_return(:body => fixture("users_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_members("presidents") - a_get("lists/members.#{format}"). + a_get("1/lists/members.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}). should have_been_made end @@ -74,14 +74,14 @@ context "with screen name passed" do before do - stub_post("lists/members/create.#{format}"). + stub_post("1/lists/members/create.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_add_member("sferik", "presidents", 813286) - a_post("lists/members/create.#{format}"). + a_post("1/lists/members/create.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}). should have_been_made end @@ -96,14 +96,14 @@ context "with an Integer user_id passed" do before do - stub_post("lists/members/create.#{format}"). + stub_post("1/lists/members/create.#{format}"). with(:body => {:owner_id => '12345678', :slug => 'presidents', :user_id => "813286"}). to_return(:body => fixture("users_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_add_member(12345678, 'presidents', 813286) - a_post("lists/members/create.#{format}"). + a_post("1/lists/members/create.#{format}"). with(:body => {:owner_id => '12345678', :slug => 'presidents', :user_id => "813286"}). should have_been_made end @@ -113,14 +113,14 @@ context "with an Integer list_id passed" do before do - stub_post("lists/members/create.#{format}"). + stub_post("1/lists/members/create.#{format}"). with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => "813286"}). to_return(:body => fixture("users_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_add_member('sferik', 12345678, 813286) - a_post("lists/members/create.#{format}"). + a_post("1/lists/members/create.#{format}"). with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => "813286"}). should have_been_made end @@ -131,14 +131,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_post("lists/members/create.#{format}"). + stub_post("1/lists/members/create.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_add_member("presidents", 813286) - a_post("lists/members/create.#{format}"). + a_post("1/lists/members/create.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}). should have_been_made end @@ -152,14 +152,14 @@ context "with screen name passed" do before do - stub_post("lists/members/create_all.#{format}"). + stub_post("1/lists/members/create_all.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_add_members("sferik", "presidents", [813286, 18755393]) - a_post("lists/members/create_all.#{format}"). + a_post("1/lists/members/create_all.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}). should have_been_made end @@ -174,14 +174,14 @@ context "with an Integer user_id passed" do before do - stub_post("lists/members/create_all.#{format}"). + stub_post("1/lists/members/create_all.#{format}"). with(:body => {:owner_id => '12345678', :slug => 'presidents', :user_id => "813286,18755393"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_add_members(12345678, "presidents", [813286, 18755393]) - a_post("lists/members/create_all.#{format}"). + a_post("1/lists/members/create_all.#{format}"). with(:body => {:owner_id => '12345678', :slug => 'presidents', :user_id => "813286,18755393"}). should have_been_made end @@ -191,14 +191,14 @@ context "with an Integer list_id passed" do before do - stub_post("lists/members/create_all.#{format}"). + stub_post("1/lists/members/create_all.#{format}"). with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => "813286,18755393"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_add_members('sferik', 12345678, [813286, 18755393]) - a_post("lists/members/create_all.#{format}"). + a_post("1/lists/members/create_all.#{format}"). with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => "813286,18755393"}). should have_been_made end @@ -208,14 +208,14 @@ context "with a combination of member IDs and member screen names to add" do before do - stub_post("lists/members/create_all.#{format}"). + stub_post("1/lists/members/create_all.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_add_members('sferik', 'presidents', [813286, 'pengwynn', 18755393, 'erebor']) - a_post("lists/members/create_all.#{format}"). + a_post("1/lists/members/create_all.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393", :screen_name => "pengwynn,erebor"}). should have_been_made end @@ -226,14 +226,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_post("lists/members/create_all.#{format}"). + stub_post("1/lists/members/create_all.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_add_members("presidents", [813286, 18755393]) - a_post("lists/members/create_all.#{format}"). + a_post("1/lists/members/create_all.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286,18755393"}). should have_been_made end @@ -247,14 +247,14 @@ context "with screen name passed" do before do - stub_post("lists/members/destroy.#{format}"). + stub_post("1/lists/members/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_remove_member("sferik", "presidents", 813286) - a_post("lists/members/destroy.#{format}"). + a_post("1/lists/members/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}). should have_been_made end @@ -269,14 +269,14 @@ context "with an Integer user_id passed" do before do - stub_post("lists/members/destroy.#{format}"). + stub_post("1/lists/members/destroy.#{format}"). with(:body => {:owner_id => '12345678', :slug => 'presidents', :user_id => "813286"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_remove_member(12345678, "presidents", 813286) - a_post("lists/members/destroy.#{format}"). + a_post("1/lists/members/destroy.#{format}"). with(:body => {:owner_id => '12345678', :slug => 'presidents', :user_id => "813286"}). should have_been_made end @@ -286,14 +286,14 @@ context "with an Integer list_id passed" do before do - stub_post("lists/members/destroy.#{format}"). + stub_post("1/lists/members/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => "813286"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_remove_member('sferik', 12345678, 813286) - a_post("lists/members/destroy.#{format}"). + a_post("1/lists/members/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => "813286"}). should have_been_made end @@ -303,14 +303,14 @@ context "with a screen name to remove" do before do - stub_post("lists/members/destroy.#{format}"). + stub_post("1/lists/members/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => "erebor"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_remove_member('sferik', 'presidents', 'erebor') - a_post("lists/members/destroy.#{format}"). + a_post("1/lists/members/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => "erebor"}). should have_been_made end @@ -321,14 +321,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_post("lists/members/destroy.#{format}"). + stub_post("1/lists/members/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_remove_member("presidents", 813286) - a_post("lists/members/destroy.#{format}"). + a_post("1/lists/members/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => "813286"}). should have_been_made end @@ -342,20 +342,20 @@ context "with screen name passed" do before do - stub_get("lists/members/show.json"). + stub_get("1/lists/members/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}). to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"}) - stub_get("lists/members/show.json"). + stub_get("1/lists/members/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '65493023'}). to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"}) - stub_get("lists/members/show.json"). + stub_get("1/lists/members/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '12345678'}). to_return(:body => fixture("not_found.json"), :status => 403, :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.list_member?("sferik", "presidents", 813286) - a_get("lists/members/show.json"). + a_get("1/lists/members/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}). should have_been_made end @@ -380,14 +380,14 @@ context "with an Integer owner_id passed" do before do - stub_get("lists/members/show.json"). + stub_get("1/lists/members/show.json"). with(:query => {:owner_id => '12345678', :slug => 'presidents', :user_id => '813286'}). to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.list_member?(12345678, "presidents", 813286) - a_get("lists/members/show.json"). + a_get("1/lists/members/show.json"). with(:query => {:owner_id => '12345678', :slug => 'presidents', :user_id => '813286'}). should have_been_made end @@ -397,14 +397,14 @@ context "with an Integer list_id passed" do before do - stub_get("lists/members/show.json"). + stub_get("1/lists/members/show.json"). with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => '813286'}). to_return(:body => fixture("list.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.list_member?('sferik', 12345678, 813286) - a_get("lists/members/show.json"). + a_get("1/lists/members/show.json"). with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => '813286'}). should have_been_made end @@ -414,14 +414,14 @@ context "with screen name passed for user_to_check" do before do - stub_get("lists/members/show.json"). + stub_get("1/lists/members/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => 'erebor'}). to_return(:body => fixture("list.json"), :headers => {:content_type => "application/.json; charset=utf-8"}) end it "should get the correct resource" do @client.list_member?("sferik", "presidents", 'erebor') - a_get("lists/members/show.json"). + a_get("1/lists/members/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => 'erebor'}). should have_been_made end @@ -432,14 +432,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_get("lists/members/show.json"). + stub_get("1/lists/members/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}). to_return(:body => fixture("list.json"), :headers => {:content_type => "application/.json; charset=utf-8"}) end it "should get the correct resource" do @client.list_member?("presidents", 813286) - a_get("lists/members/show.json"). + a_get("1/lists/members/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}). should have_been_made end diff --git a/spec/twitter/client/list_spec.rb b/spec/twitter/client/list_spec.rb index 7eaaab07f..8a62b9109 100644 --- a/spec/twitter/client/list_spec.rb +++ b/spec/twitter/client/list_spec.rb @@ -10,14 +10,14 @@ describe ".list_create" do before do - stub_post("lists/create.#{format}"). + stub_post("1/lists/create.#{format}"). with(:body => {:name => "presidents"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_create("presidents") - a_post("lists/create.#{format}"). + a_post("1/lists/create.#{format}"). with(:body => {:name => "presidents"}). should have_been_made end @@ -34,14 +34,14 @@ context "with screen name passed" do before do - stub_post("lists/update.#{format}"). + stub_post("1/lists/update.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => "presidents", :description => "Presidents of the United States of America"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_update("sferik", "presidents", :description => "Presidents of the United States of America") - a_post("lists/update.#{format}"). + a_post("1/lists/update.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => "presidents", :description => "Presidents of the United States of America"}). should have_been_made end @@ -56,14 +56,14 @@ context "without screen name passed" do before do @client.stub!(:get_screen_name).and_return('sferik') - stub_post("lists/update.#{format}"). + stub_post("1/lists/update.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :description => "Presidents of the United States of America"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_update("sferik", "presidents", :description => "Presidents of the United States of America") - a_post("lists/update.#{format}"). + a_post("1/lists/update.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents', :description => "Presidents of the United States of America"}). should have_been_made end @@ -72,14 +72,14 @@ context "with an Integer list_id passed" do before do - stub_post("lists/update.#{format}"). + stub_post("1/lists/update.#{format}"). with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678', :description => "Presidents of the United States of America"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_update("sferik", 12345678, :description => "Presidents of the United States of America") - a_post("lists/update.#{format}"). + a_post("1/lists/update.#{format}"). with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678', :description => "Presidents of the United States of America"}). should have_been_made end @@ -89,14 +89,14 @@ context "with an Integer user_id passed" do before do - stub_post("lists/update.#{format}"). + stub_post("1/lists/update.#{format}"). with(:body => {:owner_id => '12345678', :slug => 'presidents', :description => "Presidents of the United States of America"}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_update(12345678, 'presidents', :description => "Presidents of the United States of America") - a_post("lists/update.#{format}"). + a_post("1/lists/update.#{format}"). with(:body => {:owner_id => '12345678', :slug => 'presidents', :description => "Presidents of the United States of America"}). should have_been_made end @@ -109,14 +109,14 @@ context "with a screen name passed" do before do - stub_get("lists.#{format}"). + stub_get("1/lists.#{format}"). with(:query => {:screen_name => 'sferik', :cursor => "-1"}). to_return(:body => fixture("lists.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.lists("sferik") - a_get("lists.#{format}"). + a_get("1/lists.#{format}"). with(:query => {:screen_name => 'sferik', :cursor => "-1"}). should have_been_made end @@ -132,14 +132,14 @@ context "with an Integer user id passed" do before do - stub_get("lists.#{format}"). + stub_get("1/lists.#{format}"). with(:query => {:user_id => '12345678', :cursor => "-1"}). to_return(:body => fixture("lists.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.lists(12345678) - a_get("lists.#{format}"). + a_get("1/lists.#{format}"). with(:query => {:user_id => '12345678', :cursor => "-1"}). should have_been_made end @@ -155,14 +155,14 @@ context "without arguments passed" do before do - stub_get("lists.#{format}"). + stub_get("1/lists.#{format}"). with(:query => {:cursor => "-1"}). to_return(:body => fixture("lists.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.lists - a_get("lists.#{format}"). + a_get("1/lists.#{format}"). with(:query => {:cursor => "-1"}). should have_been_made end @@ -182,14 +182,14 @@ context "with a screen name passed" do before do - stub_get("lists/show.#{format}"). + stub_get("1/lists/show.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list("sferik", "presidents") - a_get("lists/show.#{format}"). + a_get("1/lists/show.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}). should have_been_made end @@ -205,14 +205,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_get("lists/show.#{format}"). + stub_get("1/lists/show.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list("sferik", "presidents") - a_get("lists/show.#{format}"). + a_get("1/lists/show.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}). should have_been_made end @@ -222,14 +222,14 @@ context "with an Integer list_id passed" do before do - stub_get("lists/show.#{format}"). + stub_get("1/lists/show.#{format}"). with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list("sferik", 12345678) - a_get("lists/show.#{format}"). + a_get("1/lists/show.#{format}"). with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678'}). should have_been_made end @@ -239,14 +239,14 @@ context "with an Integer user_id passed" do before do - stub_get("lists/show.#{format}"). + stub_get("1/lists/show.#{format}"). with(:query => {:owner_id => '12345678', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list(12345678, 'presidents') - a_get("lists/show.#{format}"). + a_get("1/lists/show.#{format}"). with(:query => {:owner_id => '12345678', :slug => 'presidents'}). should have_been_made end @@ -260,14 +260,14 @@ context "with a screen name passed" do before do - stub_delete("lists/destroy.#{format}"). + stub_delete("1/lists/destroy.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_delete("sferik", "presidents") - a_delete("lists/destroy.#{format}"). + a_delete("1/lists/destroy.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}). should have_been_made end @@ -283,14 +283,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_delete("lists/destroy.#{format}"). + stub_delete("1/lists/destroy.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_delete("sferik", "presidents") - a_delete("lists/destroy.#{format}"). + a_delete("1/lists/destroy.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}). should have_been_made end @@ -300,14 +300,14 @@ context "with an Integer list_id passed" do before do - stub_delete("lists/destroy.#{format}"). + stub_delete("1/lists/destroy.#{format}"). with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_delete("sferik", 12345678) - a_delete("lists/destroy.#{format}"). + a_delete("1/lists/destroy.#{format}"). with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678'}). should have_been_made end @@ -317,14 +317,14 @@ context "with an Integer user_id passed" do before do - stub_delete("lists/destroy.#{format}"). + stub_delete("1/lists/destroy.#{format}"). with(:query => {:owner_id => '12345678', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_delete(12345678, 'presidents') - a_delete("lists/destroy.#{format}"). + a_delete("1/lists/destroy.#{format}"). with(:query => {:owner_id => '12345678', :slug => 'presidents'}). should have_been_made end @@ -338,14 +338,14 @@ context "with a screen name passed" do before do - stub_get("lists/statuses.#{format}"). + stub_get("1/lists/statuses.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}). to_return(:body => fixture("statuses.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_timeline("sferik", "presidents") - a_get("lists/statuses.#{format}"). + a_get("1/lists/statuses.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}). should have_been_made end @@ -362,14 +362,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_get("lists/statuses.#{format}"). + stub_get("1/lists/statuses.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}). to_return(:body => fixture("statuses.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_timeline("sferik", "presidents") - a_get("lists/statuses.#{format}"). + a_get("1/lists/statuses.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents'}). should have_been_made end @@ -385,14 +385,14 @@ context "with an Integer list_id passed" do before do - stub_get("lists/statuses.#{format}"). + stub_get("1/lists/statuses.#{format}"). with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_timeline("sferik", 12345678) - a_get("lists/statuses.#{format}"). + a_get("1/lists/statuses.#{format}"). with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678'}). should have_been_made end @@ -402,14 +402,14 @@ context "with an Integer user_id passed" do before do - stub_get("lists/statuses.#{format}"). + stub_get("1/lists/statuses.#{format}"). with(:query => {:owner_id => '12345678', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_timeline(12345678, 'presidents') - a_get("lists/statuses.#{format}"). + a_get("1/lists/statuses.#{format}"). with(:query => {:owner_id => '12345678', :slug => 'presidents'}). should have_been_made end @@ -423,14 +423,14 @@ context "with a screen name passed" do before do - stub_get("lists/memberships.#{format}"). + stub_get("1/lists/memberships.#{format}"). with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}). to_return(:body => fixture("lists.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.memberships("pengwynn") - a_get("lists/memberships.#{format}"). + a_get("1/lists/memberships.#{format}"). with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}). should have_been_made end @@ -447,14 +447,14 @@ before do @client.stub!(:get_screen_name).and_return('pengwynn') - stub_get("lists/memberships.#{format}"). + stub_get("1/lists/memberships.#{format}"). with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}). to_return(:body => fixture("lists.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.memberships("pengwynn") - a_get("lists/memberships.#{format}"). + a_get("1/lists/memberships.#{format}"). with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}). should have_been_made end @@ -470,14 +470,14 @@ context "with an Integer user_id passed" do before do - stub_get("lists/memberships.#{format}"). + stub_get("1/lists/memberships.#{format}"). with(:query => {:user_id => '12345678', :cursor => "-1"}). to_return(:body => fixture("lists.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.memberships(12345678) - a_get("lists/memberships.#{format}"). + a_get("1/lists/memberships.#{format}"). with(:query => {:user_id => '12345678', :cursor => "-1"}). should have_been_made end @@ -491,14 +491,14 @@ context "with a screen name passed" do before do - stub_get("lists/subscriptions.#{format}"). + stub_get("1/lists/subscriptions.#{format}"). with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}). to_return(:body => fixture("lists.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.subscriptions("pengwynn") - a_get("lists/subscriptions.#{format}"). + a_get("1/lists/subscriptions.#{format}"). with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}). should have_been_made end @@ -515,14 +515,14 @@ before do @client.stub!(:get_screen_name).and_return('pengwynn') - stub_get("lists/subscriptions.#{format}"). + stub_get("1/lists/subscriptions.#{format}"). with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}). to_return(:body => fixture("lists.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.subscriptions("pengwynn") - a_get("lists/subscriptions.#{format}"). + a_get("1/lists/subscriptions.#{format}"). with(:query => {:screen_name => 'pengwynn', :cursor => "-1"}). should have_been_made end @@ -538,14 +538,14 @@ context "with an Integer user_id passed" do before do - stub_get("lists/subscriptions.#{format}"). + stub_get("1/lists/subscriptions.#{format}"). with(:query => {:user_id => '12345678', :cursor => "-1"}). to_return(:body => fixture("lists.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.subscriptions(12345678) - a_get("lists/subscriptions.#{format}"). + a_get("1/lists/subscriptions.#{format}"). with(:query => {:user_id => '12345678', :cursor => "-1"}). should have_been_made end diff --git a/spec/twitter/client/list_subscribers_spec.rb b/spec/twitter/client/list_subscribers_spec.rb index ff77f85ee..fad615c46 100644 --- a/spec/twitter/client/list_subscribers_spec.rb +++ b/spec/twitter/client/list_subscribers_spec.rb @@ -12,14 +12,14 @@ context "with screen name passed" do before do - stub_get("lists/subscribers.#{format}"). + stub_get("1/lists/subscribers.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}). to_return(:body => fixture("users_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscribers("sferik", "presidents") - a_get("lists/subscribers.#{format}"). + a_get("1/lists/subscribers.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}). should have_been_made end @@ -35,14 +35,14 @@ context "with an Integer user passed" do before do - stub_get("lists/subscribers.#{format}"). + stub_get("1/lists/subscribers.#{format}"). with(:query => {:owner_id => '12345678', :slug => 'presidents', :cursor => "-1"}). to_return(:body => fixture("users_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscribers(12345678, "presidents") - a_get("lists/subscribers.#{format}"). + a_get("1/lists/subscribers.#{format}"). with(:query => {:owner_id => '12345678', :slug => 'presidents', :cursor => "-1"}). should have_been_made end @@ -52,14 +52,14 @@ context "with an Integer list_id passed" do before do - stub_get("lists/subscribers.#{format}"). + stub_get("1/lists/subscribers.#{format}"). with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :cursor => "-1"}). to_return(:body => fixture("users_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscribers('sferik', 12345678) - a_get("lists/subscribers.#{format}"). + a_get("1/lists/subscribers.#{format}"). with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :cursor => "-1"}). should have_been_made end @@ -70,14 +70,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_get("lists/subscribers.#{format}"). + stub_get("1/lists/subscribers.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}). to_return(:body => fixture("users_list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscribers("presidents") - a_get("lists/subscribers.#{format}"). + a_get("1/lists/subscribers.#{format}"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :cursor => "-1"}). should have_been_made end @@ -91,14 +91,14 @@ context "with screen name passed" do before do - stub_post("lists/subscribers/create.#{format}"). + stub_post("1/lists/subscribers/create.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscribe("sferik", "presidents") - a_post("lists/subscribers/create.#{format}"). + a_post("1/lists/subscribers/create.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}). should have_been_made end @@ -113,14 +113,14 @@ context "with an Integer user_id passed" do before do - stub_post("lists/subscribers/create.#{format}"). + stub_post("1/lists/subscribers/create.#{format}"). with(:body => {:owner_id => '12345678', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscribe(12345678, "presidents") - a_post("lists/subscribers/create.#{format}"). + a_post("1/lists/subscribers/create.#{format}"). with(:body => {:owner_id => '12345678', :slug => 'presidents'}). should have_been_made end @@ -130,14 +130,14 @@ context "with an Integer list_id passed" do before do - stub_post("lists/subscribers/create.#{format}"). + stub_post("1/lists/subscribers/create.#{format}"). with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscribe('sferik', 12345678) - a_post("lists/subscribers/create.#{format}"). + a_post("1/lists/subscribers/create.#{format}"). with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678'}). should have_been_made end @@ -148,14 +148,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_post("lists/subscribers/create.#{format}"). + stub_post("1/lists/subscribers/create.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscribe("presidents") - a_post("lists/subscribers/create.#{format}"). + a_post("1/lists/subscribers/create.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}). should have_been_made end @@ -169,14 +169,14 @@ context "with screen name" do before do - stub_post("lists/subscribers/destroy.#{format}"). + stub_post("1/lists/subscribers/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_unsubscribe("sferik", "presidents") - a_post("lists/subscribers/destroy.#{format}"). + a_post("1/lists/subscribers/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}). should have_been_made end @@ -191,14 +191,14 @@ context "with an Integer user_id passed" do before do - stub_post("lists/subscribers/destroy.#{format}"). + stub_post("1/lists/subscribers/destroy.#{format}"). with(:body => {:owner_id => '12345678', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_unsubscribe(12345678, "presidents") - a_post("lists/subscribers/destroy.#{format}"). + a_post("1/lists/subscribers/destroy.#{format}"). with(:body => {:owner_id => '12345678', :slug => 'presidents'}). should have_been_made end @@ -208,14 +208,14 @@ context "with an Integer list_id passed" do before do - stub_post("lists/subscribers/destroy.#{format}"). + stub_post("1/lists/subscribers/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_unsubscribe('sferik', 12345678) - a_post("lists/subscribers/destroy.#{format}"). + a_post("1/lists/subscribers/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :list_id => '12345678'}). should have_been_made end @@ -226,14 +226,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_post("lists/subscribers/destroy.#{format}"). + stub_post("1/lists/subscribers/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}). to_return(:body => fixture("list.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.list_unsubscribe("presidents") - a_post("lists/subscribers/destroy.#{format}"). + a_post("1/lists/subscribers/destroy.#{format}"). with(:body => {:owner_screen_name => 'sferik', :slug => 'presidents'}). should have_been_made end @@ -247,20 +247,20 @@ context "with screen name passed" do before do - stub_get("lists/subscribers/show.json"). + stub_get("1/lists/subscribers/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}). to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"}) - stub_get("lists/subscribers/show.json"). + stub_get("1/lists/subscribers/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '18755393'}). to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"}) - stub_get("lists/subscribers/show.json"). + stub_get("1/lists/subscribers/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '12345678'}). to_return(:body => fixture("not_found.json"), :status => 403, :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscriber?("sferik", "presidents", 813286) - a_get("lists/subscribers/show.json"). + a_get("1/lists/subscribers/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}). should have_been_made end @@ -285,14 +285,14 @@ context "with an Integer owner_id passed" do before do - stub_get("lists/subscribers/show.json"). + stub_get("1/lists/subscribers/show.json"). with(:query => {:owner_id => '12345678', :slug => 'presidents', :user_id => '813286'}). to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscriber?(12345678, "presidents", 813286) - a_get("lists/subscribers/show.json"). + a_get("1/lists/subscribers/show.json"). with(:query => {:owner_id => '12345678', :slug => 'presidents', :user_id => '813286'}). should have_been_made end @@ -302,14 +302,14 @@ context "with an Integer list_id passed" do before do - stub_get("lists/subscribers/show.json"). + stub_get("1/lists/subscribers/show.json"). with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => '813286'}). to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscriber?('sferik', 12345678, 813286) - a_get("lists/subscribers/show.json"). + a_get("1/lists/subscribers/show.json"). with(:query => {:owner_screen_name => 'sferik', :list_id => '12345678', :user_id => '813286'}). should have_been_made end @@ -319,14 +319,14 @@ context "with screen name passed for user_to_check" do before do - stub_get("lists/subscribers/show.json"). + stub_get("1/lists/subscribers/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => 'erebor'}). to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscriber?("sferik", "presidents", 'erebor') - a_get("lists/subscribers/show.json"). + a_get("1/lists/subscribers/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :screen_name => 'erebor'}). should have_been_made end @@ -337,14 +337,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_get("lists/subscribers/show.json"). + stub_get("1/lists/subscribers/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}). to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.list_subscriber?("presidents", 813286) - a_get("lists/subscribers/show.json"). + a_get("1/lists/subscribers/show.json"). with(:query => {:owner_screen_name => 'sferik', :slug => 'presidents', :user_id => '813286'}). should have_been_made end diff --git a/spec/twitter/client/local_trends_spec.rb b/spec/twitter/client/local_trends_spec.rb index 80e2ed6e6..2a0795275 100644 --- a/spec/twitter/client/local_trends_spec.rb +++ b/spec/twitter/client/local_trends_spec.rb @@ -10,13 +10,13 @@ describe ".trend_locations" do before do - stub_get("trends/available.#{format}"). + stub_get("1/trends/available.#{format}"). to_return(:body => fixture("locations.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.trend_locations - a_get("trends/available.#{format}"). + a_get("1/trends/available.#{format}"). should have_been_made end @@ -33,13 +33,13 @@ context "with woeid passed" do before do - stub_get("trends/2487956.#{format}"). + stub_get("1/trends/2487956.#{format}"). to_return(:body => fixture("matching_trends.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.local_trends(2487956) - a_get("trends/2487956.#{format}"). + a_get("1/trends/2487956.#{format}"). should have_been_made end @@ -54,13 +54,13 @@ context "without arguments passed" do before do - stub_get("trends/1.#{format}"). + stub_get("1/trends/1.#{format}"). to_return(:body => fixture("matching_trends.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.local_trends - a_get("trends/1.#{format}"). + a_get("1/trends/1.#{format}"). should have_been_made end diff --git a/spec/twitter/client/notification_spec.rb b/spec/twitter/client/notification_spec.rb index 601fdcfab..2284db2ee 100644 --- a/spec/twitter/client/notification_spec.rb +++ b/spec/twitter/client/notification_spec.rb @@ -10,14 +10,14 @@ describe ".enable_notifications" do before do - stub_post("notifications/follow.#{format}"). + stub_post("1/notifications/follow.#{format}"). with(:body => {:screen_name => "sferik"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.enable_notifications("sferik") - a_post("notifications/follow.#{format}"). + a_post("1/notifications/follow.#{format}"). with(:body => {:screen_name => "sferik"}). should have_been_made end @@ -32,14 +32,14 @@ describe ".disable_notifications" do before do - stub_post("notifications/leave.#{format}"). + stub_post("1/notifications/leave.#{format}"). with(:body => {:screen_name => "sferik"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.disable_notifications("sferik") - a_post("notifications/leave.#{format}"). + a_post("1/notifications/leave.#{format}"). with(:body => {:screen_name => "sferik"}). should have_been_made end diff --git a/spec/twitter/client/saved_searches_spec.rb b/spec/twitter/client/saved_searches_spec.rb index 424fe96a7..aaa748ba5 100644 --- a/spec/twitter/client/saved_searches_spec.rb +++ b/spec/twitter/client/saved_searches_spec.rb @@ -10,13 +10,13 @@ describe ".saved_searches" do before do - stub_get("saved_searches.#{format}"). + stub_get("1/saved_searches.#{format}"). to_return(:body => fixture("saved_searches.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.saved_searches - a_get("saved_searches.#{format}"). + a_get("1/saved_searches.#{format}"). should have_been_made end @@ -31,13 +31,13 @@ describe ".saved_search" do before do - stub_get("saved_searches/show/16129012.#{format}"). + stub_get("1/saved_searches/show/16129012.#{format}"). to_return(:body => fixture("saved_search.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.saved_search(16129012) - a_get("saved_searches/show/16129012.#{format}"). + a_get("1/saved_searches/show/16129012.#{format}"). should have_been_made end @@ -51,14 +51,14 @@ describe ".saved_search_create" do before do - stub_post("saved_searches/create.#{format}"). + stub_post("1/saved_searches/create.#{format}"). with(:body => {:query => "twitter"}). to_return(:body => fixture("saved_search.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.saved_search_create("twitter") - a_post("saved_searches/create.#{format}"). + a_post("1/saved_searches/create.#{format}"). with(:body => {:query => "twitter"}). should have_been_made end @@ -73,13 +73,13 @@ describe ".saved_search_destroy" do before do - stub_delete("saved_searches/destroy/16129012.#{format}"). + stub_delete("1/saved_searches/destroy/16129012.#{format}"). to_return(:body => fixture("saved_search.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.saved_search_destroy(16129012) - a_delete("saved_searches/destroy/16129012.#{format}"). + a_delete("1/saved_searches/destroy/16129012.#{format}"). should have_been_made end diff --git a/spec/twitter/client/search_spec.rb b/spec/twitter/client/search_spec.rb index 0473ea17d..eb7b1a725 100644 --- a/spec/twitter/client/search_spec.rb +++ b/spec/twitter/client/search_spec.rb @@ -10,14 +10,14 @@ describe ".image_facets" do before do - stub_get("search/image_facets.#{format}"). + stub_get("i/search/image_facets.#{format}"). with(:query => {:q => "twitter"}). to_return(:body => fixture("image_facets.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.image_facets('twitter') - a_get("search/image_facets.#{format}"). + a_get("i/search/image_facets.#{format}"). with(:query => {:q => "twitter"}). should have_been_made end @@ -32,14 +32,14 @@ describe ".video_facets" do before do - stub_get("search/video_facets.#{format}"). + stub_get("i/search/video_facets.#{format}"). with(:query => {:q => "twitter"}). to_return(:body => fixture("video_facets.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.video_facets('twitter') - a_get("search/video_facets.#{format}"). + a_get("i/search/video_facets.#{format}"). with(:query => {:q => "twitter"}). should have_been_made end diff --git a/spec/twitter/client/spam_reporting_spec.rb b/spec/twitter/client/spam_reporting_spec.rb index 4209381d0..75975053e 100644 --- a/spec/twitter/client/spam_reporting_spec.rb +++ b/spec/twitter/client/spam_reporting_spec.rb @@ -10,14 +10,14 @@ describe ".report_spam" do before do - stub_post("report_spam.#{format}"). + stub_post("1/report_spam.#{format}"). with(:body => {:screen_name => "sferik"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.report_spam("sferik") - a_post("report_spam.#{format}"). + a_post("1/report_spam.#{format}"). with(:body => {:screen_name => "sferik"}). should have_been_made end diff --git a/spec/twitter/client/timeline_spec.rb b/spec/twitter/client/timeline_spec.rb index f7efd610f..86274275f 100644 --- a/spec/twitter/client/timeline_spec.rb +++ b/spec/twitter/client/timeline_spec.rb @@ -10,13 +10,13 @@ describe ".public_timeline" do before do - stub_get("statuses/public_timeline.#{format}"). + stub_get("1/statuses/public_timeline.#{format}"). to_return(:body => fixture("statuses.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.public_timeline - a_get("statuses/public_timeline.#{format}"). + a_get("1/statuses/public_timeline.#{format}"). should have_been_made end @@ -31,13 +31,13 @@ describe ".home_timeline" do before do - stub_get("statuses/home_timeline.#{format}"). + stub_get("1/statuses/home_timeline.#{format}"). to_return(:body => fixture("statuses.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.home_timeline - a_get("statuses/home_timeline.#{format}"). + a_get("1/statuses/home_timeline.#{format}"). should have_been_made end @@ -52,13 +52,13 @@ describe ".friends_timeline" do before do - stub_get("statuses/home_timeline.#{format}"). + stub_get("1/statuses/home_timeline.#{format}"). to_return(:body => fixture("statuses.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should return the 20 most recent statuses posted by the authenticating user and the user's they follow" do @client.friends_timeline - a_get("statuses/home_timeline.#{format}"). + a_get("1/statuses/home_timeline.#{format}"). should have_been_made end @@ -75,14 +75,14 @@ context "with screen name passed" do before do - stub_get("statuses/user_timeline.#{format}"). + stub_get("1/statuses/user_timeline.#{format}"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("statuses.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.user_timeline("sferik") - a_get("statuses/user_timeline.#{format}"). + a_get("1/statuses/user_timeline.#{format}"). with(:query => {:screen_name => "sferik"}). should have_been_made end @@ -99,14 +99,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_get("statuses/user_timeline.#{format}"). + stub_get("1/statuses/user_timeline.#{format}"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("statuses.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.user_timeline - a_get("statuses/user_timeline.#{format}"). + a_get("1/statuses/user_timeline.#{format}"). with(:query => {:screen_name => "sferik"}). should have_been_made end @@ -118,13 +118,13 @@ describe ".mentions" do before do - stub_get("statuses/mentions.#{format}"). + stub_get("1/statuses/mentions.#{format}"). to_return(:body => fixture("statuses.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.mentions - a_get("statuses/mentions.#{format}"). + a_get("1/statuses/mentions.#{format}"). should have_been_made end @@ -139,13 +139,13 @@ describe ".retweeted_by_me" do before do - stub_get("statuses/retweeted_by_me.#{format}"). + stub_get("1/statuses/retweeted_by_me.#{format}"). to_return(:body => fixture("statuses.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.retweeted_by_me - a_get("statuses/retweeted_by_me.#{format}"). + a_get("1/statuses/retweeted_by_me.#{format}"). should have_been_made end @@ -160,13 +160,13 @@ describe ".retweeted_to_me" do before do - stub_get("statuses/retweeted_to_me.#{format}"). + stub_get("1/statuses/retweeted_to_me.#{format}"). to_return(:body => fixture("statuses.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.retweeted_to_me - a_get("statuses/retweeted_to_me.#{format}"). + a_get("1/statuses/retweeted_to_me.#{format}"). should have_been_made end @@ -181,13 +181,13 @@ describe ".retweets_of_me" do before do - stub_get("statuses/retweets_of_me.#{format}"). + stub_get("1/statuses/retweets_of_me.#{format}"). to_return(:body => fixture("statuses.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.retweets_of_me - a_get("statuses/retweets_of_me.#{format}"). + a_get("1/statuses/retweets_of_me.#{format}"). should have_been_made end @@ -203,14 +203,14 @@ context "with screen name passed" do before do - stub_get("statuses/media_timeline.#{format}"). + stub_get("1/statuses/media_timeline.#{format}"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("media_timeline.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.media_timeline("sferik") - a_get("statuses/media_timeline.#{format}"). + a_get("1/statuses/media_timeline.#{format}"). with(:query => {:screen_name => "sferik"}). should have_been_made end @@ -227,14 +227,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_get("statuses/media_timeline.#{format}"). + stub_get("1/statuses/media_timeline.#{format}"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("media_timeline.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.media_timeline - a_get("statuses/media_timeline.#{format}"). + a_get("1/statuses/media_timeline.#{format}"). with(:query => {:screen_name => "sferik"}). should have_been_made end diff --git a/spec/twitter/client/trends_spec.rb b/spec/twitter/client/trends_spec.rb index 3b202e5a9..550a86891 100644 --- a/spec/twitter/client/trends_spec.rb +++ b/spec/twitter/client/trends_spec.rb @@ -10,13 +10,13 @@ describe ".trends" do before do - stub_get("trends.json"). + stub_get("1/trends.json"). to_return(:body => fixture("trends.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.trends - a_get("trends.json"). + a_get("1/trends.json"). should have_been_made end @@ -30,13 +30,13 @@ describe ".trends_current" do before do - stub_get("trends/current.json"). + stub_get("1/trends/current.json"). to_return(:body => fixture("trends_current.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.trends_current - a_get("trends/current.json"). + a_get("1/trends/current.json"). should have_been_made end @@ -50,14 +50,14 @@ describe ".trends_daily" do before do - stub_get("trends/daily.json"). + stub_get("1/trends/daily.json"). with(:query => {:date => "2010-10-24"}). to_return(:body => fixture("trends_daily.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.trends_daily(Date.parse("2010-10-24")) - a_get("trends/daily.json"). + a_get("1/trends/daily.json"). with(:query => {:date => "2010-10-24"}). should have_been_made end @@ -72,14 +72,14 @@ describe ".trends_weekly" do before do - stub_get("trends/weekly.json"). + stub_get("1/trends/weekly.json"). with(:query => {:date => "2010-10-24"}). to_return(:body => fixture("trends_weekly.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.trends_weekly(Date.parse("2010-10-24")) - a_get("trends/weekly.json"). + a_get("1/trends/weekly.json"). with(:query => {:date => "2010-10-24"}). should have_been_made end diff --git a/spec/twitter/client/tweets_spec.rb b/spec/twitter/client/tweets_spec.rb index a7bd6e23e..c993d0c17 100644 --- a/spec/twitter/client/tweets_spec.rb +++ b/spec/twitter/client/tweets_spec.rb @@ -10,13 +10,13 @@ describe ".status" do before do - stub_get("statuses/show/25938088801.#{format}"). + stub_get("1/statuses/show/25938088801.#{format}"). to_return(:body => fixture("status.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.status(25938088801) - a_get("statuses/show/25938088801.#{format}"). + a_get("1/statuses/show/25938088801.#{format}"). should have_been_made end @@ -30,14 +30,14 @@ describe ".update" do before do - stub_post("statuses/update.#{format}"). + stub_post("1/statuses/update.#{format}"). with(:body => {:status => "@noradio working on implementing #NewTwitter API methods in the twitter gem. Twurl is making it easy. Thank you!"}). to_return(:body => fixture("status.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.update("@noradio working on implementing #NewTwitter API methods in the twitter gem. Twurl is making it easy. Thank you!") - a_post("statuses/update.#{format}"). + a_post("1/statuses/update.#{format}"). with(:body => {:status => "@noradio working on implementing #NewTwitter API methods in the twitter gem. Twurl is making it easy. Thank you!"}). should have_been_made end @@ -52,13 +52,13 @@ describe ".update_with_media" do before do - stub_post("statuses/update_with_media.#{format}", Twitter.media_endpoint). + stub_post("1/statuses/update_with_media.#{format}", Twitter.media_endpoint). to_return(:body => fixture("status_with_media.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.update_with_media("You always have options", fixture("me.jpeg")) - a_post("statuses/update_with_media.#{format}", Twitter.media_endpoint). + a_post("1/statuses/update_with_media.#{format}", Twitter.media_endpoint). should have_been_made end @@ -77,13 +77,13 @@ describe ".status_destroy" do before do - stub_delete("statuses/destroy/25938088801.#{format}"). + stub_delete("1/statuses/destroy/25938088801.#{format}"). to_return(:body => fixture("status.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.status_destroy(25938088801) - a_delete("statuses/destroy/25938088801.#{format}"). + a_delete("1/statuses/destroy/25938088801.#{format}"). should have_been_made end @@ -97,13 +97,13 @@ describe ".retweet" do before do - stub_post("statuses/retweet/28561922516.#{format}"). + stub_post("1/statuses/retweet/28561922516.#{format}"). to_return(:body => fixture("retweet.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.retweet(28561922516) - a_post("statuses/retweet/28561922516.#{format}"). + a_post("1/statuses/retweet/28561922516.#{format}"). should have_been_made end @@ -117,13 +117,13 @@ describe ".retweets" do before do - stub_get("statuses/retweets/28561922516.#{format}"). + stub_get("1/statuses/retweets/28561922516.#{format}"). to_return(:body => fixture("retweets.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.retweets(28561922516) - a_get("statuses/retweets/28561922516.#{format}"). + a_get("1/statuses/retweets/28561922516.#{format}"). should have_been_made end @@ -138,13 +138,13 @@ describe ".retweeters_of" do before do - stub_get("statuses/27467028175/retweeted_by.#{format}"). + stub_get("1/statuses/27467028175/retweeted_by.#{format}"). to_return(:body => fixture("retweeters_of.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.retweeters_of(27467028175) - a_get("statuses/27467028175/retweeted_by.#{format}"). + a_get("1/statuses/27467028175/retweeted_by.#{format}"). should have_been_made end diff --git a/spec/twitter/client/urls_spec.rb b/spec/twitter/client/urls_spec.rb index 60ffedb3a..a9d609567 100644 --- a/spec/twitter/client/urls_spec.rb +++ b/spec/twitter/client/urls_spec.rb @@ -9,14 +9,14 @@ describe ".resolve" do before do - stub_get("urls/resolve.json"). + stub_get("1/urls/resolve.json"). with(:query => {:urls => ["http://t.co/uw5bn1w"]}). to_return(:body => fixture("resolve.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.resolve('http://t.co/uw5bn1w') - a_get("urls/resolve.json"). + a_get("1/urls/resolve.json"). with(:query => {:urls => ["http://t.co/uw5bn1w"]}). should have_been_made end diff --git a/spec/twitter/client/user_spec.rb b/spec/twitter/client/user_spec.rb index 40fd1428a..b5fea52cf 100644 --- a/spec/twitter/client/user_spec.rb +++ b/spec/twitter/client/user_spec.rb @@ -12,14 +12,14 @@ context "with screen name passed" do before do - stub_get("users/show.#{format}"). + stub_get("1/users/show.#{format}"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.user("sferik") - a_get("users/show.#{format}"). + a_get("1/users/show.#{format}"). with(:query => {:screen_name => "sferik"}). should have_been_made end @@ -34,14 +34,14 @@ context "with screen name including '@' passed" do before do - stub_get("users/show.#{format}"). + stub_get("1/users/show.#{format}"). with(:query => {:screen_name => "@sferik"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.user("@sferik") - a_get("users/show.#{format}"). + a_get("1/users/show.#{format}"). with(:query => {:screen_name => "@sferik"}). should have_been_made end @@ -51,14 +51,14 @@ context "with numeric screen name passed" do before do - stub_get("users/show.#{format}"). + stub_get("1/users/show.#{format}"). with(:query => {:screen_name => "0"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.user("0") - a_get("users/show.#{format}"). + a_get("1/users/show.#{format}"). with(:query => {:screen_name => "0"}). should have_been_made end @@ -68,14 +68,14 @@ context "with user ID passed" do before do - stub_get("users/show.#{format}"). + stub_get("1/users/show.#{format}"). with(:query => {:user_id => "7505382"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.user(7505382) - a_get("users/show.#{format}"). + a_get("1/users/show.#{format}"). with(:query => {:user_id => "7505382"}). should have_been_made end @@ -86,14 +86,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_get("users/show.#{format}"). + stub_get("1/users/show.#{format}"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("sferik.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.user - a_get("users/show.#{format}"). + a_get("1/users/show.#{format}"). with(:query => {:screen_name => "sferik"}). should have_been_made end @@ -105,17 +105,17 @@ describe ".user?" do before do - stub_get("users/show.json"). + stub_get("1/users/show.json"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"}) - stub_get("users/show.json"). + stub_get("1/users/show.json"). with(:query => {:screen_name => "pengwynn"}). to_return(:body => fixture("not_found.json"), :status => 404, :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do @client.user?("sferik") - a_get("users/show.json"). + a_get("1/users/show.json"). with(:query => {:screen_name => "sferik"}). should have_been_made end @@ -137,14 +137,14 @@ context "with screen names passed" do before do - stub_get("users/lookup.#{format}"). + stub_get("1/users/lookup.#{format}"). with(:query => {:screen_name => "sferik,pengwynn"}). to_return(:body => fixture("users.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.users("sferik", "pengwynn") - a_get("users/lookup.#{format}"). + a_get("1/users/lookup.#{format}"). with(:query => {:screen_name => "sferik,pengwynn"}). should have_been_made end @@ -160,14 +160,14 @@ context "with numeric screen names passed" do before do - stub_get("users/lookup.#{format}"). + stub_get("1/users/lookup.#{format}"). with(:query => {:screen_name => "0,311"}). to_return(:body => fixture("users.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.users("0", "311") - a_get("users/lookup.#{format}"). + a_get("1/users/lookup.#{format}"). with(:query => {:screen_name => "0,311"}). should have_been_made end @@ -177,14 +177,14 @@ context "with user IDs passed" do before do - stub_get("users/lookup.#{format}"). + stub_get("1/users/lookup.#{format}"). with(:query => {:user_id => "7505382,14100886"}). to_return(:body => fixture("users.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.users(7505382, 14100886) - a_get("users/lookup.#{format}"). + a_get("1/users/lookup.#{format}"). with(:query => {:user_id => "7505382,14100886"}). should have_been_made end @@ -194,14 +194,14 @@ context "with both screen names and user IDs passed" do before do - stub_get("users/lookup.#{format}"). + stub_get("1/users/lookup.#{format}"). with(:query => {:screen_name => "sferik", :user_id => "14100886"}). to_return(:body => fixture("users.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.users("sferik", 14100886) - a_get("users/lookup.#{format}"). + a_get("1/users/lookup.#{format}"). with(:query => {:screen_name => "sferik", :user_id => "14100886"}). should have_been_made end @@ -213,14 +213,14 @@ describe ".user_search" do before do - stub_get("users/search.#{format}"). + stub_get("1/users/search.#{format}"). with(:query => {:q => "Erik Michaels-Ober"}). to_return(:body => fixture("user_search.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.user_search("Erik Michaels-Ober") - a_get("users/search.#{format}"). + a_get("1/users/search.#{format}"). with(:query => {:q => "Erik Michaels-Ober"}). should have_been_made end @@ -238,13 +238,13 @@ context "with a category slug passed" do before do - stub_get("users/suggestions/art-design.#{format}"). + stub_get("1/users/suggestions/art-design.#{format}"). to_return(:body => fixture("category.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.suggestions("art-design") - a_get("users/suggestions/art-design.#{format}"). + a_get("1/users/suggestions/art-design.#{format}"). should have_been_made end @@ -258,13 +258,13 @@ context "without arguments passed" do before do - stub_get("users/suggestions.#{format}"). + stub_get("1/users/suggestions.#{format}"). to_return(:body => fixture("suggestions.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.suggestions - a_get("users/suggestions.#{format}"). + a_get("1/users/suggestions.#{format}"). should have_been_made end @@ -283,13 +283,13 @@ context "with screen name passed" do before do - stub_get("users/profile_image/sferik.json"). + stub_get("1/users/profile_image/sferik.json"). to_return(fixture("profile_image.text")) end it "should redirect to the correct resource" do profile_image = @client.profile_image("sferik") - a_get("users/profile_image/sferik.json"). + a_get("1/users/profile_image/sferik.json"). with(:status => 302). should have_been_made profile_image.should == "http://a0.twimg.com/profile_images/323331048/me_normal.jpg" @@ -301,13 +301,13 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_get("users/profile_image/sferik.json"). + stub_get("1/users/profile_image/sferik.json"). to_return(fixture("profile_image.text")) end it "should redirect to the correct resource" do profile_image = @client.profile_image - a_get("users/profile_image/sferik.json"). + a_get("1/users/profile_image/sferik.json"). with(:status => 302). should have_been_made profile_image.should == "http://a0.twimg.com/profile_images/323331048/me_normal.jpg" @@ -322,14 +322,14 @@ context "with a screen name passed" do before do - stub_get("statuses/friends.#{format}"). + stub_get("1/statuses/friends.#{format}"). with(:query => {:screen_name => "sferik", :cursor => "-1"}). to_return(:body => fixture("friends.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.friends("sferik") - a_get("statuses/friends.#{format}"). + a_get("1/statuses/friends.#{format}"). with(:query => {:screen_name => "sferik", :cursor => "-1"}). should have_been_made end @@ -345,14 +345,14 @@ context "without arguments passed" do before do - stub_get("statuses/friends.#{format}"). + stub_get("1/statuses/friends.#{format}"). with(:query => {:cursor => "-1"}). to_return(:body => fixture("friends.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.friends - a_get("statuses/friends.#{format}"). + a_get("1/statuses/friends.#{format}"). with(:query => {:cursor => "-1"}). should have_been_made end @@ -372,14 +372,14 @@ context "with a screen name passed" do before do - stub_get("statuses/followers.#{format}"). + stub_get("1/statuses/followers.#{format}"). with(:query => {:screen_name => "sferik", :cursor => "-1"}). to_return(:body => fixture("followers.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.followers("sferik") - a_get("statuses/followers.#{format}"). + a_get("1/statuses/followers.#{format}"). with(:query => {:screen_name => "sferik", :cursor => "-1"}). should have_been_made end @@ -395,14 +395,14 @@ context "without arguments passed" do before do - stub_get("statuses/followers.#{format}"). + stub_get("1/statuses/followers.#{format}"). with(:query => {:cursor => "-1"}). to_return(:body => fixture("followers.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.followers - a_get("statuses/followers.#{format}"). + a_get("1/statuses/followers.#{format}"). with(:query => {:cursor => "-1"}). should have_been_made end @@ -420,13 +420,13 @@ describe ".recommendations" do before do - stub_get("users/recommendations.#{format}"). + stub_get("1/users/recommendations.#{format}"). to_return(:body => fixture("recommendations.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.recommendations - a_get("users/recommendations.#{format}"). + a_get("1/users/recommendations.#{format}"). should have_been_made end @@ -442,14 +442,14 @@ context "with a screen name passed" do before do - stub_get("users/contributees.#{format}"). + stub_get("1/users/contributees.#{format}"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("contributees.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.contributees("sferik") - a_get("users/contributees.#{format}"). + a_get("1/users/contributees.#{format}"). with(:query => {:screen_name => "sferik"}). should have_been_made end @@ -465,14 +465,14 @@ before do @client.stub!(:get_screen_name).and_return('sferik') - stub_get("users/contributees.#{format}"). + stub_get("1/users/contributees.#{format}"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("contributees.#{format}"), :headers => {:content_type => "application/#{format}; charset=utf-8"}) end it "should get the correct resource" do @client.contributees - a_get("users/contributees.#{format}"). + a_get("1/users/contributees.#{format}"). with(:query => {:screen_name => "sferik"}). should have_been_made end diff --git a/spec/twitter/client_spec.rb b/spec/twitter/client_spec.rb index c572f0655..1021c9b8d 100644 --- a/spec/twitter/client_spec.rb +++ b/spec/twitter/client_spec.rb @@ -9,11 +9,11 @@ end it "should not cache the screen name across clients" do - stub_get("account/verify_credentials.json"). + stub_get("1/account/verify_credentials.json"). to_return(:body => fixture("sferik.json"), :headers => {:content_type => "application/json; charset=utf-8"}) client1 = Twitter::Client.new(:oauth_token => 'ot1', :oauth_token_secret => 'ots1') client1.send(:get_screen_name).should == "sferik" - stub_get("account/verify_credentials.json"). + stub_get("1/account/verify_credentials.json"). to_return(:body => fixture("pengwynn.json"), :headers => {:content_type => "application/json; charset=utf-8"}) client2 = Twitter::Client.new(:oauth_token => 'ot2', :oauth_token_secret => 'ots2') client2.send(:get_screen_name).should == "pengwynn" diff --git a/spec/twitter_spec.rb b/spec/twitter_spec.rb index 794ab755b..fb96452ed 100644 --- a/spec/twitter_spec.rb +++ b/spec/twitter_spec.rb @@ -8,14 +8,14 @@ context "when delegating to a client" do before do - stub_get("statuses/user_timeline.json"). + stub_get("1/statuses/user_timeline.json"). with(:query => {:screen_name => "sferik"}). to_return(:body => fixture("statuses.json"), :headers => {:content_type => "application/json; charset=utf-8"}) end it "should get the correct resource" do Twitter.user_timeline('sferik') - a_get("statuses/user_timeline.json"). + a_get("1/statuses/user_timeline.json"). with(:query => {:screen_name => "sferik"}). should have_been_made end