module Ctrlo
  class RefreshAll
    def initialize
    end

    def self.perform
      new.perform
    end

    def perform
      external_board_ids.map do |id|
        ExternalList.fetch(id, { mode: :board })
        ExternalCard.fetch(id, { mode: :board })
        ExternalComment.fetch(id, { mode: :board })
        ExternalMember.fetch(id, { mode: :board })
      end
      true
    end

    private

    def external_board_ids
      active_boards.map(&:external_board_id)
    end

    def active_boards
      all_boards.delete_if { |b| b.closed == true }
    end

    def all_boards
      @boards ||= ExternalBoard.refresh_all
    end
  end
end

module Ctrlo
  class RefreshAll
    def initialize(options = {})
      @options = options
    end

    def self.perform(options = {})
      new(options).perform
    end

    def perform
      external_board_ids.map do |id|
        ExternalList.fetch(id, options)
        ExternalCard.fetch(id, options)
        ExternalComment.fetch(id, options)
        ExternalMember.fetch(id, options)
      end
      true
    end

    private

    def options
      defaults.merge!(@options)
    end

    def defaults
      { mode: :board }
    end

    def external_board_ids
      active_boards.map(&:external_board_id)
    end

    def active_boards
      all_boards.delete_if { |b| b.closed == true }
    end

    def all_boards
      @boards ||= ExternalBoard.refresh_all
    end
  end
end

Refactor { mode: :board } into an options hash.
Refactor { mode: :board } into an options hash.