Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Move version out of endpoint and into path

  • Loading branch information...
commit d156fd54a8591b44b22f72890099fce0ce4d58c8 1 parent 1cc1f3c
@sferik authored
Showing with 453 additions and 453 deletions.
  1. +11 −11 lib/twitter/client/account.rb
  2. +5 −5 lib/twitter/client/block.rb
  3. +4 −4 lib/twitter/client/direct_messages.rb
  4. +3 −3 lib/twitter/client/favorites.rb
  5. +2 −2 lib/twitter/client/friends_and_followers.rb
  6. +6 −6 lib/twitter/client/friendship.rb
  7. +5 −5 lib/twitter/client/geo.rb
  8. +2 −2 lib/twitter/client/help.rb
  9. +2 −2 lib/twitter/client/legal.rb
  10. +8 −8 lib/twitter/client/list.rb
  11. +5 −5 lib/twitter/client/list_members.rb
  12. +4 −4 lib/twitter/client/list_subscribers.rb
  13. +2 −2 lib/twitter/client/local_trends.rb
  14. +2 −2 lib/twitter/client/notification.rb
  15. +4 −4 lib/twitter/client/saved_searches.rb
  16. +2 −2 lib/twitter/client/search.rb
  17. +1 −1  lib/twitter/client/spam_reporting.rb
  18. +8 −8 lib/twitter/client/timeline.rb
  19. +4 −4 lib/twitter/client/trends.rb
  20. +7 −7 lib/twitter/client/tweets.rb
  21. +1 −1  lib/twitter/client/urls.rb
  22. +13 −13 lib/twitter/client/user.rb
  23. +2 −2 lib/twitter/configuration.rb
  24. +3 −3 spec/faraday/response_spec.rb
  25. +2 −2 spec/twitter/base_spec.rb
  26. +22 −22 spec/twitter/client/account_spec.rb
  27. +11 −11 spec/twitter/client/block_spec.rb
  28. +8 −8 spec/twitter/client/direct_messages_spec.rb
  29. +8 −8 spec/twitter/client/favorites_spec.rb
  30. +8 −8 spec/twitter/client/friends_and_followers_spec.rb
  31. +17 −17 spec/twitter/client/friendship_spec.rb
  32. +10 −10 spec/twitter/client/geo_spec.rb
  33. +4 −4 spec/twitter/client/help_spec.rb
  34. +4 −4 spec/twitter/client/legal_spec.rb
  35. +46 −46 spec/twitter/client/list_members_spec.rb
  36. +52 −52 spec/twitter/client/list_spec.rb
  37. +36 −36 spec/twitter/client/list_subscribers_spec.rb
  38. +6 −6 spec/twitter/client/local_trends_spec.rb
  39. +4 −4 spec/twitter/client/notification_spec.rb
  40. +8 −8 spec/twitter/client/saved_searches_spec.rb
  41. +4 −4 spec/twitter/client/search_spec.rb
  42. +2 −2 spec/twitter/client/spam_reporting_spec.rb
  43. +22 −22 spec/twitter/client/timeline_spec.rb
  44. +8 −8 spec/twitter/client/trends_spec.rb
  45. +14 −14 spec/twitter/client/tweets_spec.rb
  46. +2 −2 spec/twitter/client/urls_spec.rb
  47. +45 −45 spec/twitter/client/user_spec.rb
  48. +2 −2 spec/twitter/client_spec.rb
  49. +2 −2 spec/twitter_spec.rb
View
22 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
View
10 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
View
8 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
View
6 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
View
4 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
View
12 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
View
10 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
View
4 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
View
4 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
View
16 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
View
10 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
View
8 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
View
4 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
View
4 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
View
8 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
View
4 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
View
2  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
View
16 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
View
8 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
View
14 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
View
2  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
View
26 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
View
4 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
View
6 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
View
4 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
View
44 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
View
22 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
View
16 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
View
16 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
View
16 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
View
34 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
View
20 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