Class: Vzaar::Request::Multipart

Inherits:
Struct
  • Object
show all
Defined in:
lib/vzaar/request/multipart.rb

Constant Summary collapse

CRLF =
"\r\n"

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#fileObject

Returns the value of attribute file

Returns:

  • (Object)

    the current value of file



3
4
5
# File 'lib/vzaar/request/multipart.rb', line 3

def file
  @file
end

#pathObject

Returns the value of attribute path

Returns:

  • (Object)

    the current value of path



3
4
5
# File 'lib/vzaar/request/multipart.rb', line 3

def path
  @path
end

Instance Method Details

#requestObject



6
7
8
9
10
11
12
# File 'lib/vzaar/request/multipart.rb', line 6

def request
  req = Net::HTTP::Post.new(path)
  req.body = build_body
  req["Content-Type"] = "multipart/form-data; boundary=#{boundary}"
  req["Content-Length"] = req.body.size
  req
end