sorentwo/dewey — pull request #12 by coryschires (2011-11-26 19:08:02+00:00)
Title: `convert` convenience method broken

Another small patch. The `convert` convenience method wasn't working properly. Arguments were being passed differently within `convert` then they would be if you were calling the methods directly. For example, pre-patch `convert` looks like:

def convert(file, options = {})
id = put(file, options[:title])
converted = get(id, options[:format])

delete(id)

converted
end

See how we're calling both `put` and `get` and passing in the hash values directly, but the API for those methods expects a full hash:

def put(file, options = {})
# ...
end

So we need to pass in a full hash instead of a value:

def convert(file, options = {})
id = put(file, :title => options[:title])
converted = get(id, :format => options[:format])
# ...
end

Looks like the tests missed this oversight since they were heavily stubbed. Also, it's working in my application. So I feel pretty good about it being correct.

Thanks again for this gem.