Skip to content

Instantly share code, notes, and snippets.

@rmanalan
Created December 23, 2008 21:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rmanalan/39476 to your computer and use it in GitHub Desktop.
Save rmanalan/39476 to your computer and use it in GitHub Desktop.
user_api = {
:id => @user_profile.id,
:name => {
:first => @user_profile.given_name,
:last => @user_profile.surname
},
:email => @user_profile.email,
:userid => @user_profile.userid,
:title => @user_profile.title,
:organization => @user_profile.organization,
:directs => @user_profile.directs,
:total_reports => @user_profile.total_reports,
:bio => @user_profile.description,
:work_floor => @user_profile.work_floor,
:work_office => @user_profile.work_office,
:work_address1 => @user_profile.work_address1,
:work_address2 => @user_profile.work_address2,
:work_address3 => @user_profile.work_address3,
:work_city => @user_profile.work_city,
:work_state => @user_profile.work_state,
:work_zip => @user_profile.work_zip,
:work_country => @user_profile.work_country,
:work_county => @user_profile.work_county,
:city => @user_profile.city,
:country => @user_profile.country,
:cost_center => @user_profile.cost_center,
:uri => user_profile_url(@user_profile),
:avatar => {
:tiny => @user_profile.avatar.url(:tiny),
:thumb => @user_profile.avatar.url(:thumb),
:square => @user_profile.avatar.url(:square),
:proportional_thumb => @user_profile.avatar.url(:proportional_thumb),
:original => @user_profile.avatar.url(:original),
},
:tags => @user_profile.tag_list.map {|t| {:name => t} },
:groups => @user_profile.groups.map {|g| {:name => g.name, :url => group_url(g)} },
:phone => {
:mobile => @user_profile.mobile_phone,
:work => @user_profile.work_phone,
:phone => @user_profile.phone_fax,
:home_office => @user_profile.phone_home_office,
:other => @user_profile.other
},
:manager => {
:name => @user_profile.manager_name,
:email => (@user_profile.parent ? @user_profile.parent.email : nil),
:id => (@user_profile.parent ? @user_profile.parent.id : nil),
:url => (@user_profile.parent ? user_profile_url(@user_profile.parent) : nil)
},
:im => {
:yahoo => @user_profile.im_yahoo,
:google => @user_profile.im_google,
:aim => @user_profile.im_aol,
:microsoft => @user_profile.im_microsoft,
:jabber => @user_profile.im_jabber,
:icq => @user_profile.im_icq,
:skype => @user_profile.im_skype
},
:network => @user_profile.network.map {|c| {
:name => {
:first => c.given_name,
:last => c.surname
},
:email => c.email,
:id => c.id,
:url => user_profile_url(c)
} if c.active }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment