Class: TDAnalytics::CaseSensitivePost

Inherits:
Net::HTTP::Post
  • Object
show all
Defined in:
lib/thinkingdata-ruby/batch_consumer.rb

Overview

内部使用,为了兼容老版本服务端,将 Header 名称限定为小写

Instance Method Summary collapse

Instance Method Details

#[](name) ⇒ Object



103
104
105
# File 'lib/thinkingdata-ruby/batch_consumer.rb', line 103

def [](name)
  @header[name.to_s]
end

#[]=(name, val) ⇒ Object



107
108
109
110
111
112
113
# File 'lib/thinkingdata-ruby/batch_consumer.rb', line 107

def []=(name, val)
  if val
    @header[name.to_s] = [val]
  else
    @header.delete(name.to_s)
  end
end

#capitalize(name) ⇒ Object



115
116
117
# File 'lib/thinkingdata-ruby/batch_consumer.rb', line 115

def capitalize(name)
  name
end

#initialize_http_header(headers) ⇒ Object



98
99
100
101
# File 'lib/thinkingdata-ruby/batch_consumer.rb', line 98

def initialize_http_header(headers)
  @header = {}
  headers.each{|k,v| @header[k.to_s] = [v] }
end