Class: AliyunSDK::OSS::HTTP::StreamPayload

Inherits:
Object
  • Object
show all
Defined in:
lib/aliyun_sdk/oss/http.rb

Overview

RestClient requires the payload to respones to :read(bytes) and return a stream. We are not doing the real read here, just return a readable stream for RestClient playload.rb treats it as:

def read(bytes=nil)
  @stream.read(bytes)
end
alias :to_s :read
net_http_do_request(http, req, payload ? payload.to_s : nil,
                &@block_response)

Instance Method Summary collapse

Constructor Details

#initialize(&block) ⇒ StreamPayload

Returns a new instance of StreamPayload.



118
119
120
# File 'lib/aliyun_sdk/oss/http.rb', line 118

def initialize(&block)
  @stream = StreamWriter.new(&block)
end

Instance Method Details

#closeObject



126
127
# File 'lib/aliyun_sdk/oss/http.rb', line 126

def close
end

#closed?Boolean

Returns:

  • (Boolean)


129
130
131
# File 'lib/aliyun_sdk/oss/http.rb', line 129

def closed?
  false
end

#read(bytes = nil) ⇒ Object



122
123
124
# File 'lib/aliyun_sdk/oss/http.rb', line 122

def read(bytes = nil)
  @stream
end