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
423 B
19 lines
423 B
# 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)
|
|
elsif xml.root.name == 'entry'
|
|
FetchRemoteStatusService.new.call(atom_url)
|
|
end
|
|
end
|
|
end
|