Class: Okei::Api::V1::ResponderController

Inherits:
ApplicationController
  • Object
show all
Defined in:
app/controllers/okei/api/v1/responder_controller.rb

Overview

Responds to client depending on use case results

Direct Known Subclasses

UnitsController

Instance Method Summary collapse

Instance Method Details

#on_found(unit) ⇒ Object

Renders a unit of measure.

Params:

unit

a unit of measure to be rendered and sent to a client.



25
26
27
28
# File 'app/controllers/okei/api/v1/responder_controller.rb', line 25

def on_found(unit)
  @unit = unit
  render "show"
end

#on_not_found(messages) ⇒ Object

Renders an error messages.

Params:

messages

a list of messages (Hexx::Message objects) to be shown to a client.



36
37
38
39
# File 'app/controllers/okei/api/v1/responder_controller.rb', line 36

def on_not_found(messages)
  @messages = messages
  render "errors", status: 404
end

#on_success(units) ⇒ Object

Renders a list of units of measure.

Params:

units

a list of units found by use case



15
16
17
18
# File 'app/controllers/okei/api/v1/responder_controller.rb', line 15

def on_success(units)
  @units = units
  render "index"
end