Class: Bkblz::V1::DownloadFileByIdRequest

Inherits:
Request
  • Object
show all
Defined in:
lib/bkblz/v1/download_file.rb

Instance Method Summary collapse

Methods inherited from Request

response_class, #send, url_suffix

Constructor Details

#initialize(file_info, byte_range = nil) ⇒ DownloadFileByIdRequest

Returns a new instance of DownloadFileByIdRequest.



33
34
35
36
# File 'lib/bkblz/v1/download_file.rb', line 33

def initialize(file_info, byte_range=nil)
  @body = {:file_id => file_info.file_id}
  @byte_range = byte_range
end

Instance Method Details

#build_request(session) ⇒ Object



38
39
40
41
42
# File 'lib/bkblz/v1/download_file.rb', line 38

def build_request(session)
  headers = {}
  headers[:Range] = "bytes=%d-%d" % @byte_range.minmax if @byte_range
  session.create_post url(session), @body, headers
end