I have to mimic a Google API response and create a 2-level deep data structure that is traversable by . like this:
=> user.names.first_name
Bob
Is there any smarter/better way than this:
user = OpenStruct.new(names: OpenStruct.new(first_name: 'Bob'))
This method is rude method but works,
And another method is adding method to Hash class itself,
Using above method you can convert your hash to openstruct