Class: Gem::GemcutterUtilities::WebauthnListener::Response
- Inherits:
-
Object
- Object
- Gem::GemcutterUtilities::WebauthnListener::Response
- Defined in:
- lib/rubygems/gemcutter_utilities/webauthn_listener/response.rb
Direct Known Subclasses
BadRequestResponse, MethodNotAllowedResponse, NoContentResponse, NotFoundResponse, OkResponse
Instance Attribute Summary collapse
-
#http_response ⇒ Object
readonly
Returns the value of attribute http_response.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(host) ⇒ Response
constructor
A new instance of Response.
- #to_s ⇒ Object
Constructor Details
#initialize(host) ⇒ Response
Returns a new instance of Response.
35 36 37 38 39 |
# File 'lib/rubygems/gemcutter_utilities/webauthn_listener/response.rb', line 35 def initialize(host) @host = host build_http_response end |
Instance Attribute Details
#http_response ⇒ Object (readonly)
Returns the value of attribute http_response.
29 30 31 |
# File 'lib/rubygems/gemcutter_utilities/webauthn_listener/response.rb', line 29 def http_response @http_response end |
Class Method Details
.for(host) ⇒ Object
31 32 33 |
# File 'lib/rubygems/gemcutter_utilities/webauthn_listener/response.rb', line 31 def self.for(host) new(host) end |
Instance Method Details
#to_s ⇒ Object
41 42 43 44 45 46 47 |
# File 'lib/rubygems/gemcutter_utilities/webauthn_listener/response.rb', line 41 def to_s status_line = "HTTP/#{@http_response.http_version} #{@http_response.code} #{@http_response.}\r\n" headers = @http_response.to_hash.map {|header, value| "#{header}: #{value.join(", ")}\r\n" }.join + "\r\n" body = @http_response.body ? "#{@http_response.body}\n" : "" status_line + headers + body end |