Sha256: a081561babdad01791183007dc10ee5bfae1c2cbda8b1ba7285a80cd7d773a73

Contents?: true

Size: 861 Bytes

Versions: 11

Compression:

Stored size: 861 Bytes

Contents

module Dyndnsd
  module Responder
    class DynDNSStyle
      def response_for_error(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 [200, {"Content-Type" => "text/plain"}, ["notfqdn"]] if state == :hostname_missing
        return [200, {"Content-Type" => "text/plain"}, ["nohost"]] if state == :host_forbidden
        return [200, {"Content-Type" => "text/plain"}, ["notfqdn"]] if state == :hostname_malformed
      end
      
      def response_for_changes(states, ip)
        body = states.map { |state| "#{state} #{ip}" }.join("\n")
        return [200, {"Content-Type" => "text/plain"}, [body]]
      end
    end
  end
end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
dyndnsd-1.5.0 lib/dyndnsd/responder/dyndns_style.rb
dyndnsd-1.4.0 lib/dyndnsd/responder/dyndns_style.rb
dyndnsd-1.3.0 lib/dyndnsd/responder/dyndns_style.rb
dyndnsd-1.2.2 lib/dyndnsd/responder/dyndns_style.rb
dyndnsd-1.2.1 lib/dyndnsd/responder/dyndns_style.rb
dyndnsd-1.2.0 lib/dyndnsd/responder/dyndns_style.rb
dyndnsd-1.1.0 lib/dyndnsd/responder/dyndns_style.rb
dyndnsd-1.0.0 lib/dyndnsd/responder/dyndns_style.rb
dyndnsd-0.0.4 lib/dyndnsd/responder/dyndns_style.rb
dyndnsd-0.0.3 lib/dyndnsd/responder/dyndns_style.rb
dyndnsd-0.0.2 lib/dyndnsd/responder/dyndns_style.rb