Added v 0.3.1 snapshot.
[twitter4r-core.git] / lib / twitter / client / profile.rb
blob90dd40687d550051b6be0cfb130e5f46ab277db9
1 class Twitter::Client
2   @@PROFILE_URIS = {
3     :info => '/account/update_profile',
4     :colors => '/account/update_profile_colors',
5     :device => '/account/update_delivery_device',
6   }
7   
8   # Provides access to the Twitter Profile API.
9   # 
10   # You can update profile information.  You can update the types of profile 
11   # information:
12   # * :info (name, email, url, location, description)
13   # * :colors (background_color, text_color, link_color, sidebar_fill_color, 
14   # sidebar_border_color)
15   # * :device (set device to either "sms", "im" or "none")
16   # 
17   # Example:
18   #  user = client.profile(:info, :location => "University Library")
19   #  puts user.inspect
20   def profile(action, attributes)
21     connection = create_http_connection
22     connection.start do |connection|
23       response = http_connect(attributes.to_http_str) do |conn|
24         create_http_post_request(@@PROFILE_URIS[action])
25       end
26       bless_models(Twitter::User.unmarshal(response.body))
27     end
28   end
29 end