The code powering m.abunchtell.com https://m.abunchtell.com
您最多选择25个主题 主题必须以字母或数字开头,可以包含连字符 (-),并且长度不得超过35个字符

fetch_remote_resource_service.rb 435 B

123456789101112131415161718
  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