From 5b55f52bbc9a95bcd0eca4141c06bb4622cb65af Mon Sep 17 00:00:00 2001 From: Martijn Scheijbeler Date: Sun, 19 Jul 2015 14:09:28 +0200 Subject: [PATCH] Enable users to set a global variable for the account_id. --- lib/gattica/engine.rb | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/lib/gattica/engine.rb b/lib/gattica/engine.rb index a68925a..e861ba4 100644 --- a/lib/gattica/engine.rb +++ b/lib/gattica/engine.rb @@ -2,7 +2,8 @@ module Gattica class Engine attr_reader :user - attr_accessor :profile_id, :token, :user_accounts, :account_id + attr_accessor :profile_id, :token, :user_accounts, :account_id, + :web_property_id # Initialize Gattica using username/password or token. # @@ -79,9 +80,9 @@ def accounts # == Usage # ga = Gattica.new({token: 'oauth2_token'}) # ga.properties(12346) # Look up properties - def properties(account_id) + def properties - raise GatticaError::MissingAccountId, 'account_id is required' if account_id.nil? || account_id.empty? + raise GatticaError::MissingAccountId, 'account_id is required' if @account_id.nil? || @account_id.empty? if @properties.nil? create_http_connection('www.googleapis.com') @@ -185,9 +186,9 @@ def goals(account_id, web_property_id, profile_id) # ga = Gattica.new({token: 'oauth2_token'}) # ga.filters(123456) # Look up filters # - def filters(account_id) + def filters - raise GatticaError::MissingAccountId, 'account_id is required' if account_id.nil? || account_id.empty? + raise GatticaError::MissingAccountId, 'account_id is required' if @account_id.nil? || @account_id.empty? if @filters.nil? create_http_connection('www.googleapis.com')