Method: AliyunSDK::OSS::Callback#serialize

Defined in:
lib/aliyun_sdk/oss/struct.rb

#serializeObject



169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
# File 'lib/aliyun_sdk/oss/struct.rb', line 169

def serialize
  query_string = (query || {}).map { |k, v|
    [CGI.escape(k.to_s), CGI.escape(v.to_s)].join('=') }.join('&')

  cb = {
    'callbackUrl' => "#{normalize_url(url)}?#{query_string}",
    'callbackBody' => body,
    'callbackBodyType' => content_type || default_content_type
  }
  cb['callbackHost'] = host if host

  logger.debug("Callback json: #{cb}")

  Base64.strict_encode64(cb.to_json)
end