Class: Faraday::Parts::ParamPart
- Inherits:
-
Object
- Object
- Faraday::Parts::ParamPart
- Defined in:
- lib/restforce/patches/parts.rb
Instance Method Summary collapse
- #build_part(boundary, name, value, headers = {}) ⇒ Object
-
#initialize(boundary, name, value, headers = {}) ⇒ ParamPart
constructor
A new instance of ParamPart.
Constructor Details
#initialize(boundary, name, value, headers = {}) ⇒ ParamPart
Returns a new instance of ParamPart.
19 20 21 22 |
# File 'lib/restforce/patches/parts.rb', line 19 def initialize(boundary, name, value, headers = {}) @part = build_part(boundary, name, value, headers) @io = StringIO.new(@part) end |
Instance Method Details
#build_part(boundary, name, value, headers = {}) ⇒ Object
24 25 26 27 28 29 30 31 |
# File 'lib/restforce/patches/parts.rb', line 24 def build_part(boundary, name, value, headers = {}) part = '' part << "--#{boundary}\r\n" part << "Content-Disposition: form-data; name=\"#{name}\"\r\n" part << "Content-Type: #{headers['Content-Type']}\r\n" if headers["Content-Type"] part << "\r\n" part << "#{value}\r\n" end |