You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

19 lines
613 B

  1. class UpdateRemoteProfileService < BaseService
  2. def call(author_xml, account)
  3. if author_xml.at_xpath('./poco:displayName').nil?
  4. account.display_name = account.username
  5. else
  6. account.display_name = author_xml.at_xpath('./poco:displayName').content
  7. end
  8. unless author_xml.at_xpath('./poco:note').nil?
  9. account.note = author_xml.at_xpath('./poco:note').content
  10. end
  11. unless author_xml.at_xpath('./xmlns:link[@rel="avatar"]').nil?
  12. account.avatar_remote_url = author_xml.at_xpath('./xmlns:link[@rel="avatar"]').attribute('href').value
  13. end
  14. account.save!
  15. end
  16. end