Class: TingYun::Http::CurbResponse

Inherits:
AbstractRequest show all
Defined in:
lib/ting_yun/http/curb_wrappers.rb

Constant Summary

Constants inherited from AbstractRequest

AbstractRequest::ERROR_MESSAGE

Instance Method Summary collapse

Methods inherited from AbstractRequest

#[]=, #from

Constructor Details

#initialize(curlobj) ⇒ CurbResponse

Returns a new instance of CurbResponse.



52
53
54
55
# File 'lib/ting_yun/http/curb_wrappers.rb', line 52

def initialize(curlobj)
  @headers = {}
  @curlobj = curlobj
end

Instance Method Details

#[](key) ⇒ Object



57
58
59
# File 'lib/ting_yun/http/curb_wrappers.rb', line 57

def [](key)
  @headers[ key.downcase ]
end

#append_header_data(data) ⇒ Object



65
66
67
68
69
70
# File 'lib/ting_yun/http/curb_wrappers.rb', line 65

def append_header_data( data )
  key, value = data.split( /:\s*/, 2 )
  @headers[ key.downcase ] = value
  @curlobj._ty_header_str ||= ''
  @curlobj._ty_header_str << data
end

#to_hashObject



61
62
63
# File 'lib/ting_yun/http/curb_wrappers.rb', line 61

def to_hash
  @headers.dup
end