blob: 2185ceb202deab2761de40700ffc3e4e29d95509 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
# 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
|