diff --git a/README.md b/README.md index 74eb8dd..d5e6141 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ datainsight-visits-collector ============================ -Collects visits data for different time intervals from google analytics \ No newline at end of file +Collect the statics specified by the configuration from google analytics \ No newline at end of file diff --git a/bin/collector b/bin/collector index 57544ff..556bbcf 100755 --- a/bin/collector +++ b/bin/collector @@ -1,6 +1,7 @@ #!/usr/bin/env ruby -# Collects the weekly visits. -# Run: './bin/collector -t TOKEN print' +# Collects the statistics from google analytics. +# Run: './bin/collector -t TOKEN -c ConfigName print' (the first time) +# Run: './bin/collector -c ConfigName print' (subsequent times) # # To obtain authorisation code please visit: # @@ -18,7 +19,7 @@ require_relative '../lib/config/weekly_unique_visitors' include GLI -program_desc 'Collect the weekly visits' +program_desc 'Collect the statics specified by the configuration from google analytics' version 0.1 @@ -47,7 +48,7 @@ end command :print do |c| - c.desc 'Print out the collected content' + c.desc 'Print out the collected statistics' c.action do |global_options, options, args| puts collector(global_options).collect_as_json end @@ -55,7 +56,7 @@ end command :broadcast do |c| - c.desc 'Publish the collected content to the queue' + c.desc 'Publish the collected statistics to the queue' c.action do |global_options, options, args| collector(global_options).broadcast end diff --git a/lib/response.rb b/lib/response.rb index 6722b14..9ec803e 100644 --- a/lib/response.rb +++ b/lib/response.rb @@ -34,7 +34,7 @@ def parse_success(response) { :start_at => extract_start_at(response["query"]["start-date"]), :end_at => extract_end_at(response["query"]["end-date"]), - :value => get_total_visits(response["rows"]), + :value => get_total_metric(response["rows"]), :site => SITE_KEY } end @@ -48,7 +48,7 @@ def extract_end_at(end_date) end - def get_total_visits(rows) + def get_total_metric(rows) rows.inject(0) { |total, row| total + row.last.to_i } end end