Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

mini_api

Package Overview
Dependencies
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mini_api - npm Package Compare versions

Comparing version
0.1.1
to
0.1.2
+19
-3
lib/mini_api/model_responder.rb

@@ -26,5 +26,9 @@ # frozen_string_literal: true

else
{ data: serialiable_body(@resource) }.merge(body)
{ data: serialiable_body(@resource).as_json }.merge(body)
end
# This is for an problem with ActiveModelSerializer that adds an error
# attribute when resource is an ActiveModel instance
body[:data] = body[:data].except('errors') if body[:data]&.key?('errors')
@controller.render json: body, status: status_code

@@ -44,5 +48,5 @@ end

return :created if @resource.previously_new_record?
return :created if previously_new_record?
return :no_content unless @resource.persisted?
return :no_content if destroyed?

@@ -62,3 +66,15 @@ :ok

end
def previously_new_record?
return true if @resource.is_a?(ActiveRecord::Base) && @resource.previously_new_record?
false
end
def destroyed?
return true if @resource.is_a?(ActiveRecord::Base) && !@resource.persisted?
false
end
end
end
+1
-1
# frozen_string_literal: true
module MiniApi
VERSION = '0.1.1'
VERSION = '0.1.2'
end

@@ -6,3 +6,3 @@ ![](https://github.com/leoncruz/api-responder/actions/workflows/tests.yml/badge.svg)

# Mini Api
A gem to standardize json responses in Rails applications, highly inspired on [Responders](https:github.com/heartcombo/responders)
A gem to standardize json responses in Rails applications, highly inspired on [Responders](https://github.com/heartcombo/responders)

@@ -9,0 +9,0 @@ ## Table of Contents