/** * Creates a new service object, attempts to authorize using the Client Login * authorization mechanism and requests data from the Google Analytics API. * @throws AuthenticationException if an error occurs with authorizing with * Google Accounts. * @throws IOException if a network error occurs. * @throws ServiceException if an error occurs with the Google Analytics API. */ public AccountFeedExample() { // Configure GA API. AnalyticsService asv = new AnalyticsService("gaExportAPI_acctSample_v2.0"); // Client Login Authorization. asv.setUserCredentials(CLIENT_USERNAME, CLIENT_PASS); // GA Account Feed query uri. AccountQuery query = new AccountQuery(); // Send our request to the Analytics API and wait for the results to // come back. accountFeed = asv.Query(query); }
public void AccountFeedConstructorTest() { AccountFeed target = new AccountFeed(null, null); Assert.IsNotNull(target, "better have an object"); Assert.IsNull(target.Service, "better have no service yet"); }
public void CreateAccountFeedTest() { AccountFeed target = new AccountFeed(null, null); AccountEntry entry = target.CreateFeedEntry() as AccountEntry; Assert.IsNotNull(entry, "better have a AccountEntry here"); }
private static AccountFeed Parse(string xml) { byte[] bytes = new UTF8Encoding().GetBytes(xml); AccountFeed feed = new AccountFeed(new Uri(AccountFeedUrl), new AnalyticsService("Test")); feed.Parse(new MemoryStream(bytes), AlternativeFormat.Atom); return feed; }