class RestClient::Payload::Base

Public Class Methods

new(params) click to toggle source
# File lib/restclient/payload.rb, line 46
def initialize(params)
  build_stream(params)
end

Public Instance Methods

build_stream(params) click to toggle source
# File lib/restclient/payload.rb, line 50
def build_stream(params)
  @stream = StringIO.new(params)
  @stream.seek(0)
end
close() click to toggle source
# File lib/restclient/payload.rb, line 75
def close
  @stream.close unless @stream.closed?
end
headers() click to toggle source
# File lib/restclient/payload.rb, line 65
def headers
  {'Content-Length' => size.to_s}
end
length()
Alias for: size
read(*args) click to toggle source
# File lib/restclient/payload.rb, line 55
def read(*args)
  @stream.read(*args)
end
short_inspect() click to toggle source
# File lib/restclient/payload.rb, line 83
def short_inspect
  (size > 500 ? "#{size} byte(s) length" : to_s_inspect)
end
size() click to toggle source
# File lib/restclient/payload.rb, line 69
def size
  @stream.size
end
Also aliased as: length
to_s() click to toggle source
# File lib/restclient/payload.rb, line 59
def to_s
  result = read
  @stream.seek(0)
  result
end
to_s_inspect() click to toggle source
# File lib/restclient/payload.rb, line 79
def to_s_inspect
  to_s.inspect
end