Reputation: 4649
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
Upvotes: 0
Views: 1137
Reputation: 46914
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
Upvotes: 3