I was particularly interested in how to obtain a shared link to an image, and there is a method called /shares. It takes
path of a file as a parameter and returns a shortened url by default. According to Core API documentation, short_url parameter is optional and when it is set to false, the method returns a long url, which links directly to the preview page.Ruby SDK didn't use to support this parameter up until a month ago. The method looked as follows (copied from their
dropbox_sdk.rb):def shares(path)
response = @session.do_get "/shares/#{@root}#{format_path(path)}"
Dropbox::parse_response(response)
end
It's been updated to the following:
def shares(path, short_url=true)
response = @session.do_get "/shares/#{@root}#{format_path(path)}",
{"short_url"=>short_url}
Dropbox::parse_response(response)
end
I've noticed that neither RubyGems nor the official link to Ruby SDK carried an updated version as of today. Perhaps, there is some lengthy review/approval period? In the meantime, I've simply copied the updated method into my own SDK.
No comments :
Post a Comment