Parent

Methods

EventMachine::Twitter::Request

Attributes

options[R]
proxy[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/em-twitter/request.rb, line 10
def initialize(options = {})
  @options = options
  @proxy = Proxy.new(@options.delete(:proxy)) if @options[:proxy]
end

Public Instance Methods

proxy?() click to toggle source
# File lib/em-twitter/request.rb, line 48
def proxy?
  @proxy
end
to_s() click to toggle source
# File lib/em-twitter/request.rb, line 15
def to_s
  content = query

  data = []
  data << "#{request_method} #{request_uri} HTTP/1.1"
  data << "Host: #{@options[:host]}"

  if gzip?
    data << 'Connection: Keep-Alive'
    data << 'Accept-Encoding: deflate, gzip'
  else
    data << 'Accept: */*'
  end

  data << "User-Agent: #{@options[:user_agent]}" if @options[:user_agent]
  if put_or_post?
    data << "Content-Type: #{@options[:content_type]}"
    data << "Content-Length: #{content.bytesize}"
  end
  data << "Authorization: #{oauth_header}" if oauth?
  data << "Authorization: #{basic_auth_header}" if basic_auth?
  data << "Proxy-Authorization: Basic #{proxy.header}" if proxy?

  @options[:headers].each do |name, value|
    data << "#{name}: #{value}"
  end

  data << "\r\n"
  data = data.join("\r\n")
  data << content if post? || put?
  data
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.