Store data in database from GA API


I use the gem gattica to acces our unique visitor data. This works fine
in my console.

require ‘rubygems’
require ‘gattica’

gs ={:email => ‘XXXX’, :password => ‘XXXXX’})
accounts = gs.accounts
gs.profile_id = XXXXXX

results = gs.get({ :start_date => ‘2010-02-17’, :end_date =>
‘2010-02-17’, :dimensions => ‘day’, :metrics => ‘visitors’})


{“start_date”=>Wed, 17 Feb 2010, “end_date”=>Wed, 17 Feb 2010,
“points”=>[{“title”=>“ga:day=17”, “dimensions”=>[{:day=>“17”}],
“id”=>“Google Marketing Platform - Unified Advertising and Analytics”,
“metrics”=>[{:visitors=>4088}], “updated”=>Tue, 16 Feb 2010 16:00:00
-0800}], “items_per_page”=>1, “total_results”=>1, “start_index”=>1}

output 2:


I want to check the Google Analyticsc API with a frequency of 4 hours
and store the value of visitors (4088) in my database. How do i
realize this?