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.
 
 
 
 

19 lines
435 B

  1. # frozen_string_literal: true
  2. class FetchRemoteResourceService < BaseService
  3. def call(url)
  4. atom_url, body = FetchAtomService.new.call(url)
  5. return nil if atom_url.nil?
  6. xml = Nokogiri::XML(body)
  7. xml.encoding = 'utf-8'
  8. if xml.root.name == 'feed'
  9. FetchRemoteAccountService.new.call(atom_url, body)
  10. elsif xml.root.name == 'entry'
  11. FetchRemoteStatusService.new.call(atom_url, body)
  12. end
  13. end
  14. end