public
Created

  • Download Gist
get_basic_profile.rb
Ruby
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
def get_basic_profile
bprofile = BasicProfile.find_by_user_id(current_user.id)
if bprofile.nil?
client = get_client
profile = client.profile(:fields => ["first-name", "last-name", "maiden-name", "formatted-name" ,:headline, :location, :industry, :summary, :specialties, "picture-url", "public-profile-url"])
 
basic_profile = profile.to_hash
basic_profile[:location] = basic_profile["location"]["name"]
new_basic_profile = BasicProfile.new(basic_profile)
new_basic_profile.user = current_user
new_basic_profile.save
new_basic_profile
else
bprofile
end
end

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.