Class: Mapper::Notion::PtoToday
- Inherits:
-
Object
- Object
- Mapper::Notion::PtoToday
- Includes:
- Base
- Defined in:
- lib/bas/mapper/notion/pto_today.rb
Overview
This class implementats the methods of the Mapper::Base module, specifically designed for preparing or shaping PTO’s data coming from a Fetcher::Base implementation.
Constant Summary collapse
- PTO_PARAMS =
["Person", "Desde?", "Hasta?"].freeze
Instance Method Summary collapse
-
#map(notion_response) ⇒ Object
Implements the logic for shaping the results from a fetcher response.
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.
returns List<Domain::Pto>
ptos_list, mapped PTO’s to be used by a Formatter::Base implementation.
27 28 29 30 31 32 33 34 35 |
# File 'lib/bas/mapper/notion/pto_today.rb', line 27 def map(notion_response) return [] if notion_response.results.empty? normalized_notion_data = normalize_response(notion_response.results) normalized_notion_data.map do |pto| Domain::Pto.new(pto["Person"], pto["Desde?"], pto["Hasta?"]) end end |