mirror of
https://github.com/cmur2/dyndnsd.git
synced 2025-07-21 11:11:17 +02:00
Fiat lux
This commit is contained in:
19
lib/dyndnsd/responder/rest_style.rb
Normal file
19
lib/dyndnsd/responder/rest_style.rb
Normal file
@ -0,0 +1,19 @@
|
||||
|
||||
module Dyndnsd
|
||||
module Responder
|
||||
class RestStyle
|
||||
def response_for(state)
|
||||
# general http errors
|
||||
return [405, {"Content-Type" => "text/plain"}, ["Method Not Allowed"]] if state == :method_forbidden
|
||||
return [404, {"Content-Type" => "text/plain"}, ["Not Found"]] if state == :not_found
|
||||
# specific errors
|
||||
return [422, {"Content-Type" => "text/plain"}, ["Hostname missing"]] if state == :hostname_missing
|
||||
return [403, {"Content-Type" => "text/plain"}, ["Forbidden"]] if state == :host_forbidden
|
||||
return [422, {"Content-Type" => "text/plain"}, ["Hostname malformed"]] if state == :hostname_malformed
|
||||
# OKs
|
||||
return [200, {"Content-Type" => "text/plain"}, ["Good"]] if state == :good
|
||||
return [200, {"Content-Type" => "text/plain"}, ["No change"]] if state == :nochg
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
Reference in New Issue
Block a user