lib/acf/right_acf_interface.rb
# Generates request hash for REST API.
Generates request hash for REST API.
Generates request hash for REST API .
def generate_request(method, path, params={}, body=nil, headers={})  
      params.delete_if{ |key, val| val.right_blank? }
      unless params.right_blank?
        path += "?" + params.to_a.collect{ |key,val| "#{AwsUtils::amz_escape(key)}=#{AwsUtils::amz_escape(val.to_s)}" }.join("&")
      end
      headers = AwsUtils::fix_headers(headers)
      headers['content-type'] ||= 'text/xml' if body
      headers['date'] = Time.now.httpdate
      signature = AwsUtils::sign(@aws_secret_access_key, headers['date'])
      headers['Authorization'] = "AWS #{@aws_access_key_id}:#{signature}"
      path    = "#{@params[:service]}#{@params[:api_version]}/#{path}"
      request = "Net::HTTP::#{method.capitalize}".right_constantize.new(path)
      request.body = body if body
      headers.each { |key, value| request[key.to_s] = value }
      { :request  => request, 
        :server   => @params[:server],
        :port     => @params[:port],
        :protocol => @params[:protocol] }
      end
def generate_request ( method , path , params = { } , body = nil , headers = { } ) params . delete_if { | key , val | val . right_blank? } unless params . right_blank? path += "?" + params . to_a . collect { | key , val | "#{AwsUtils::amz_escape(key)}=#{AwsUtils::amz_escape(val.to_s)}" } . join ( "&" ) end headers = AwsUtils :: fix_headers ( headers ) headers [ 'content-type' ] ||= 'text/xml' if body headers [ 'date' ] = Time . now . httpdate signature = AwsUtils :: sign ( @aws_secret_access_key , headers [ 'date' ] ) headers [ 'Authorization' ] = "AWS #{@aws_access_key_id}:#{signature}" path = "#{@params[:service]}#{@params[:api_version]}/#{path}" request = "Net::HTTP::#{method.capitalize}" . right_constantize . new ( path ) request . body = body if body headers . each { | key , value | request [ key . to_s ] = value } { :request => request , :server => @params [ :server ] , :port => @params [ :port ] , :protocol => @params [ :protocol ] } end
Generates request hash for REST API.
Generates request hash for REST API .
# :nodoc: # Params # Headers # Auth # Request # Set request headers # prepare output hash
method
<not_specific>
path
<not_specific>
params
<not_specific>
body
<not_specific>
headers
<not_specific>