Refactor Reportbooru API clients.

* Combine MissedSearchService, PostViewCountService, and
  PopularSearchService into single ReportbooruService class.
* Use Danbooru::Http for these services instead of HTTParty.
This commit is contained in:
evazion
2020-06-14 00:24:15 -05:00
parent 1846133cd6
commit a4df18e650
17 changed files with 102 additions and 143 deletions

View File

@@ -169,8 +169,8 @@ module PostSets
end
def popular_tags
if PopularSearchService.enabled?
PopularSearchService.new(Date.today).tags
if reportbooru_service.enabled?
reportbooru_service.popular_searches(Date.today, limit: MAX_SIDEBAR_TAGS).map(&:first)
else
frequent_tags
end
@@ -199,6 +199,10 @@ module PostSets
def tag_list_html(**options)
tag_set_presenter.tag_list_html(name_only: query.is_metatag?(:search), **options)
end
def reportbooru_service
@reportbooru_service ||= ReportbooruService.new
end
end
end
end