Class: Mapper::Notion::WorkItemsLimit

Inherits:
Object
  • Object
show all
Includes:
Base
Defined in:
lib/bas/mapper/notion/work_items_limit.rb

Overview

This class implementats the methods of the Mapper::Base module, specifically designed for preparing or shaping work items data coming from a Fetcher::Base implementation.

Constant Summary collapse

WORK_ITEM_PARAMS =
["Responsible domain"].freeze

Instance Method Summary collapse

Instance Method Details

#map(notion_response) ⇒ Object

Implements the logic for shaping the results from a fetcher response.


Params:

  • Fetcher::Notion::Types::Response notion_response: Notion response object.


return List<Domain::WorkItem> work_items_list, mapped work items to be used by a Formatter::Base implementation.



26
27
28
29
30
31
32
33
34
35
36
# File 'lib/bas/mapper/notion/work_items_limit.rb', line 26

def map(notion_response)
  return [] if notion_response.results.empty?

  normalized_notion_data = normalize_response(notion_response.results)

  domain_items_count = count_domain_items(normalized_notion_data)

  domain_items_count.map do |domain, items_count|
    Domain::WorkItemsLimit.new(domain, items_count)
  end
end