mirror of
https://git.kescher.at/CatCatNya/catstodon.git
synced 2024-11-27 15:01:36 +01:00
5aa3df017b
add ability to open status by URL from search (fix #53)
18 lines
435 B
Ruby
18 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
|