<div dir="ltr">Hi,<br><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Apr 14, 2014 at 3:41 PM, Matt Spendlove <span dir="ltr"><<a href="mailto:matt@cenatus.org" target="_blank">matt@cenatus.org</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">I'm not sure why replaying responses via VCR doesn't help you but assuming you don't want to do that, the simplest thing you can do is just new up some Structs that mirror the data. Are the responses really that verbose?</div>
</blockquote><div><br></div><div>VCR gives me an XML payload. I want a struct that I can operate on. I had a poke into the aws-sdk-core code to see if there was a place where I could inject the XML and get the Struct out, but it didn't look hopeful.<br>
<br></div><div>The responses aren't TOO verbose, and for canned data purposes I don't need that many... but it just felt like there ought to be a way to do it automatically. I'm currently thinking something like (untested, caffeinated):<br>
<br>images = ec2.describe_images(owners: ['self']).images.map(&:to_h)<br>serialised_images = images.to_json<br>MyEc2Struct = Struct.new(images.keys)<br></div><div>canned_images = serialised_images.reduce(MyEc2Struct.new) {|s, kv| s[kv[0]] = kv[1]; s}<br>
<br></div><div>S.<br></div></div>
</div></div>