lib/eventful/api.rb
# Prepares the body of the POST request
Prepares the body of the POST request
Prepares the body of the POST request
def prepare_post(params) 
      content = ""
      params.each do |key, value|
        content += BOUNDARY_MARKER + "\r\n"
        if key.to_s =~ /_file$/
          content += "Content-Disposition: file; name=\"#{CGI::escape(key.to_s)}\"; filename=\"#{value}\"\r\b"
          content += "Content-Type: #{MIME::Types.type_for(value.to_s)}\r\n"
          content += "Content-Transfer-Encoding: binary\r\n\r\n"
          content += open(value) { |f| f.read } + "\r\n"
        else
          content += "Content-Disposition: form-data; name=\"#{CGI::escape(key.to_s)}\";\r\n\r\n#{value}\r\n"
        end
      end
      content += BOUNDARY_END_MARKER
      return content
    end
def prepare_post ( params ) content = "" params . each do | key , value | content += BOUNDARY_MARKER + "\r\n" if key . to_s =~ / _file$ / content += "Content-Disposition: file; name=\"#{CGI::escape(key.to_s)}\"; filename=\"#{value}\"\r\b" content += "Content-Type: #{MIME::Types.type_for(value.to_s)}\r\n" content += "Content-Transfer-Encoding: binary\r\n\r\n" content += open ( value ) { | f | f . read } + "\r\n" else content += "Content-Disposition: form-data; name=\"#{CGI::escape(key.to_s)}\";\r\n\r\n#{value}\r\n" end end content += BOUNDARY_END_MARKER return content end
Prepares the body of the POST request
Prepares the body of the POST request
#:nodoc:
params