class RestClient::Payload::Base
Public Class Methods
new(params)
click to toggle source
# File lib/restclient/payload.rb, line 60 def initialize(params) build_stream(params) end
Public Instance Methods
build_stream(params)
click to toggle source
# File lib/restclient/payload.rb, line 64 def build_stream(params) @stream = StringIO.new(params) @stream.seek(0) end
close()
click to toggle source
# File lib/restclient/payload.rb, line 89 def close @stream.close unless @stream.closed? end
closed?()
click to toggle source
# File lib/restclient/payload.rb, line 93 def closed? @stream.closed? end
headers()
click to toggle source
# File lib/restclient/payload.rb, line 79 def headers {'Content-Length' => size.to_s} end
read(*args)
click to toggle source
# File lib/restclient/payload.rb, line 69 def read(*args) @stream.read(*args) end
short_inspect()
click to toggle source
# File lib/restclient/payload.rb, line 101 def short_inspect if size && size > 500 "#{size} byte(s) length" else to_s_inspect end end
size()
click to toggle source
# File lib/restclient/payload.rb, line 83 def size @stream.size end
Also aliased as: length
to_s()
click to toggle source
# File lib/restclient/payload.rb, line 73 def to_s result = read @stream.seek(0) result end
to_s_inspect()
click to toggle source
# File lib/restclient/payload.rb, line 97 def to_s_inspect to_s.inspect end