2016-11-15 10:56:29 -05:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
2016-09-26 10:42:38 -04:00
|
|
|
class FetchRemoteAccountService < BaseService
|
2017-08-14 08:08:34 -04:00
|
|
|
def call(url, prefetched_body = nil, protocol = :ostatus)
|
2017-03-22 12:36:34 -04:00
|
|
|
if prefetched_body.nil?
|
2017-10-03 19:13:48 -04:00
|
|
|
resource_url, resource_options, protocol = FetchAtomService.new.call(url)
|
2017-03-22 12:36:34 -04:00
|
|
|
else
|
2017-10-03 19:13:48 -04:00
|
|
|
resource_url = url
|
|
|
|
resource_options = { prefetched_body: prefetched_body }
|
2017-03-22 12:36:34 -04:00
|
|
|
end
|
2016-09-26 10:42:38 -04:00
|
|
|
|
2017-08-13 20:29:36 -04:00
|
|
|
case protocol
|
|
|
|
when :activitypub
|
2017-10-03 19:13:48 -04:00
|
|
|
ActivityPub::FetchRemoteAccountService.new.call(resource_url, **resource_options)
|
2017-08-13 20:29:36 -04:00
|
|
|
end
|
2016-09-26 10:42:38 -04:00
|
|
|
end
|
|
|
|
end
|