This fixes the generator for cases where one of the entries of the
"schemas" object returned by the Discovery service is a recursively
defined map.
Fixes#608
If the method name is generated from the request type, there is a
possibility of a clash if two methods take the same request type. For
example, if two unique methods take the request type
"CreateRoleRequest", both methods will be generated with the method name
"create_role", which causes generation to fail with an exception.
This commit resolves that issue by first generating a method name from
the request type of each method, and keeping track of which names are
duplicates. For methods that will generate a duplicate name from the
request type, the name is generated from the method ID instead (the
resulting name is guaranteed to be unique).
Not all IO objects know how to #rewind themselves. For example, Ruby
pipes (returned by `IO.pipe`) do implement #rewind, but they will throw
an error if you try to call it.
rd, wr = IO.pipe
wr.rewind # Errno::ESPIPE: Illegal seek
But we don't need to rewind and overwrite the IO object if we didn't get
the Ranged response we expected, we could instead wait out the content
that has already been downloaded, and start appending again once we
reached where we left off. This is what this commit does.