Permalink
Browse files

Added actual library

  • Loading branch information...
1 parent 491607c commit eacdd4c8d5298abef86ade987fcc1c71b8a0ecfc @alexandernyquist committed Mar 21, 2011
Showing with 984 additions and 0 deletions.
  1. +42 −0 AnalyticsApi.sln
  2. BIN AnalyticsApi.suo
  3. +69 −0 AnalyticsApi/AnalyticsApi.csproj
  4. +6 −0 AnalyticsApi/AnalyticsApi.csproj.user
  5. +38 −0 AnalyticsApi/AnalyticsDataProvider.cs
  6. +239 −0 AnalyticsApi/AnalyticsService.cs
  7. +42 −0 AnalyticsApi/ApiMap.cs
  8. +8 −0 AnalyticsApi/ElementLevel.cs
  9. +13 −0 AnalyticsApi/Exceptions/InvalidCredentialsException.cs
  10. +20 −0 AnalyticsApi/Extensions/EnumerableExtensions.cs
  11. +104 −0 AnalyticsApi/HttpWrapper.cs
  12. +23 −0 AnalyticsApi/Interfaces/IAnalyticsDataProvider.cs
  13. +10 −0 AnalyticsApi/Interfaces/IHttpWrapper.cs
  14. +19 −0 AnalyticsApi/Maps/AnalyticsAccountRequest.cs
  15. +73 −0 AnalyticsApi/Maps/DashboardRequest.cs
  16. +15 −0 AnalyticsApi/Maps/GoalCompletionsRequest.cs
  17. +7 −0 AnalyticsApi/Maps/GoalRequest.cs
  18. +111 −0 AnalyticsApi/Parsers/AnalyticsGoalParser.cs
  19. +94 −0 AnalyticsApi/Parsers/AnalyticsXmlParser.cs
  20. +36 −0 AnalyticsApi/Properties/AssemblyInfo.cs
  21. BIN AnalyticsApi/bin/Debug/AnalyticsApi.dll
  22. BIN AnalyticsApi/bin/Debug/AnalyticsApi.pdb
  23. BIN AnalyticsApi/bin/Release/AnalyticsApi.dll
  24. BIN AnalyticsApi/bin/Release/AnalyticsApi.pdb
  25. +10 −0 AnalyticsApi/obj/Debug/AnalyticsApi.csproj.FileListAbsolute.txt
  26. BIN AnalyticsApi/obj/Debug/AnalyticsApi.dll
  27. BIN AnalyticsApi/obj/Debug/AnalyticsApi.pdb
  28. BIN AnalyticsApi/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  29. +5 −0 AnalyticsApi/obj/Release/AnalyticsApi.csproj.FileListAbsolute.txt
  30. BIN AnalyticsApi/obj/Release/AnalyticsApi.dll
  31. BIN AnalyticsApi/obj/Release/AnalyticsApi.pdb
  32. BIN AnalyticsApi/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache
View
@@ -0,0 +1,42 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnalyticsApi", "AnalyticsApi\AnalyticsApi.csproj", "{FCA9EC50-0470-4993-A68A-FB8AFC07EE9C}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "AnalyticsApi.Test", "AnalyticsApi.Test\AnalyticsApi.Test.csproj", "{2EF90DA4-8A44-4371-BA34-357F3643FE09}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Debug|Mixed Platforms = Debug|Mixed Platforms
+ Debug|x86 = Debug|x86
+ Release|Any CPU = Release|Any CPU
+ Release|Mixed Platforms = Release|Mixed Platforms
+ Release|x86 = Release|x86
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {FCA9EC50-0470-4993-A68A-FB8AFC07EE9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {FCA9EC50-0470-4993-A68A-FB8AFC07EE9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {FCA9EC50-0470-4993-A68A-FB8AFC07EE9C}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {FCA9EC50-0470-4993-A68A-FB8AFC07EE9C}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {FCA9EC50-0470-4993-A68A-FB8AFC07EE9C}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {FCA9EC50-0470-4993-A68A-FB8AFC07EE9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {FCA9EC50-0470-4993-A68A-FB8AFC07EE9C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {FCA9EC50-0470-4993-A68A-FB8AFC07EE9C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {FCA9EC50-0470-4993-A68A-FB8AFC07EE9C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {FCA9EC50-0470-4993-A68A-FB8AFC07EE9C}.Release|x86.ActiveCfg = Release|Any CPU
+ {2EF90DA4-8A44-4371-BA34-357F3643FE09}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {2EF90DA4-8A44-4371-BA34-357F3643FE09}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {2EF90DA4-8A44-4371-BA34-357F3643FE09}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
+ {2EF90DA4-8A44-4371-BA34-357F3643FE09}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
+ {2EF90DA4-8A44-4371-BA34-357F3643FE09}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {2EF90DA4-8A44-4371-BA34-357F3643FE09}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {2EF90DA4-8A44-4371-BA34-357F3643FE09}.Release|Any CPU.Build.0 = Release|Any CPU
+ {2EF90DA4-8A44-4371-BA34-357F3643FE09}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
+ {2EF90DA4-8A44-4371-BA34-357F3643FE09}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {2EF90DA4-8A44-4371-BA34-357F3643FE09}.Release|x86.ActiveCfg = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
Binary file not shown.
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{FCA9EC50-0470-4993-A68A-FB8AFC07EE9C}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>AnalyticsApi</RootNamespace>
+ <AssemblyName>AnalyticsApi</AssemblyName>
+ <TargetFrameworkVersion>v3.5</TargetFrameworkVersion>
+ <FileAlignment>512</FileAlignment>
+ <TargetFrameworkProfile />
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ElementLevel.cs" />
+ <Compile Include="Exceptions\InvalidCredentialsException.cs" />
+ <Compile Include="Maps\DashboardRequest.cs" />
+ <Compile Include="Maps\AnalyticsAccountRequest.cs" />
+ <Compile Include="AnalyticsDataProvider.cs" />
+ <Compile Include="AnalyticsService.cs" />
+ <Compile Include="ApiMap.cs" />
+ <Compile Include="Extensions\EnumerableExtensions.cs" />
+ <Compile Include="HttpWrapper.cs" />
+ <Compile Include="Interfaces\IAnalyticsDataProvider.cs" />
+ <Compile Include="Interfaces\IHttpWrapper.cs" />
+ <Compile Include="Maps\GoalCompletionsRequest.cs" />
+ <Compile Include="Maps\GoalRequest.cs" />
+ <Compile Include="Parsers\AnalyticsGoalParser.cs" />
+ <Compile Include="Parsers\AnalyticsXmlParser.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
@@ -0,0 +1,6 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ProjectView>ProjectFiles</ProjectView>
+ </PropertyGroup>
+</Project>
@@ -0,0 +1,38 @@
+using System.Collections.Generic;
+
+namespace AnalyticsApi
+{
+ public class AnalyticsDataProvider : IAnalyticsDataProvider
+ {
+ private readonly string _applicationName;
+ private readonly IHttpWrapper _httpWrapper;
+
+ public AnalyticsDataProvider(string applicationName, IHttpWrapper httpWrapper)
+ {
+ _applicationName = applicationName;
+ _httpWrapper = httpWrapper;
+ }
+
+ public string RequestLoginToken(string username, string password)
+ {
+ var parameters = new Dictionary<string, string>
+ {
+ {"Email", username},
+ {"Passwd", password},
+ {"accountType", "GOOGLE"},
+ {"service", "analytics"},
+ {"source", _applicationName}
+ };
+
+ var response = _httpWrapper.Post("https://www.google.com/accounts/ClientLogin", parameters);
+
+ var token = response.Remove(0, response.IndexOf("Auth=")).Replace("Auth=", string.Empty);
+ return token;
+ }
+
+ public string SendRequest(string token, string resource)
+ {
+ return _httpWrapper.Get(resource, new Dictionary<string, string> { { "Authorization", "GoogleLogin auth=" + token } });
+ }
+ }
+}
Oops, something went wrong.

0 comments on commit eacdd4c

Please sign in to comment.