Skip to content

Commit 693ac0f

Browse files
committed
Merge pull request #40 from ddrinka/master
Resolved Issue #39
2 parents 7dfb740 + e1fda48 commit 693ac0f

File tree

2 files changed

+6
-4
lines changed

2 files changed

+6
-4
lines changed

lib/vimeo/advanced/simple_upload/chunk.rb

+4-2
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ def initialize(task, data)
1818

1919
# Performs the upload via Multipart.
2020
def upload
21-
endpoint = "#{task.endpoint}&chunk_id=#{index}"
21+
endpoint = "#{task.endpoint}"
2222

2323
response = task.oauth_consumer.request(:post, endpoint, vimeo.get_access_token, {}, {}) do |req|
2424
req.set_content_type("multipart/form-data", { "boundary" => MULTIPART_BOUNDARY })
@@ -29,6 +29,8 @@ def io.original_filename; @original_filename; end
2929
def io.content_type; "application/octet-stream"; end
3030

3131
parts = []
32+
parts << Parts::ParamPart.new(MULTIPART_BOUNDARY, "ticket_id", task.id)
33+
parts << Parts::ParamPart.new(MULTIPART_BOUNDARY, "chunk_id", index)
3234
parts << Parts::FilePart.new(MULTIPART_BOUNDARY, "file_data", io)
3335
parts << Parts::EpiloguePart.new(MULTIPART_BOUNDARY)
3436

@@ -47,4 +49,4 @@ def io.content_type; "application/octet-stream"; end
4749
end
4850
end
4951
end
50-
end
52+
end

lib/vimeo/advanced/simple_upload/task.rb

+2-2
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ def valid?
6969

7070
# Returns a hash of the sent chunks and their respective sizes.
7171
def sent_chunk_sizes
72-
Hash[chunks.map { |chunk| [chunk.id, chunk.size] }]
72+
Hash[chunks.map { |chunk| [chunk.index.to_s, chunk.size] }]
7373
end
7474

7575
# Returns a of Vimeo's received chunks and their respective sizes.
@@ -82,4 +82,4 @@ def received_chunk_sizes
8282
end
8383
end
8484
end
85-
end
85+
end

0 commit comments

Comments
 (0)