Class: InternetHakai::ResponseObject
- Inherits:
-
Object
- Object
- InternetHakai::ResponseObject
- Defined in:
- lib/internethakai/response.rb
Overview
http response
Instance Attribute Summary collapse
-
#body ⇒ Object
Returns the value of attribute body.
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#cookie ⇒ Object
Returns the value of attribute cookie.
-
#header ⇒ Object
Returns the value of attribute header.
-
#location ⇒ Object
Returns the value of attribute location.
-
#status ⇒ Object
Returns the value of attribute status.
-
#time ⇒ Object
Returns the value of attribute time.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ ResponseObject
constructor
A new instance of ResponseObject.
Constructor Details
#initialize ⇒ ResponseObject
Returns a new instance of ResponseObject.
13 14 15 16 17 18 19 20 21 |
# File 'lib/internethakai/response.rb', line 13 def initialize @header = nil @status = 0 @time = 0 @content_type = '' @location = nil @body = '' @cookie = nil end |
Instance Attribute Details
#body ⇒ Object
Returns the value of attribute body.
22 23 24 |
# File 'lib/internethakai/response.rb', line 22 def body @body end |
#content_type ⇒ Object
Returns the value of attribute content_type.
22 23 24 |
# File 'lib/internethakai/response.rb', line 22 def content_type @content_type end |
#cookie ⇒ Object
Returns the value of attribute cookie.
22 23 24 |
# File 'lib/internethakai/response.rb', line 22 def @cookie end |
#header ⇒ Object
Returns the value of attribute header.
22 23 24 |
# File 'lib/internethakai/response.rb', line 22 def header @header end |
#location ⇒ Object
Returns the value of attribute location.
22 23 24 |
# File 'lib/internethakai/response.rb', line 22 def location @location end |
#status ⇒ Object
Returns the value of attribute status.
22 23 24 |
# File 'lib/internethakai/response.rb', line 22 def status @status end |
#time ⇒ Object
Returns the value of attribute time.
22 23 24 |
# File 'lib/internethakai/response.rb', line 22 def time @time end |
Class Method Details
.create_from_nethttp(obj) ⇒ Object
4 5 6 7 8 9 10 11 12 |
# File 'lib/internethakai/response.rb', line 4 def self::create_from_nethttp obj r = self::new r.body = obj.body.to_s r.status = obj.code.to_i r.content_type = obj['content-type'] r.location = obj['location'] if obj['location'] r. = obj['set-cookie'] return r end |