gearheads
/
mastodon
Archived
2
0
Fork 0
This repository has been archived on 2024-06-09. You can view files and clone it, but cannot push or open issues/pull-requests.
mastodon/app/services/fetch_remote_resource_servi...

19 lines
435 B
Ruby

# frozen_string_literal: true
class FetchRemoteResourceService < BaseService
def call(url)
atom_url, body = FetchAtomService.new.call(url)
return nil if atom_url.nil?
xml = Nokogiri::XML(body)
xml.encoding = 'utf-8'
if xml.root.name == 'feed'
FetchRemoteAccountService.new.call(atom_url, body)
elsif xml.root.name == 'entry'
FetchRemoteStatusService.new.call(atom_url, body)
end
end
end