Class: Flickr::FormPart
- Inherits:
-
Object
- Object
- Flickr::FormPart
- Defined in:
- lib/flickr/upload.rb
Instance Attribute Summary collapse
-
#attributes ⇒ Object
readonly
Returns the value of attribute attributes.
-
#data ⇒ Object
readonly
Returns the value of attribute data.
-
#mime_type ⇒ Object
readonly
Returns the value of attribute mime_type.
Instance Method Summary collapse
-
#initialize(name, data, mime_type = nil) ⇒ FormPart
constructor
A new instance of FormPart.
- #to_s ⇒ Object
Constructor Details
#initialize(name, data, mime_type = nil) ⇒ FormPart
Returns a new instance of FormPart.
28 29 30 31 32 33 |
# File 'lib/flickr/upload.rb', line 28 def initialize(name,data,mime_type=nil) @attributes = {} @attributes['name'] = name @data = data @mime_type = mime_type end |
Instance Attribute Details
#attributes ⇒ Object (readonly)
Returns the value of attribute attributes.
26 27 28 |
# File 'lib/flickr/upload.rb', line 26 def attributes @attributes end |
#data ⇒ Object (readonly)
Returns the value of attribute data.
26 27 28 |
# File 'lib/flickr/upload.rb', line 26 def data @data end |
#mime_type ⇒ Object (readonly)
Returns the value of attribute mime_type.
26 27 28 |
# File 'lib/flickr/upload.rb', line 26 def mime_type @mime_type end |
Instance Method Details
#to_s ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/flickr/upload.rb', line 35 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 |