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.

21 lines
644 B

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