Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 4 additions & 6 deletions lib/quickbooks/service/base_service.rb
Original file line number Diff line number Diff line change
Expand Up @@ -187,15 +187,13 @@ def do_http_get(url, params = {}, headers = {}) # throws IntuitRequestException
do_http(:get, url, {}, headers)
end

def do_http_file_upload(uploadIO, url, metadata = nil)
def do_http_file_upload(uploadIOs, url, metadata = {})
headers = {
'Content-Type' => 'multipart/form-data'
}
body = {}
body[:file_content_0] = uploadIO
if metadata
body[:file_metadata_0] = metadata
end
file_contents = Hash[uploadIOs.map.with_index { |v, i| ["file_content_#{i}".to_sym, v] }]
file_metadatas = Hash[metadata.map.with_index { |v, i| ["file_metadata_#{i}".to_sym, v] }]
body = file_contents.merge(file_metadatas)
do_http(:upload, url, body, headers)
end

Expand Down