Maybe it should be reduced down to:
```rb
body = object_names.map do |name|
  URI.encode(container ? "#{ container }/#{ name }" : name)
end.join("\n")
```
It could all go on one line, but then I don't think it reads as well.
```rb
body = object_names.map {|name| URI.encode(container ? "#{ container }/#{ name }" : name) }.join("\n")
```