New API method: /api/v1/search

Returns accounts, statuses, hashtags arrays
This commit is contained in:
Eugen Rochko 2017-03-22 02:32:27 +01:00
parent 98571b0ce4
commit 05cf086766
9 changed files with 99 additions and 17 deletions

View file

@ -0,0 +1,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)
elsif xml.root.name == 'entry'
FetchRemoteStatusService.new.call(atom_url)
end
end
end