Sha256: c7dc074efe9ea95d40d922eeaba4b23b9b08b074daa43ca5e0d24fbefff783d3
Contents?: true
Size: 1.19 KB
Versions: 2
Compression:
Stored size: 1.19 KB
Contents
module Traxis module ControllerActions def create(**params) if create_resource.errors.any? ::Traxis::Responses::ResourceError.new(:body => serialized_resource, :json_root => resource_options[:json_root], :errors => resource.errors) else ::Traxis::Responses::ResourceCreated.new(:body => serialized_resource, :json_root => resource_options[:json_root]) end end def destroy(id:) ::Traxis::Responses::ResourceDeleted.new(:body => serialized_resource, :json_root => resource_options[:json_root]) end def index(**params) ::Traxis::Responses::Collection.new(:body => serialized_collection, :json_root => collection_options[:json_root]) end def show(id:) ::Traxis::Responses::Resource.new(:body => serialized_resource, :json_root => resource_options[:json_root]) end def update(id:, **params) if update_resource.errors.any? ::Traxis::Responses::ResourceError.new(:body => serialized_resource, :json_root => resource_options[:json_root], :errors => resource.errors) else ::Traxis::Responses::Resource.new(:body => serialized_resource, :json_root => resource_options[:json_root]) end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
traxis-0.0.2 | lib/traxis/controller_actions.rb |
traxis-0.0.1 | lib/traxis/controller_actions.rb |