class Rackful::StatusCodes::HTTP201Created

Public Class Methods

new(locations) click to toggle source

@param locations [URI::Generic, String, Array<URI::Generic, String>]

Calls superclass method Rackful::StatusCodes::HTTPStatus::new
# File lib/rackful/httpstatus.rb, line 112
def initialize locations
  locations = [ locations ] unless locations.kind_of? Array
  locations = locations.collect do |location|
    location.kind_of?( URI::Generic ) ? location : URI(location).normalize
  end
  if locations.size > 1
    super( 201, 'New resources were created:', :locations => locations )
  else
    location = locations[0]
    super(
      201, 'A new resource was created:',
      :"Location" => location, 'Location' => location
    )
  end
end