Class: TingYun::Http::ExconHTTPRequest
Constant Summary
collapse
- EXCON =
"Excon".freeze
- LHOST =
'host'.freeze
- UHOST =
'Host'.freeze
- COLON =
':'.freeze
AbstractRequest::ERROR_MESSAGE
Instance Attribute Summary collapse
Instance Method Summary
collapse
Constructor Details
Returns a new instance of ExconHTTPRequest.
38
39
40
41
42
43
44
45
|
# File 'lib/ting_yun/http/excon_wrappers.rb', line 38
def initialize(datum)
@datum = datum
@method = @datum[:method].to_s.upcase
@scheme = @datum[:scheme]
@port = @datum[:port]
@path = @datum[:path]
end
|
Instance Attribute Details
#method ⇒ Object
Returns the value of attribute method.
31
32
33
|
# File 'lib/ting_yun/http/excon_wrappers.rb', line 31
def method
@method
end
|
Instance Method Details
#[](key) ⇒ Object
66
67
68
|
# File 'lib/ting_yun/http/excon_wrappers.rb', line 66
def [](key)
@datum[:headers][key]
end
|
#[]=(key, value) ⇒ Object
70
71
72
73
|
# File 'lib/ting_yun/http/excon_wrappers.rb', line 70
def []=(key, value)
@datum[:headers] ||= {}
@datum[:headers][key] = value
end
|
#from ⇒ Object
51
52
53
|
# File 'lib/ting_yun/http/excon_wrappers.rb', line 51
def from
"excon%2Fhttp"
end
|
#host ⇒ Object
62
63
64
|
# File 'lib/ting_yun/http/excon_wrappers.rb', line 62
def host
|| @datum[:host]
end
|
55
56
57
58
59
60
|
# File 'lib/ting_yun/http/excon_wrappers.rb', line 55
def
= @datum[:headers]
if hostname = ([LHOST] || [UHOST])
hostname.split(COLON).first
end
end
|
#type ⇒ Object
47
48
49
|
# File 'lib/ting_yun/http/excon_wrappers.rb', line 47
def type
EXCON
end
|
#uri ⇒ Object
75
76
77
|
# File 'lib/ting_yun/http/excon_wrappers.rb', line 75
def uri
URI.parse("#{@scheme}://#{host}:#{@port}#{@path}")
end
|