Class: PaypalServerSdk::FileWrapper

Inherits:
CoreLibrary::FileWrapper
  • Object
show all
Defined in:
lib/paypal_server_sdk/utilities/file_wrapper.rb

Overview

A utility to allow users to set the content-type for files

Instance Method Summary collapse

Constructor Details

#initialize(file, content_type: 'application/octet-stream') ⇒ FileWrapper

The constructor.

Parameters:

  • file (File)

    The file to be sent in the request.

  • content_type (string) (defaults to: 'application/octet-stream')

    The content type of the provided file.



12
13
14
# File 'lib/paypal_server_sdk/utilities/file_wrapper.rb', line 12

def initialize(file, content_type: 'application/octet-stream')
  super
end

Instance Method Details

#to_inspectObject

Provides a debugging-friendly string with detailed object information.



23
24
25
26
# File 'lib/paypal_server_sdk/utilities/file_wrapper.rb', line 23

def to_inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} file: #{@file.inspect}, content_type: #{@content_type.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



17
18
19
20
# File 'lib/paypal_server_sdk/utilities/file_wrapper.rb', line 17

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} file: #{@file}, content_type: #{@content_type}>"
end