Skip to content

Commit

Permalink
Enable users to set a global variable for the account_id.
Browse files Browse the repository at this point in the history
  • Loading branch information
MartijnSch committed Jul 19, 2015
1 parent 86f15d4 commit 5b55f52
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions lib/gattica/engine.rb
Expand Up @@ -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.
#
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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')
Expand Down

0 comments on commit 5b55f52

Please sign in to comment.