From 972fc61ad7c75f2d1c7b7fb98ff8f1d59597424a Mon Sep 17 00:00:00 2001 From: Kanezoh Date: Sat, 27 Nov 2021 00:57:02 +0900 Subject: [PATCH] add auth realm --- src/mechanize/http/auth_realm.cr | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 src/mechanize/http/auth_realm.cr diff --git a/src/mechanize/http/auth_realm.cr b/src/mechanize/http/auth_realm.cr new file mode 100644 index 0000000..138584a --- /dev/null +++ b/src/mechanize/http/auth_realm.cr @@ -0,0 +1,27 @@ +# This class represents realm attribute of www-authenticate header. +class Mechanize::HTTP::AuthRealm + getter scheme : String + getter uri : URI + getter realm : String + + def initialize(scheme, uri, realm) + @scheme = scheme + @uri = uri + @realm = realm if realm + end + + def ==(other) + self.class === other and + @scheme == other.scheme and + @uri == other.uri and + @realm == other.realm + end + + def hash # :nodoc: + [@scheme, @uri, @realm].hash + end + + def inspect # :nodoc: + "#" % [@scheme, @uri, @realm] + end +end