Closed toctan closed 11 years ago
Hi, Try
client.statuse,upload("Hey!", "whatever.jpg", :visible => 2)
the second argument pic is pathname for the pic, you dont need to pass the file into this method. maybe I should rename it to avoid this confusion anymore. Thanks for mention this.
@simsicon
client.statuses.upload('Test', '/home/toctan/1.jpg', :visible => 2)
# => {"error":"does multipart has image?","error_code":20007,"request":"/2/statuses/upload.json"}
# I do not think the second option is the pathname.
client.statuses.upload('Test', File.open('/home/toctan/1.jpg'), :visible => 2) # => success
It's really strange the same code works today. Fuck Sina.
Yes, you can pass the second parameter as a stream that respond to :read method, even open remote resources(using open-uri)
I can specific the weibo option in an optional hash when I update the text status:
But it does not work when I try to do the same thing when I try to post a weibo with image via upload:
I studied the source code and the example you have given. The option hash in upload is considered a file option, isn't it? I think it's consistent the two options do the same thing, maybe the upload function should be implemented like this: