Class: Flickr::MultiPartForm

Inherits:
Object
  • Object
show all
Defined in:
lib/flickr/upload.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(boundary = nil) ⇒ MultiPartForm

Returns a new instance of MultiPartForm.



47
48
49
50
51
# File 'lib/flickr/upload.rb', line 47

def initialize(boundary=nil)
	@boundary = boundary ||
	    "----------------------------Ruby#{rand(1000000000000)}"
	@parts = []
end

Instance Attribute Details

#boundaryObject

Returns the value of attribute boundary.



45
46
47
# File 'lib/flickr/upload.rb', line 45

def boundary
  @boundary
end

#partsObject

Returns the value of attribute parts.



45
46
47
# File 'lib/flickr/upload.rb', line 45

def parts
  @parts
end

Instance Method Details

#to_sObject



53
54
55
56
57
# File 'lib/flickr/upload.rb', line 53

def to_s
	"--#@boundary\r\n"+
	parts.map{|p| p.to_s}.join("\r\n--#@boundary\r\n")+
	"\r\n--#@boundary--\r\n"
end