Class: Flickr::Uploader::FormPart
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#filename ⇒ Object
readonly
Returns the value of attribute filename.
-
#mime_type ⇒ Object
readonly
Returns the value of attribute mime_type.
Instance Method Summary collapse
-
#initialize(name, data, mime_type = nil, filename = nil) ⇒ FormPart
constructor
A new instance of FormPart.
- #to_s ⇒ Object
Constructor Details
#initialize(name, data, mime_type = nil, filename = nil) ⇒ FormPart
Returns a new instance of FormPart.
96 97 98 99 100 101 102 |
# File 'lib/flickr/uploader.rb', line 96 def initialize(name, data, mime_type = nil, filename = nil) @attributes = {} @attributes['name'] = name @data = data @mime_type = mime_type @filename = filename end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
94 95 96 |
# File 'lib/flickr/uploader.rb', line 94 def attributes @attributes end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
94 95 96 |
# File 'lib/flickr/uploader.rb', line 94 def data @data end |
#filename ⇒ Object (readonly)
Returns the value of attribute filename.
94 95 96 |
# File 'lib/flickr/uploader.rb', line 94 def filename @filename end |
#mime_type ⇒ Object (readonly)
Returns the value of attribute mime_type.
94 95 96 |
# File 'lib/flickr/uploader.rb', line 94 def mime_type @mime_type end |
Instance Method Details
#to_s ⇒ Object
104 105 106 107 108 109 110 |
# File 'lib/flickr/uploader.rb', line 104 def to_s ([ "Content-Disposition: form-data" ] + attributes.map{|k,v| "#{k}=\"#{v}\""}). join('; ') + "\r\n"+ (@mime_type ? "Content-Type: #{@mime_type}\r\n" : '')+ "\r\n#{data}" end |