Sha256: 4e4b732b1e0d8acbd8764d9d2b6604487743cc49883c4511da25643d7a960a01
Contents?: true
Size: 1007 Bytes
Versions: 8
Compression:
Stored size: 1007 Bytes
Contents
module Braintree class DocumentUploadGateway # :nodoc: def initialize(gateway) @gateway = gateway @config = gateway.config @config.assert_has_access_token_or_keys end def create(attributes) Util.verify_keys(DocumentUploadGateway._create_signature, attributes) _do_create "/document_uploads", {"document_upload[kind]" => attributes[:kind]}, attributes[:file] end def self._create_signature # :nodoc: [ :kind, :file ] end def _do_create(path, params, file) # :nodoc: response = @config.http.post("#{@config.base_merchant_path}#{path}", params, file) if response[:document_upload] SuccessfulResult.new(:document_upload => DocumentUpload._new(response[:document_upload])) elsif response[:api_error_response] ErrorResult.new(@gateway, response[:api_error_response]) else raise UnexpectedError, "expected :document_upload or :api_error_response" end end end end
Version data entries
8 entries across 8 versions & 1 rubygems