Sha256: e049c4ac16ff4b627bdaca4a20b3a8f472c2a620e4770d26820da6080b4bed44
Contents?: true
Size: 1.05 KB
Versions: 6
Compression:
Stored size: 1.05 KB
Contents
# frozen_string_literal: true require 'api_struct' require 'param/user_agent' require 'uploadcare/concern/error_handler' require 'uploadcare/concern/throttle_handler' module Uploadcare module Client # @abstract # # Headers and helper methods for clients working with upload API # @see https://uploadcare.com/docs/api_reference/upload/ class UploadClient < ApiStruct::Client include Concerns::ErrorHandler include Concerns::ThrottleHandler include Exception def api_root Uploadcare.config.upload_api_root end def headers { 'User-Agent': Uploadcare::Param::UserAgent.call } end private def form_data_for(file) filename = file.original_filename if file.respond_to?(:original_filename) mime_type = file.content_type if file.respond_to?(:content_type) options = { filename: filename, content_type: mime_type }.compact HTTP::FormData::File.new(file, options) end def default_params {} end end end end
Version data entries
6 entries across 6 versions & 1 rubygems