Class: Doze::Resource::Error

Inherits:
Object
  • Object
show all
Includes:
Doze::Resource, Serialization::Resource
Defined in:
lib/doze/resource/error.rb

Instance Attribute Summary

Attributes included from Doze::Resource

#uri

Instance Method Summary collapse

Methods included from Serialization::Resource

#accepts_method_with_media_type?, #get, #serialization_media_types

Methods included from Doze::Resource

#accepts_method_with_media_type?, #authorize, #cache_expiry_period, #cacheable?, #delete_resource, #exists?, #get, #last_modified, #other_method, #post, #public_cache_expiry_period, #publicly_cacheable?, #put, #supports_get?, #supports_method?, #try, #uri_object

Constructor Details

#initialize(status = Doze::Utils::STATUS_INTERNAL_SERVER_ERROR, message = Rack::Utils::HTTP_STATUS_CODES[status], extras = {}) ⇒ Error

Returns a new instance of Error.



12
13
14
15
16
# File 'lib/doze/resource/error.rb', line 12

def initialize(status=Doze::Utils::STATUS_INTERNAL_SERVER_ERROR, message=Rack::Utils::HTTP_STATUS_CODES[status], extras={})
  @status = status
  @message = message
  @extra_properties = extras
end

Instance Method Details

#get_dataObject



18
19
20
# File 'lib/doze/resource/error.rb', line 18

def get_data
  @extra_properties.merge(:status => @status, :message => @message)
end