Class: DropboxApi::Endpoints::ContentDownload

Inherits:
Base
  • Object
show all
Defined in:
lib/dropbox_api/endpoints/content_download.rb

Instance Method Summary collapse

Methods inherited from Base

add_endpoint, #initialize

Constructor Details

This class inherits a constructor from DropboxApi::Endpoints::Base

Instance Method Details

#build_connectionObject



4
5
6
7
8
# File 'lib/dropbox_api/endpoints/content_download.rb', line 4

def build_connection
  @connection = @builder.build('https://content.dropboxapi.com') do |c|
    c.response :decode_result
  end
end

#build_request(params) ⇒ Object



10
11
12
13
14
15
16
17
18
# File 'lib/dropbox_api/endpoints/content_download.rb', line 10

def build_request(params)
  body = nil
  headers = {
    'Dropbox-API-Arg' => JSON.dump(params),
    'Content-Type' => ''
  }

  return body, headers
end

#perform_request(params) {|response.body| ... } ⇒ Object

Yields:

  • (response.body)


20
21
22
23
24
25
26
27
28
29
# File 'lib/dropbox_api/endpoints/content_download.rb', line 20

def perform_request(params)
  response = get_response(params)
  api_result = process_response response

  # We just yield the whole response to the block, it'd be nice in the
  # future to support an interface that streams the response in chunks.
  yield response.body if block_given?

  api_result
end