Class: NOMS::Command::UserAgent::Response::HTTPClient
Instance Attribute Summary
#auth_hash, #cache_control, #date, #etag, #expires, #from_cache, #last_modified, #original_date
Attributes inherited from Base
#logger
Instance Method Summary
collapse
#age, #cacheable?, #cacheable_copy, #cached!, #content_encoding, #current?, from_cache, #from_cache?, from_json, #get_expires, #get_header_time, #header_params, #to_cache, #to_hash, #to_json
Methods inherited from Base
#default_logger
Constructor Details
#initialize(httpresponse, opts = {}) ⇒ HTTPClient
Returns a new instance of HTTPClient.
25
26
27
28
29
|
# File 'lib/noms/command/useragent/response/httpclient.rb', line 25
def initialize(httpresponse, opts={})
super
@log = opts[:logger] || default_logger
@response = httpresponse
end
|
Instance Method Details
#body ⇒ Object
31
32
33
|
# File 'lib/noms/command/useragent/response/httpclient.rb', line 31
def body
@response.content
end
|
#content_type ⇒ Object
55
56
57
|
# File 'lib/noms/command/useragent/response/httpclient.rb', line 55
def content_type
@response.contenttype
end
|
39
40
41
42
43
44
45
|
# File 'lib/noms/command/useragent/response/httpclient.rb', line 39
def (hdr=nil)
if hdr.nil?
@response.
else
@response.[hdr.downcase].first
end
end
|
#status ⇒ Object
47
48
49
|
# File 'lib/noms/command/useragent/response/httpclient.rb', line 47
def status
@response.status.to_i unless @response.status.nil?
end
|
#statusText ⇒ Object
51
52
53
|
# File 'lib/noms/command/useragent/response/httpclient.rb', line 51
def statusText
@response.status.to_s + ' ' + @response.reason unless @response.status.nil?
end
|
#success? ⇒ Boolean
35
36
37
|
# File 'lib/noms/command/useragent/response/httpclient.rb', line 35
def success?
@response.ok?
end
|