Class: Multipart::FileParam

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

Overview

:nodoc:

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(k, filename, content) ⇒ FileParam

Returns a new instance of FileParam.



30
31
32
33
34
# File 'lib/tinder/multipart.rb', line 30

def initialize(k, filename, content)
  @k = k
  @filename = filename
  @content = content
end

Instance Attribute Details

#contentObject

Returns the value of attribute content.



29
30
31
# File 'lib/tinder/multipart.rb', line 29

def content
  @content
end

#filenameObject

Returns the value of attribute filename.



29
30
31
# File 'lib/tinder/multipart.rb', line 29

def filename
  @filename
end

#kObject

Returns the value of attribute k.



29
30
31
# File 'lib/tinder/multipart.rb', line 29

def k
  @k
end

Instance Method Details

#to_multipartObject



36
37
38
39
40
41
# File 'lib/tinder/multipart.rb', line 36

def to_multipart
  "Content-Disposition: form-data; name=\"#{k}\"; filename=\"#{filename}\"\r\n" +
    "Content-Transfer-Encoding: binary\r\n" +
    "Content-Type: #{MIME::Types.type_for(@filename)}\r\n\r\n" +
    @content + "\r\n"
end