# encoding: utf-8 module Okei module Api module V1 # Responds to client depending on use case results class Responder < ::ApplicationController # Renders a list of units of measure. # # Params: # +units+:: a list of units found by use case # def on_success(units) @units = units render "index" end # Renders a unit of measure. # # Params: # +unit+:: a unit of measure to be rendered and sent to a client. # def on_found(unit) @unit = unit render "show" end # Renders an error messages. # # Params: # +messages+:: a list of messages (Hexx::Message objects) # to be shown to a client. # def on_not_found(messages) @messages = messages render "errors", status: 404 end end end end end