Class: Translatomatic::HTTPRequest::FileParam
- Defined in:
- lib/translatomatic/http_request.rb
Overview
Formats the contents of a file or string for a multipart post
Instance Attribute Summary collapse
-
#content ⇒ Object
Returns the value of attribute content.
-
#filename ⇒ Object
Returns the value of attribute filename.
-
#mime_type ⇒ Object
Returns the value of attribute mime_type.
Attributes inherited from Param
Instance Method Summary collapse
-
#initialize(key:, filename:, content:, mime_type:) ⇒ FileParam
constructor
A new instance of FileParam.
- #to_s ⇒ Object
Constructor Details
#initialize(key:, filename:, content:, mime_type:) ⇒ FileParam
Returns a new instance of FileParam.
100 101 102 103 104 105 |
# File 'lib/translatomatic/http_request.rb', line 100 def initialize(key:, filename:, content:, mime_type:) @key = key @filename = filename @content = content @mime_type = mime_type end |
Instance Attribute Details
#content ⇒ Object
Returns the value of attribute content.
98 99 100 |
# File 'lib/translatomatic/http_request.rb', line 98 def content @content end |
#filename ⇒ Object
Returns the value of attribute filename.
98 99 100 |
# File 'lib/translatomatic/http_request.rb', line 98 def filename @filename end |
#mime_type ⇒ Object
Returns the value of attribute mime_type.
98 99 100 |
# File 'lib/translatomatic/http_request.rb', line 98 def mime_type @mime_type end |
Instance Method Details
#to_s ⇒ Object
107 108 109 110 |
# File 'lib/translatomatic/http_request.rb', line 107 def to_s return header(header_data) + header("Content-Type": mime_type) + "\r\n#{content}\r\n" end |