Question

I am using garb gem to fetch the data from the google analytics and I getting the data in Openstruct format and I am struggling to parse it and get the desired values out.

#<OpenStruct visits="142640", percent_new_visits="100.0", visitor_type="New Visitor">

I googled but did not find anything relevant to this. I am newbie to ruby on rails ENV.

Kindly help me out

Was it helpful?

Solution

You just call method on args like

object.visits
object.percent_new_visits
object.visitor_type

See the document about OpenStruct on Ruby doc http://ruby-doc.org/stdlib-1.9.3/libdoc/ostruct/rdoc/index.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top