Skip to content
Browse files

Add users/contributees

  • Loading branch information...
1 parent 53501ab commit 2b88f819775b9a90f4969fe03dc66ef1ecc2fb38 @JohnFord JohnFord committed Aug 22, 2011
Showing with 435 additions and 0 deletions.
  1. +38 −0 lib/twitter/client/user.rb
  2. +1 −0 spec/fixtures/contributees.json
  3. +348 −0 spec/fixtures/contributees.xml
  4. +48 −0 spec/twitter/client/user_spec.rb
View
38 lib/twitter/client/user.rb
@@ -237,6 +237,44 @@ def recommendations(options={})
response = get('users/recommendations', options)
format.to_s.downcase == 'xml' ? response['userrecommendations'] : response
end
+
+ # Returns users the specified user can contribute to.
+ #
+ # @see http://dev.twitter.com/docs/api/1/get/users/contributees
+ # @rate_limited Yes
+ # @requires_authentication No unless requesting it from a protected user
+ #
+ # If getting this data of a protected user, you must authenticate (and be allowed to see that user).
+ # @response_format `json`
+ # @response_format `xml`
+ # @overload contributees(options={})
+ # @param options [Hash] A customizable set of options.
+ # @option options [Boolean, String, Integer] :include_entities Include {http://dev.twitter.com/pages/tweet_entities Tweet Entities} when set to true, 't' or 1.
+ # @option options [Boolean, String, Integer] :skip_status Do not include contributee's statuses when set to true, 't' or 1.
+ # @return [Array]
+ # @example Return the authenticated user's contributees
+ # Twitter.contributees
+ ## @overload contributees(user, options={})
+ # @param user [Integer, String] A Twitter user ID or screen name.
+ # @param options [Hash] A customizable set of options.
+ # @option options [Boolean, String, Integer] :include_entities Include {http://dev.twitter.com/pages/tweet_entities Tweet Entities} when set to true, 't' or 1.
+ # @option options [Boolean, String, Integer] :skip_status Do not include contributee's statuses when set to true, 't' or 1.
+ # @return [Array]
+ # @example Return users @sferik can contribute to
+ # Twitter.contributees("sferik")
+ # Twitter.contributees(7505382) # Same as above
+ def contributees(*args)
+ options = {}
+ options.merge!(args.last.is_a?(Hash) ? args.pop : {})
+ user = args.pop || get_screen_name
+ if user
+ merge_user_into_options!(user, options)
+ response = get('users/contributees', options)
+ else
+ response = get('users/contributees', options)
+ end
+ format.to_s.downcase == 'xml' ? response['users'] : response
+ end
end
end
end
View
1 spec/fixtures/contributees.json
@@ -0,0 +1 @@
+[{"time_zone":"Pacific Time (US & Canada)","protected":false,"profile_use_background_image":true,"name":"Twitter API","contributors_enabled":true,"created_at":"Wed May 23 06:01:13 +0000 2007","profile_background_color":"e8f2f7","expanded_url":null,"listed_count":9032,"profile_background_image_url":"http:\/\/a2.twimg.com\/profile_background_images\/229557229\/twitterapi-bg.png","utc_offset":-28800,"description":"The Real Twitter API. I tweet about API changes, service issues and happily answer questions about Twitter and our API. Don't get an answer? It's on my website.","display_url":null,"verified":true,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/1438634086\/avatar_normal.png","id_str":"6253282","entities":{"user_mentions":[],"urls":[],"hashtags":[]},"lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/profile_background_images\/229557229\/twitterapi-bg.png","favourites_count":22,"profile_text_color":"437792","status":{"truncated":false,"created_at":"Sun Aug 21 15:47:24 +0000 2011","geo":null,"in_reply_to_user_id":null,"in_reply_to_status_id":null,"favorited":false,"in_reply_to_status_id_str":null,"coordinates":null,"id_str":"105305005493452801","in_reply_to_screen_name":null,"in_reply_to_user_id_str":null,"place":null,"contributors":[819797],"retweeted":false,"retweet_count":27,"source":"web","id":105305005493452801,"text":"dev.twitter.com is still inaccessible from some locations. We're working to restore availability to everyone again. ^TS"},"default_profile":false,"friends_count":30,"profile_sidebar_fill_color":"a9d9f1","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1438634086\/avatar_normal.png","screen_name":"twitterapi","default_profile_image":false,"show_all_inline_media":false,"geo_enabled":true,"profile_background_tile":false,"location":"San Francisco, CA","notifications":null,"is_translator":false,"profile_link_color":"0094C2","url":"http:\/\/dev.twitter.com","id":6253282,"follow_request_sent":null,"statuses_count":3044,"following":null,"profile_sidebar_border_color":"0094C2","followers_count":633992},{"time_zone":"Pacific Time (US & Canada)","protected":true,"is_translator":false,"profile_use_background_image":true,"name":"teamteam","follow_request_sent":false,"statuses_count":490,"created_at":"Thu Jun 04 20:20:20 +0000 2009","profile_background_color":"C0DEED","expanded_url":null,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","utc_offset":-28800,"description":"Do more with less. ","display_url":null,"verified":false,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/323680542\/Bluebird_of_Happiness_normal.jpg","id_str":"44709792","entities":{"user_mentions":[],"urls":[],"hashtags":[]},"contributors_enabled":true,"lang":"en","favourites_count":18,"profile_text_color":"333333","listed_count":161,"profile_sidebar_fill_color":"DDEEF6","screen_name":"teamteam","default_profile":true,"profile_background_tile":false,"location":"Twitter","notifications":false,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","friends_count":633,"profile_link_color":"0084B4","url":"http:\/\/www.flickr.com\/photos\/twitteroffice","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/323680542\/Bluebird_of_Happiness_normal.jpg","id":44709792,"default_profile_image":false,"show_all_inline_media":false,"following":false,"geo_enabled":false,"profile_sidebar_border_color":"C0DEED","followers_count":433},{"time_zone":"Pacific Time (US & Canada)","protected":true,"profile_use_background_image":true,"name":"Shoutout","contributors_enabled":true,"created_at":"Sun Dec 27 19:22:01 +0000 2009","profile_background_color":"022330","expanded_url":null,"listed_count":61,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme15\/bg.png","utc_offset":-28800,"description":"Contribute your shoutouts to peeps.","display_url":null,"verified":false,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/597683385\/shout_normal.png","id_str":"99765600","entities":{"user_mentions":[],"urls":[],"hashtags":[]},"lang":"en","profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme15\/bg.png","favourites_count":8,"profile_text_color":"333333","friends_count":3,"profile_sidebar_fill_color":"C0DFEC","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/597683385\/shout_normal.png","screen_name":"twittershoutout","default_profile_image":false,"default_profile":false,"show_all_inline_media":false,"geo_enabled":true,"profile_background_tile":false,"location":"","notifications":false,"is_translator":false,"profile_link_color":"0084B4","url":"http:\/\/twitter.com","id":99765600,"follow_request_sent":false,"statuses_count":693,"following":false,"profile_sidebar_border_color":"a8c7f7","followers_count":336},{"time_zone":"Pacific Time (US & Canada)","protected":false,"is_translator":false,"profile_use_background_image":true,"name":"Anywhere","follow_request_sent":null,"statuses_count":31,"created_at":"Sun Oct 21 09:05:41 +0000 2007","profile_background_color":"022330","expanded_url":null,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme15\/bg.png","utc_offset":-28800,"description":"Here. There. Anywhere.","display_url":null,"verified":false,"profile_image_url":"http:\/\/a1.twimg.com\/profile_images\/754566723\/_anywhere_normal.png","id_str":"9576402","entities":{"user_mentions":[],"urls":[],"hashtags":[]},"contributors_enabled":true,"lang":"en","favourites_count":11,"profile_text_color":"333333","status":{"truncated":false,"created_at":"Tue Feb 01 05:28:46 +0000 2011","geo":null,"in_reply_to_user_id":null,"in_reply_to_status_id":null,"favorited":false,"possibly_sensitive":false,"in_reply_to_status_id_str":null,"coordinates":null,"id_str":"32309362097651712","in_reply_to_screen_name":null,"in_reply_to_user_id_str":null,"place":{"country_code":"US","name":"Ashbury Heights","attributes":{},"full_name":"Ashbury Heights, San Francisco","place_type":"neighborhood","country":"United States","bounding_box":{"type":"Polygon","coordinates":[[[-122.45778216,37.75932999],[-122.44248216,37.75932999],[-122.44248216,37.76752899],[-122.45778216,37.76752899]]]},"id":"866269c983527d5a","url":"http:\/\/api.twitter.com\/1\/geo\/id\/866269c983527d5a.json"},"contributors":[777925],"retweeted":false,"retweet_count":75,"source":"web","id":32309362097651712,"text":"Version 1.2 was released today. If you version locked to anything other than '1' you need to update now. Read more: http:\/\/t.co\/ACcUovI"},"listed_count":2246,"profile_sidebar_fill_color":"C0DFEC","screen_name":"anywhere","profile_background_tile":false,"location":"Twitter, HQ","notifications":null,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme15\/bg.png","default_profile":false,"friends_count":16,"profile_link_color":"0084B4","url":null,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/754566723\/_anywhere_normal.png","id":9576402,"default_profile_image":false,"show_all_inline_media":false,"following":null,"geo_enabled":true,"profile_sidebar_border_color":"a8c7f7","followers_count":47444},{"is_translator":false,"time_zone":"Alaska","protected":false,"follow_request_sent":false,"statuses_count":0,"profile_use_background_image":true,"name":"Geo Team","created_at":"Thu Jan 07 20:30:42 +0000 2010","profile_background_color":"C0DEED","expanded_url":null,"profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","utc_offset":-32400,"description":"All your lats and longs are belong to us","display_url":null,"contributors_enabled":true,"verified":false,"profile_image_url":"http:\/\/a2.twimg.com\/profile_images\/622831073\/Geo-profile-icon_normal.png","id_str":"102782288","entities":{"user_mentions":[],"urls":[],"hashtags":[]},"listed_count":202,"lang":"en","favourites_count":0,"profile_text_color":"333333","profile_sidebar_fill_color":"DDEEF6","screen_name":"geo","profile_background_tile":false,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","location":"San Francisco, CA","notifications":false,"friends_count":0,"profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/622831073\/Geo-profile-icon_normal.png","default_profile_image":false,"default_profile":true,"show_all_inline_media":false,"geo_enabled":true,"profile_link_color":"0084B4","url":null,"id":102782288,"following":false,"profile_sidebar_border_color":"C0DEED","followers_count":3596},{"time_zone":null,"protected":false,"default_profile":true,"listed_count":98,"profile_use_background_image":true,"name":"Site Streams Beta","created_at":"Fri Aug 27 18:04:38 +0000 2010","profile_background_color":"C0DEED","expanded_url":null,"profile_background_image_url_https":"https:\/\/si0.twimg.com\/images\/themes\/theme1\/bg.png","profile_background_image_url":"http:\/\/a0.twimg.com\/images\/themes\/theme1\/bg.png","utc_offset":null,"description":"Twitter Site Streams Beta Announcements. When reporting an issue, include account & UTC. You may DM critical outages.","display_url":null,"contributors_enabled":true,"verified":true,"friends_count":1,"profile_image_url":"http:\/\/a1.twimg.com\/profile_images\/1112022529\/api_normal.png","id_str":"183709371","entities":{"user_mentions":[],"urls":[],"hashtags":[]},"default_profile_image":false,"lang":"en","favourites_count":0,"profile_text_color":"333333","status":{"truncated":false,"created_at":"Thu Aug 18 19:39:20 +0000 2011","geo":null,"in_reply_to_user_id":null,"in_reply_to_status_id":null,"favorited":false,"in_reply_to_status_id_str":null,"coordinates":null,"id_str":"104276210699341825","in_reply_to_screen_name":null,"in_reply_to_user_id_str":null,"place":null,"contributors":[777925],"retweeted":false,"retweet_count":0,"source":"web","id":104276210699341825,"text":"For the moment we've stopped the rollout of the new SSL certificate for sitestreams. We'll tweet again when we resume."},"show_all_inline_media":false,"geo_enabled":false,"profile_sidebar_fill_color":"DDEEF6","profile_image_url_https":"https:\/\/si0.twimg.com\/profile_images\/1112022529\/api_normal.png","screen_name":"sitestreams","is_translator":false,"profile_background_tile":false,"location":"San Francisco, CA","follow_request_sent":false,"notifications":false,"statuses_count":139,"profile_link_color":"0084B4","url":"http:\/\/twitter.com","id":183709371,"following":false,"profile_sidebar_border_color":"C0DEED","followers_count":2199}]
View
348 spec/fixtures/contributees.xml
@@ -0,0 +1,348 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<users type="array">
+<user>
+ <id>6253282</id>
+ <name>Twitter API</name>
+ <screen_name>twitterapi</screen_name>
+ <location>San Francisco, CA</location>
+ <description>The Real Twitter API. I tweet about API changes, service issues and happily answer questions about Twitter and our API. Don't get an answer? It's on my website.</description>
+ <profile_image_url>http://a2.twimg.com/profile_images/1438634086/avatar_normal.png</profile_image_url>
+ <profile_image_url_https>https://si0.twimg.com/profile_images/1438634086/avatar_normal.png</profile_image_url_https>
+ <url>http://dev.twitter.com</url>
+ <protected>false</protected>
+ <followers_count>633989</followers_count>
+ <profile_background_color>e8f2f7</profile_background_color>
+ <profile_text_color>437792</profile_text_color>
+ <profile_link_color>0094C2</profile_link_color>
+ <profile_sidebar_fill_color>a9d9f1</profile_sidebar_fill_color>
+ <profile_sidebar_border_color>0094C2</profile_sidebar_border_color>
+ <friends_count>30</friends_count>
+ <created_at>Wed May 23 06:01:13 +0000 2007</created_at>
+ <favourites_count>22</favourites_count>
+ <utc_offset>-28800</utc_offset>
+ <time_zone>Pacific Time (US &amp; Canada)</time_zone>
+ <profile_background_image_url>http://a2.twimg.com/profile_background_images/229557229/twitterapi-bg.png</profile_background_image_url>
+ <profile_background_image_url_https>https://si0.twimg.com/profile_background_images/229557229/twitterapi-bg.png</profile_background_image_url_https>
+ <profile_background_tile>false</profile_background_tile>
+ <profile_use_background_image>true</profile_use_background_image>
+ <notifications>false</notifications>
+ <geo_enabled>true</geo_enabled>
+ <verified>true</verified>
+ <following>false</following>
+ <statuses_count>3044</statuses_count>
+ <lang>en</lang>
+ <contributors_enabled>true</contributors_enabled>
+ <follow_request_sent>false</follow_request_sent>
+ <listed_count>9032</listed_count>
+ <show_all_inline_media>false</show_all_inline_media>
+ <default_profile>false</default_profile>
+ <default_profile_image>false</default_profile_image>
+ <expanded_url></expanded_url>
+ <display_url></display_url>
+ <entities>
+ <user_mentions/>
+ <urls/>
+ <hashtags/>
+ </entities>
+ <is_translator>false</is_translator>
+ <status>
+ <created_at>Sun Aug 21 15:47:24 +0000 2011</created_at>
+ <id>105305005493452801</id>
+ <text>dev.twitter.com is still inaccessible from some locations. We're working to restore availability to everyone again. ^TS</text>
+ <source>web</source>
+ <truncated>false</truncated>
+ <favorited>false</favorited>
+ <in_reply_to_status_id></in_reply_to_status_id>
+ <in_reply_to_user_id></in_reply_to_user_id>
+ <in_reply_to_screen_name></in_reply_to_screen_name>
+ <retweet_count>25</retweet_count>
+ <retweeted>false</retweeted>
+ <geo/>
+ <coordinates/>
+ <place/>
+ <contributors>
+ <user_id>819797</user_id>
+ </contributors>
+ </status>
+</user>
+<user>
+ <id>44709792</id>
+ <name>teamteam</name>
+ <screen_name>teamteam</screen_name>
+ <location>Twitter</location>
+ <description>Do more with less. </description>
+ <profile_image_url>http://a2.twimg.com/profile_images/323680542/Bluebird_of_Happiness_normal.jpg</profile_image_url>
+ <profile_image_url_https>https://si0.twimg.com/profile_images/323680542/Bluebird_of_Happiness_normal.jpg</profile_image_url_https>
+ <url>http://www.flickr.com/photos/twitteroffice</url>
+ <protected>true</protected>
+ <followers_count>433</followers_count>
+ <profile_background_color>C0DEED</profile_background_color>
+ <profile_text_color>333333</profile_text_color>
+ <profile_link_color>0084B4</profile_link_color>
+ <profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color>
+ <profile_sidebar_border_color>C0DEED</profile_sidebar_border_color>
+ <friends_count>633</friends_count>
+ <created_at>Thu Jun 04 20:20:20 +0000 2009</created_at>
+ <favourites_count>18</favourites_count>
+ <utc_offset>-28800</utc_offset>
+ <time_zone>Pacific Time (US &amp; Canada)</time_zone>
+ <profile_background_image_url>http://a0.twimg.com/images/themes/theme1/bg.png</profile_background_image_url>
+ <profile_background_image_url_https>https://si0.twimg.com/images/themes/theme1/bg.png</profile_background_image_url_https>
+ <profile_background_tile>false</profile_background_tile>
+ <profile_use_background_image>true</profile_use_background_image>
+ <notifications>false</notifications>
+ <geo_enabled>false</geo_enabled>
+ <verified>false</verified>
+ <following>false</following>
+ <statuses_count>490</statuses_count>
+ <lang>en</lang>
+ <contributors_enabled>true</contributors_enabled>
+ <follow_request_sent>false</follow_request_sent>
+ <listed_count>161</listed_count>
+ <show_all_inline_media>false</show_all_inline_media>
+ <default_profile>true</default_profile>
+ <default_profile_image>false</default_profile_image>
+ <expanded_url></expanded_url>
+ <display_url></display_url>
+ <entities>
+ <user_mentions/>
+ <urls/>
+ <hashtags/>
+ </entities>
+ <is_translator>false</is_translator>
+</user>
+<user>
+ <id>99765600</id>
+ <name>Shoutout</name>
+ <screen_name>twittershoutout</screen_name>
+ <location></location>
+ <description>Contribute your shoutouts to peeps.</description>
+ <profile_image_url>http://a2.twimg.com/profile_images/597683385/shout_normal.png</profile_image_url>
+ <profile_image_url_https>https://si0.twimg.com/profile_images/597683385/shout_normal.png</profile_image_url_https>
+ <url>http://twitter.com</url>
+ <protected>true</protected>
+ <followers_count>336</followers_count>
+ <profile_background_color>022330</profile_background_color>
+ <profile_text_color>333333</profile_text_color>
+ <profile_link_color>0084B4</profile_link_color>
+ <profile_sidebar_fill_color>C0DFEC</profile_sidebar_fill_color>
+ <profile_sidebar_border_color>a8c7f7</profile_sidebar_border_color>
+ <friends_count>3</friends_count>
+ <created_at>Sun Dec 27 19:22:01 +0000 2009</created_at>
+ <favourites_count>8</favourites_count>
+ <utc_offset>-28800</utc_offset>
+ <time_zone>Pacific Time (US &amp; Canada)</time_zone>
+ <profile_background_image_url>http://a0.twimg.com/images/themes/theme15/bg.png</profile_background_image_url>
+ <profile_background_image_url_https>https://si0.twimg.com/images/themes/theme15/bg.png</profile_background_image_url_https>
+ <profile_background_tile>false</profile_background_tile>
+ <profile_use_background_image>true</profile_use_background_image>
+ <notifications></notifications>
+ <geo_enabled>true</geo_enabled>
+ <verified>false</verified>
+ <following></following>
+ <statuses_count>693</statuses_count>
+ <lang>en</lang>
+ <contributors_enabled>true</contributors_enabled>
+ <follow_request_sent></follow_request_sent>
+ <listed_count>61</listed_count>
+ <show_all_inline_media>false</show_all_inline_media>
+ <default_profile>false</default_profile>
+ <default_profile_image>false</default_profile_image>
+ <expanded_url></expanded_url>
+ <display_url></display_url>
+ <entities>
+ <user_mentions/>
+ <urls/>
+ <hashtags/>
+ </entities>
+ <is_translator>false</is_translator>
+</user>
+<user>
+ <id>9576402</id>
+ <name>Anywhere</name>
+ <screen_name>anywhere</screen_name>
+ <location>Twitter, HQ</location>
+ <description>Here. There. Anywhere.</description>
+ <profile_image_url>http://a1.twimg.com/profile_images/754566723/_anywhere_normal.png</profile_image_url>
+ <profile_image_url_https>https://si0.twimg.com/profile_images/754566723/_anywhere_normal.png</profile_image_url_https>
+ <url></url>
+ <protected>false</protected>
+ <followers_count>47444</followers_count>
+ <profile_background_color>022330</profile_background_color>
+ <profile_text_color>333333</profile_text_color>
+ <profile_link_color>0084B4</profile_link_color>
+ <profile_sidebar_fill_color>C0DFEC</profile_sidebar_fill_color>
+ <profile_sidebar_border_color>a8c7f7</profile_sidebar_border_color>
+ <friends_count>16</friends_count>
+ <created_at>Sun Oct 21 09:05:41 +0000 2007</created_at>
+ <favourites_count>11</favourites_count>
+ <utc_offset>-28800</utc_offset>
+ <time_zone>Pacific Time (US &amp; Canada)</time_zone>
+ <profile_background_image_url>http://a0.twimg.com/images/themes/theme15/bg.png</profile_background_image_url>
+ <profile_background_image_url_https>https://si0.twimg.com/images/themes/theme15/bg.png</profile_background_image_url_https>
+ <profile_background_tile>false</profile_background_tile>
+ <profile_use_background_image>true</profile_use_background_image>
+ <notifications>false</notifications>
+ <geo_enabled>true</geo_enabled>
+ <verified>false</verified>
+ <following>false</following>
+ <statuses_count>31</statuses_count>
+ <lang>en</lang>
+ <contributors_enabled>true</contributors_enabled>
+ <follow_request_sent>false</follow_request_sent>
+ <listed_count>2246</listed_count>
+ <show_all_inline_media>false</show_all_inline_media>
+ <default_profile>false</default_profile>
+ <default_profile_image>false</default_profile_image>
+ <expanded_url></expanded_url>
+ <display_url></display_url>
+ <entities>
+ <user_mentions/>
+ <urls/>
+ <hashtags/>
+ </entities>
+ <is_translator>false</is_translator>
+ <status>
+ <created_at>Tue Feb 01 05:28:46 +0000 2011</created_at>
+ <id>32309362097651712</id>
+ <text>Version 1.2 was released today. If you version locked to anything other than '1' you need to update now. Read more: http://t.co/ACcUovI</text>
+ <source>web</source>
+ <truncated>false</truncated>
+ <favorited>false</favorited>
+ <in_reply_to_status_id></in_reply_to_status_id>
+ <in_reply_to_user_id></in_reply_to_user_id>
+ <in_reply_to_screen_name></in_reply_to_screen_name>
+ <retweet_count>75</retweet_count>
+ <retweeted>false</retweeted>
+ <geo/>
+ <coordinates/>
+ <place xmlns:georss="http://www.georss.org/georss">
+ <id>866269c983527d5a</id>
+ <name>Ashbury Heights</name>
+ <full_name>Ashbury Heights, San Francisco</full_name>
+ <place_type>neighborhood</place_type>
+ <url>http://api.twitter.com/1/geo/id/866269c983527d5a.json</url>
+ <attributes/>
+ <bounding_box>
+ <georss:polygon>37.75932999 -122.45778216 37.75932999 -122.44248216 37.76752899 -122.44248216 37.76752899 -122.45778216</georss:polygon>
+ </bounding_box>
+ <country code="US">United States</country>
+ </place>
+ <possibly_sensitive>false</possibly_sensitive>
+ <contributors>
+ <user_id>777925</user_id>
+ </contributors>
+ </status>
+</user>
+<user>
+ <id>102782288</id>
+ <name>Geo Team</name>
+ <screen_name>geo</screen_name>
+ <location>San Francisco, CA</location>
+ <description>All your lats and longs are belong to us</description>
+ <profile_image_url>http://a2.twimg.com/profile_images/622831073/Geo-profile-icon_normal.png</profile_image_url>
+ <profile_image_url_https>https://si0.twimg.com/profile_images/622831073/Geo-profile-icon_normal.png</profile_image_url_https>
+ <url></url>
+ <protected>false</protected>
+ <followers_count>3595</followers_count>
+ <profile_background_color>C0DEED</profile_background_color>
+ <profile_text_color>333333</profile_text_color>
+ <profile_link_color>0084B4</profile_link_color>
+ <profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color>
+ <profile_sidebar_border_color>C0DEED</profile_sidebar_border_color>
+ <friends_count>0</friends_count>
+ <created_at>Thu Jan 07 20:30:42 +0000 2010</created_at>
+ <favourites_count>0</favourites_count>
+ <utc_offset>-32400</utc_offset>
+ <time_zone>Alaska</time_zone>
+ <profile_background_image_url>http://a0.twimg.com/images/themes/theme1/bg.png</profile_background_image_url>
+ <profile_background_image_url_https>https://si0.twimg.com/images/themes/theme1/bg.png</profile_background_image_url_https>
+ <profile_background_tile>false</profile_background_tile>
+ <profile_use_background_image>true</profile_use_background_image>
+ <notifications></notifications>
+ <geo_enabled>true</geo_enabled>
+ <verified>false</verified>
+ <following></following>
+ <statuses_count>0</statuses_count>
+ <lang>en</lang>
+ <contributors_enabled>true</contributors_enabled>
+ <follow_request_sent></follow_request_sent>
+ <listed_count>202</listed_count>
+ <show_all_inline_media>false</show_all_inline_media>
+ <default_profile>true</default_profile>
+ <default_profile_image>false</default_profile_image>
+ <expanded_url></expanded_url>
+ <display_url></display_url>
+ <entities>
+ <user_mentions/>
+ <urls/>
+ <hashtags/>
+ </entities>
+ <is_translator>false</is_translator>
+</user>
+<user>
+ <id>183709371</id>
+ <name>Site Streams Beta</name>
+ <screen_name>sitestreams</screen_name>
+ <location>San Francisco, CA</location>
+ <description>Twitter Site Streams Beta Announcements. When reporting an issue, include account &amp; UTC. You may DM critical outages.</description>
+ <profile_image_url>http://a1.twimg.com/profile_images/1112022529/api_normal.png</profile_image_url>
+ <profile_image_url_https>https://si0.twimg.com/profile_images/1112022529/api_normal.png</profile_image_url_https>
+ <url>http://twitter.com</url>
+ <protected>false</protected>
+ <followers_count>2199</followers_count>
+ <profile_background_color>C0DEED</profile_background_color>
+ <profile_text_color>333333</profile_text_color>
+ <profile_link_color>0084B4</profile_link_color>
+ <profile_sidebar_fill_color>DDEEF6</profile_sidebar_fill_color>
+ <profile_sidebar_border_color>C0DEED</profile_sidebar_border_color>
+ <friends_count>1</friends_count>
+ <created_at>Fri Aug 27 18:04:38 +0000 2010</created_at>
+ <favourites_count>0</favourites_count>
+ <utc_offset></utc_offset>
+ <time_zone></time_zone>
+ <profile_background_image_url>http://a0.twimg.com/images/themes/theme1/bg.png</profile_background_image_url>
+ <profile_background_image_url_https>https://si0.twimg.com/images/themes/theme1/bg.png</profile_background_image_url_https>
+ <profile_background_tile>false</profile_background_tile>
+ <profile_use_background_image>true</profile_use_background_image>
+ <notifications></notifications>
+ <geo_enabled>false</geo_enabled>
+ <verified>true</verified>
+ <following></following>
+ <statuses_count>139</statuses_count>
+ <lang>en</lang>
+ <contributors_enabled>true</contributors_enabled>
+ <follow_request_sent></follow_request_sent>
+ <listed_count>98</listed_count>
+ <show_all_inline_media>false</show_all_inline_media>
+ <default_profile>true</default_profile>
+ <default_profile_image>false</default_profile_image>
+ <expanded_url></expanded_url>
+ <display_url></display_url>
+ <entities>
+ <user_mentions/>
+ <urls/>
+ <hashtags/>
+ </entities>
+ <is_translator>false</is_translator>
+ <status>
+ <created_at>Thu Aug 18 19:39:20 +0000 2011</created_at>
+ <id>104276210699341825</id>
+ <text>For the moment we've stopped the rollout of the new SSL certificate for sitestreams. We'll tweet again when we resume.</text>
+ <source>web</source>
+ <truncated>false</truncated>
+ <favorited>false</favorited>
+ <in_reply_to_status_id></in_reply_to_status_id>
+ <in_reply_to_user_id></in_reply_to_user_id>
+ <in_reply_to_screen_name></in_reply_to_screen_name>
+ <retweet_count>0</retweet_count>
+ <retweeted>false</retweeted>
+ <geo/>
+ <coordinates/>
+ <place/>
+ <contributors>
+ <user_id>777925</user_id>
+ </contributors>
+ </status>
+</user>
+</users>
View
48 spec/twitter/client/user_spec.rb
@@ -436,6 +436,54 @@
recommendations.first.user.name.should == "John Trupiano"
end
end
+
+ describe ".contributees" do
+
+ context "with a screen name passed" do
+
+ before do
+ stub_get("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}").
+ with(:query => {:screen_name => "sferik"}).
+ should have_been_made
+ end
+
+ it "should return a user's contributees" do
+ contributees = @client.contributees("sferik")
+ contributees.should be_an Array
+ contributees.first.name.should == "Twitter API"
+ end
+ end
+
+ context "without arguments passed" do
+
+ before do
+ @client.stub!(:get_screen_name).and_return('sferik')
+ stub_get("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}").
+ with(:query => {:screen_name => "sferik"}).
+ should have_been_made
+ end
+
+ it "should return a user's contributees" do
+ contributees = @client.contributees
+ contributees.should be_an Array
+ contributees.first.name.should == "Twitter API"
+ end
+ end
+ end
end
end
end

0 comments on commit 2b88f81

Please sign in to comment.
Something went wrong with that request. Please try again.