Class: Bkblz::V1::DownloadFileResponse

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

Constant Summary

Constants inherited from Response

Response::MissingResponseError

Instance Attribute Summary

Attributes inherited from Response

#http_response, #parsed_body

Instance Method Summary collapse

Methods inherited from Response

#[], #initialize, response_accessor, response_accessors, response_model, #to_model

Constructor Details

This class inherits a constructor from Bkblz::V1::Response

Instance Method Details

#parse(http_response) ⇒ Object



7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
# File 'lib/bkblz/v1/download_file.rb', line 7

def parse(http_response)
  file_download_fields = {
   :body => http_response.body,
   :content_length => http_response["content-length"],
   :content_type => http_response["content-type"],
   :file_id => http_response["x-bz-file-id"],
   :file_name => http_response["x-bz-file-name"],
   :sha1 => http_response["x-bz-content-sha1"],
   :x_bz_info => {}
  }

  http_response.each_header do |k, v|
    if k.to_s.downcase.match /^x-bz-info/
      file_download_fields[:x_bz_info][k.to_sym] = v
    end
  end

  file_download_fields
end