You are getting the error because raw_products
isn't an array. AS par vacuum
documentation, you will either have to convert it to hash by raw_products.to_h
or You can also pass the response body into your own parser for some custom XML heavy-lifting:
MyParser.new(raw_products.body)
So you have to first parse the the response properly before consuming it.
You can just do following:
@products = raw_products.to_h
product = OpenStruct.new(@products)