Sha256: 3a93f65bb3f93c964521d403e4608beed62d468505da7a903c77cb4cf4c638b3

Contents?: true

Size: 864 Bytes

Versions: 18

Compression:

Stored size: 864 Bytes

Contents

module DropboxApi::Endpoints
  class ContentDownload < DropboxApi::Endpoints::Base
    def initialize(builder)
      @connection = builder.build("https://content.dropboxapi.com") do |c|
        c.response :decode_result
      end
    end

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

      return body, headers
    end

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

      # TODO: Stream response, current implementation will fail with very large
      #       files.
      yield response.body if block_given?

      api_result
    end
  end
end
# TODO:
#  1. Combine ContentDownload and ContentUpload to share its initialize method.
#  2. Reorganize the methods which create the request.

Version data entries

18 entries across 18 versions & 1 rubygems

Version Path
dropbox_api-0.1.18 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.17 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.16 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.15 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.14 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.13 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.12 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.11 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.10 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.9 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.8 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.7 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.6 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.5 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.4 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.3 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.1 lib/dropbox_api/endpoints/content_download.rb
dropbox_api-0.1.0 lib/dropbox_api/endpoints/content_download.rb