Class: TingYun::Http::HttpClientRequest
Constant Summary
AbstractRequest::ERROR_MESSAGE
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
#initialize(proxy, *args, &block) ⇒ HttpClientRequest
Returns a new instance of HttpClientRequest.
7
8
9
10
11
|
# File 'lib/ting_yun/http/http_client_request.rb', line 7
def initialize(proxy, *args, &block)
@method, @uri, @query, @body, @header = args
@proxy = proxy
@block = block
end
|
Instance Attribute Details
Returns the value of attribute header.
5
6
7
|
# File 'lib/ting_yun/http/http_client_request.rb', line 5
def
@header
end
|
#method ⇒ Object
Returns the value of attribute method.
5
6
7
|
# File 'lib/ting_yun/http/http_client_request.rb', line 5
def method
@method
end
|
Instance Method Details
#[](key) ⇒ Object
28
29
30
|
# File 'lib/ting_yun/http/http_client_request.rb', line 28
def [](key)
@header[key]
end
|
#[]=(key, value) ⇒ Object
32
33
34
|
# File 'lib/ting_yun/http/http_client_request.rb', line 32
def []=(key, value)
@header[key] = value
end
|
#args ⇒ Object
45
46
47
|
# File 'lib/ting_yun/http/http_client_request.rb', line 45
def args
return @method, @uri, @query, @body, @header
end
|
#from ⇒ Object
17
18
19
|
# File 'lib/ting_yun/http/http_client_request.rb', line 17
def from
"HttpClient"
end
|
#host ⇒ Object
21
22
23
|
# File 'lib/ting_yun/http/http_client_request.rb', line 21
def host
@uri.host || @proxy.host
end
|
#path ⇒ Object
41
42
43
|
# File 'lib/ting_yun/http/http_client_request.rb', line 41
def path
@uri
end
|
#port ⇒ Object
24
25
26
|
# File 'lib/ting_yun/http/http_client_request.rb', line 24
def port
@uri.port || @uri.port
end
|
#type ⇒ Object
13
14
15
|
# File 'lib/ting_yun/http/http_client_request.rb', line 13
def type
@uri.scheme
end
|
#uri ⇒ Object
36
37
38
39
|
# File 'lib/ting_yun/http/http_client_request.rb', line 36
def uri
return @uri if @uri.scheme && @uri.host && @uri.port
URI("#{@proxy.scheme.downcase}://#{@proxy.host}:#{@proxy.port}#{@uri}")
end
|