Class: Multipart::StringParam

Inherits:
Object
  • Object
show all
Defined in:
lib/common/http/multipart.rb

Overview

Formats a basic string key/value pair for inclusion with a multipart post

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(k, v) ⇒ StringParam

Returns a new instance of StringParam.



52
53
54
55
# File 'lib/common/http/multipart.rb', line 52

def initialize(k, v)
    @k = k
    @v = v
end

Instance Attribute Details

#kObject

Returns the value of attribute k.



50
51
52
# File 'lib/common/http/multipart.rb', line 50

def k
  @k
end

#vObject

Returns the value of attribute v.



50
51
52
# File 'lib/common/http/multipart.rb', line 50

def v
  @v
end

Instance Method Details

#to_multipartObject



57
58
59
# File 'lib/common/http/multipart.rb', line 57

def to_multipart
    return "Content-Disposition: form-data; name=\"#{k}\"\r\n\r\n#{v.to_s.force_encoding('ISO-8859-1')}\r\n"
end