Class: Jumbotron::Workflows::ReadConsensusWorkflow
- Inherits:
-
CommandTower::Workflows::ApplicationWorkflow
- Object
- CommandTower::Workflows::ApplicationWorkflow
- Jumbotron::Workflows::ReadConsensusWorkflow
- Includes:
- PublicRead
- Defined in:
- app/workflows/jumbotron/workflows/read_consensus_workflow.rb
Instance Method Summary collapse
Methods included from PublicRead
#map_deserializer_failure, #map_service_failure
Instance Method Details
#call(**kwargs) ⇒ Object
10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'app/workflows/jumbotron/workflows/read_consensus_workflow.rb', line 10 def call(**kwargs) deserialized = Deserializers::Public::GameIds.call(kwargs) return map_deserializer_failure(deserialized) unless deserialized.success? loaded = Services::Public::LoadGamesByIds.call(game_ids: deserialized.input.game_ids) return map_service_failure(loaded) unless loaded.success? games = loaded.data[:games] resolved = Services::Public::ResolveCurrentLinesForGames.call(games: games) return map_service_failure(resolved) unless resolved.success? derived = Services::Public::DeriveConsensusForGames.call( current_lines: resolved.data[:current_lines] ) return map_service_failure(derived) unless derived.success? mapped = Services::Public::MapPublicConsensusLines.call( consensus_lines: derived.data[:consensus_lines], current_lines: resolved.data[:current_lines], include_constituents: false ) return map_service_failure(mapped) unless mapped.success? success(payload: { consensus_lines: mapped.data[:public_consensus_lines] }, http_status: :ok) end |