0

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

shingara
  • 46,608
  • 11
  • 99
  • 105
Jeevan Dongre
  • 4,627
  • 13
  • 67
  • 129

1 Answers1

3

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

shingara
  • 46,608
  • 11
  • 99
  • 105