Sha256: fb541c71cbbffbe4211336466a062774fccb457e5928ba9c3aad97ff43ca7934
Contents?: true
Size: 1.42 KB
Versions: 1
Compression:
Stored size: 1.42 KB
Contents
module Traxis module Responses class Base < ::Praxis::Response end class Unauthorized < ::Traxis::Responses::Base include ::Traxis::Response::JSON include ::Traxis::Response::Meta include ::Traxis::Response::Errors self.status = 401 def response_body @response_body = super @response_body[:meta][:errors] << "You are not authorized to do that!" @response_body end def format! @body = response_body @body end end class Resource < ::Traxis::Responses::Base include ::Traxis::Response::JSON self.response_name = :resource self.status = 200 end class ResourceCreated < ::Traxis::Responses::Resource self.response_name = :resource_created self.status = 201 end class ResourceDeleted < ::Traxis::Responses::Resource self.response_name = :resource_deleted self.status = 204 end class ResourceError < ::Traxis::Responses::Resource self.response_name = :resource_error self.status = 422 def initialize(errors:[], **args) @errors = errors super(**args) end def response_body super[:errors] = @errors end end class Collection < ::Traxis::Responses::Base include ::Traxis::Response::JSON include ::Traxis::Response::Meta self.response_name = :collection self.status = 200 end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
traxis-0.0.1 | lib/traxis/responses.rb |