Class: Bkblz::V1::DownloadFileByNameRequest

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(bucket, file_name, byte_range = nil) ⇒ DownloadFileByNameRequest

Returns a new instance of DownloadFileByNameRequest.



49
50
51
52
53
# File 'lib/bkblz/v1/download_file.rb', line 49

def initialize(bucket, file_name, byte_range=nil)
  @bucket = bucket
  @file_name = file_name
  @byte_range = byte_range
end

Instance Method Details

#build_request(session) ⇒ Object



55
56
57
58
59
# File 'lib/bkblz/v1/download_file.rb', line 55

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