Class: Translatomatic::HTTPRequest::FileParam

Inherits:
Param
  • Object
show all
Defined in:
lib/translatomatic/http_request.rb

Overview

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

Instance Attribute Summary collapse

Attributes inherited from Param

#key, #value

Instance Method Summary collapse

Instance Attribute Details

#contentObject

Returns the value of attribute content.



122
123
124
# File 'lib/translatomatic/http_request.rb', line 122

def content
  @content
end

#filenameObject

Returns the value of attribute filename.



122
123
124
# File 'lib/translatomatic/http_request.rb', line 122

def filename
  @filename
end

#mime_typeObject

Returns the value of attribute mime_type.



122
123
124
# File 'lib/translatomatic/http_request.rb', line 122

def mime_type
  @mime_type
end

Instance Method Details

#to_sString

Returns Representation of this parameter as it appears within a multipart post request.

Returns:

  • (String)

    Representation of this parameter as it appears within a multipart post request.



125
126
127
128
# File 'lib/translatomatic/http_request.rb', line 125

def to_s
  return header(header_data) +
    header("Content-Type": mime_type) + "\r\n#{content}\r\n"
end