class Translatomatic::HTTP::FileParam

Formats the contents of a file or string for a multipart post

Attributes

content[RW]
filename[RW]
mime_type[RW]

Public Class Methods

new(key:, filename:, content:, mime_type:) click to toggle source
# File lib/translatomatic/http/file_param.rb, line 7
def initialize(key:, filename:, content:, mime_type:)
  @key = key
  @filename = filename
  @content = content
  @mime_type = mime_type
end

Public Instance Methods

to_s() click to toggle source

(see Param#to_s)

# File lib/translatomatic/http/file_param.rb, line 15
def to_s
  header(header_data) +
    header('Content-Type' => mime_type) + "\r\n#{content}\r\n"
end

Private Instance Methods

header_data() click to toggle source
Calls superclass method
# File lib/translatomatic/http/file_param.rb, line 22
def header_data
  super.merge(filename: %("#{filename}"))
end