Class Wrest::Curl::PostMultipart

  1. lib/wrest/curl/post_multipart.rb

Methods

public class

  1. new

Public class methods

new (wrest_uri, parameters = {}, headers = {}, options = {})
[show source]
    # File lib/wrest/curl/post_multipart.rb, line 12
12:     def initialize(wrest_uri, parameters = {}, headers = {}, options = {})
13:       parameters = parameters.symbolize_keys
14: 
15:       data = parameters[:data] ? {:data => parameters[:data]} : {:data => " "}
16:       file = parameters[:file].is_a?(File) ? {:file => parameters[:file].path} : {:file => parameters[:file]}
17: 
18:       options = options.merge({:data => data, :file => file, :multipart => true})
19:       parameters.delete(:data)
20:       parameters.delete(:file)
21:       super(
22:         wrest_uri,
23:         :post,
24:         parameters,
25:         options[:data],
26:         headers,
27:         options
28:       )
29:     end