stringer-rss/stringer

View on GitHub
app/commands/fever_api/sync_unread_item_ids.rb

Summary

Maintainability
A
0 mins
Test Coverage
# frozen_string_literal: true

module FeverAPI::SyncUnreadItemIds
  class << self
    def call(authorization:, **params)
      if params.key?(:unread_item_ids)
        { unread_item_ids: unread_item_ids(authorization) }
      else
        {}
      end
    end

    private

    def unread_item_ids(authorization)
      authorization.scope(unread_stories).map(&:id).join(",")
    end

    def unread_stories
      StoryRepository.unread
    end
  end
end