Sha256: 0385cca5c9d4549f2a58d97af0e47619de90f69fef191564df32b72bbaa1374f
Contents?: true
Size: 981 Bytes
Versions: 1
Compression:
Stored size: 981 Bytes
Contents
# frozen_string_literal: true module DropboxApi::Endpoints class ContentUpload < 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) headers = { 'Dropbox-API-Arg' => JSON.dump(params), 'Content-Type' => 'application/octet-stream' } content_length = get_content_length body headers['Content-Length'] = content_length unless content_length.nil? return body, headers end def perform_request(params, content) process_response(get_response(params, content)) end private def get_content_length(content) if content.respond_to?(:bytesize) content.bytesize.to_s elsif content.respond_to?(:length) content.length.to_s elsif content.respond_to?(:stat) content.stat.size.to_s end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
dropbox_api-0.1.19 | lib/dropbox_api/endpoints/content_upload.rb |