Skip to content

Instantly share code, notes, and snippets.

@bilby91
Created March 12, 2018 23:21
Show Gist options
  • Save bilby91/90ed146497d8a63edf69f1699004e6ec to your computer and use it in GitHub Desktop.
Save bilby91/90ed146497d8a63edf69f1699004e6ec to your computer and use it in GitHub Desktop.
module Api::Controllers::Lists
class Create
include Api::Action
include JSONAPI::Hanami::Action
deserializable_resource :list
params do
required(:list).schema do
required(:name)
end
end
def call(params)
self.data = list_repository.create(params[:list])
self.status = 200
end
def list_repository
@list_repository ||= ListRepository.new
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment