Class: Param
- Inherits:
-
Object
- Object
- Param
- Defined in:
- lib/mime_parts.rb
Overview
Adapted From : deftcode.com/code/flickr_upload/multipartpost.rb
Instance Attribute Summary collapse
-
#content_type ⇒ Object
Returns the value of attribute content_type.
-
#key ⇒ Object
Returns the value of attribute key.
-
#value ⇒ Object
Returns the value of attribute value.
Instance Method Summary collapse
-
#initialize(key, value, content_type) ⇒ Param
constructor
A new instance of Param.
- #to_multipart ⇒ Object
Constructor Details
#initialize(key, value, content_type) ⇒ Param
Returns a new instance of Param.
5 6 7 |
# File 'lib/mime_parts.rb', line 5 def initialize(key, value, content_type) @key = key; @value = value; @content_type = content_type end |
Instance Attribute Details
#content_type ⇒ Object
Returns the value of attribute content_type.
4 5 6 |
# File 'lib/mime_parts.rb', line 4 def content_type @content_type end |
#key ⇒ Object
Returns the value of attribute key.
4 5 6 |
# File 'lib/mime_parts.rb', line 4 def key @key end |
#value ⇒ Object
Returns the value of attribute value.
4 5 6 |
# File 'lib/mime_parts.rb', line 4 def value @value end |
Instance Method Details
#to_multipart ⇒ Object
9 10 11 12 13 |
# File 'lib/mime_parts.rb', line 9 def to_multipart return "\r\nContent-Disposition: form-data; name=\"#{CGI::escape(key)}\"\r\n" + "Content-Type: #{content_type}; charset=UTF-8" + "\r\n\r\n#{value}\r\n" end |