The code powering m.abunchtell.com https://m.abunchtell.com
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
602 B

  1. class ProcessFeedUpdateService
  2. def call(body, account)
  3. xml = Nokogiri::XML(body)
  4. xml.xpath('/xmlns:feed/xmlns:entry').each do |entry|
  5. uri = entry.at_xpath('./xmlns:id').content
  6. status = Status.find_by(uri: uri)
  7. next unless status.nil?
  8. status = Status.new
  9. status.account = account
  10. status.uri = uri
  11. status.text = entry.at_xpath('./xmlns:content').content
  12. status.created_at = entry.at_xpath('./xmlns:published').content
  13. status.updated_at = entry.at_xpath('./xmlns:updated').content
  14. status.save!
  15. end
  16. end
  17. end