Class: TingYun::Http::CurbRequest
- Inherits:
-
Object
- Object
- TingYun::Http::CurbRequest
- Defined in:
- lib/ting_yun/http/curb_wrappers.rb
Constant Summary collapse
- CURB =
'Curb'.freeze
- LHOST =
'host'.freeze
- UHOST =
'Host'.freeze
Instance Method Summary collapse
- #[](key) ⇒ Object
- #[]=(key, value) ⇒ Object
- #from ⇒ Object
- #host ⇒ Object
- #host_from_header ⇒ Object
-
#initialize(curlobj) ⇒ CurbRequest
constructor
A new instance of CurbRequest.
- #method ⇒ Object
- #type ⇒ Object
- #uri ⇒ Object
Constructor Details
#initialize(curlobj) ⇒ CurbRequest
Returns a new instance of CurbRequest.
13 14 15 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 13 def initialize( curlobj ) @curlobj = curlobj end |
Instance Method Details
#[](key) ⇒ Object
37 38 39 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 37 def []( key ) @curlobj.headers[ key ] end |
#[]=(key, value) ⇒ Object
41 42 43 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 41 def []=( key, value ) @curlobj.headers[ key ] = value end |
#from ⇒ Object
21 22 23 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 21 def from "curb%2Fhttp" end |
#host ⇒ Object
29 30 31 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 29 def host host_from_header || self.uri.host end |
#host_from_header ⇒ Object
25 26 27 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 25 def host_from_header self[LHOST] || self[UHOST] end |
#method ⇒ Object
33 34 35 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 33 def method @curlobj._ty_http_verb end |
#type ⇒ Object
17 18 19 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 17 def type CURB end |
#uri ⇒ Object
45 46 47 |
# File 'lib/ting_yun/http/curb_wrappers.rb', line 45 def uri @uri ||= TingYun::Agent::HTTPClients::URIUtil.parse_and_normalize_url(@curlobj.url) end |