/// <summary> /// Initialize and authenticate. This constructor create an object of GAnalyticsService, /// extended from AnalyticsService class and it tries to authentificate an user with /// the given credentials for a specific account. /// Attemps to authorize using the client login authorization mechanism to get the possibity of /// requesting data into a Google Analytics account and sets the account wich we like tracking. /// </summary> /// <param name="account", GtAccount>Pass the object GtAcccount created by reading the configuration section /// handler (GtSettingsHandler object), we need to get the user login, password and some query parameters from this object /// we will use later to do the specific requests.</param> /// <param name="auth"><code>Auth2Register</code>This object autheticates the application in the Google Auth2 Service</param> /// <exception cref="ArgumentNullException<Auth>"/> /// <exception cref="InvalidCredentials"/> public GAnalyticsService(Auth2Register auth, GtAccount account) : base("GTGATracker") { if (account == null) { throw new ArgumentNullException("account", "Account not set"); } if (string.IsNullOrEmpty(account.Email)) { throw new ArgumentNullException("email", "Email not set"); } if (string.IsNullOrEmpty(account.Password)) { throw new ArgumentNullException("password", "Password not set"); } this.Auth = auth; this._Account = account; }
/// <summary> /// Initialize and authenticate. This constructor create an object of GAnalyticsService, /// extended from AnalyticsService class and it is registered in Google Auth2 Service. /// Attemps to authorize using the client login authorization mechanism to get the possibity of /// requesting data into a Google Analytics. /// </summary> /// <param name="auth"><code>Auth2Register</code>This object autheticates the application in the Google Auth2 Service</param> /// <exception cref="ArgumentNullException<Auth>"/> /// <exception cref="InvalidCredentials"/> public GAnalyticsService(Auth2Register auth) : base("GTGATracker") { this.Auth = auth; log4net.Config.XmlConfigurator.Configure(); }