Class: Rubino::API::Operations::Sessions::ShowOperation

Inherits:
Object
  • Object
show all
Defined in:
lib/rubino/api/operations/sessions/show_operation.rb

Overview

GET /v1/sessions/:id Returns the session with its message timeline inlined.

Raises:

Instance Method Summary collapse

Constructor Details

#initialize(repository: nil, message_store: nil) ⇒ ShowOperation

Accepts an alternate repository and message store for tests.



15
16
17
18
# File 'lib/rubino/api/operations/sessions/show_operation.rb', line 15

def initialize(repository: nil, message_store: nil)
  @repository = repository || ::Rubino::Session::Repository.new
  @message_store = message_store || ::Rubino::Session::Store.new
end

Instance Method Details

#call(request) ⇒ Object

Raises:



20
21
22
23
24
25
26
# File 'lib/rubino/api/operations/sessions/show_operation.rb', line 20

def call(request)
  id = request.params.fetch("id")
  session = @repository.find(id)
  raise NotFoundError.new("session", id) unless session

  [200, serialize(session)]
end