diff Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs @ 108:786a90e26c9b

Los tests ya twittean con la cuenta de altnet-hispano-desa
author Nelo@Kenia.neluz.int
date Tue, 07 Jun 2011 23:07:06 -0300
parents 26d0513a8410
children a456eb519e23
line wrap: on
line diff
--- a/Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs	Tue Jun 07 21:03:56 2011 -0300
+++ b/Agendas/trunk/src/Agendas.Twitter/TwitterPublicador.cs	Tue Jun 07 23:07:06 2011 -0300
@@ -1,14 +1,55 @@
 using System;
 using System.Collections.Generic;
+using System.Configuration;
 using AltNetHispano.Agendas.Domain;
+using Twitterizer;
 
 namespace AltNetHispano.Agendas.Twitter
 {
 	public class TwitterPublicador : IPublicador
 	{
+		private string ConsumerKey
+		{
+			get { return ConfigurationManager.AppSettings["consumerKey"]; }
+		}
+
+		private string ConsumerSecret
+		{
+			get { return ConfigurationManager.AppSettings["consumerSecret"]; }
+		}
+
+
+		private string AccessToken
+		{
+			get { return ConfigurationManager.AppSettings["accessToken"]; }
+		}
+
+
+		private string AccessTokenSecret
+		{
+			get { return ConfigurationManager.AppSettings["accessTokenSecret"]; }
+		}
+
 		public void Publicar(IEnumerable<Track> tracks)
 		{
 			throw new NotImplementedException();
 		}
+
+		public bool Publicar (string status, out string message)
+		{
+			var tokens = new OAuthTokens
+			             	{
+			             		ConsumerKey = ConsumerKey,
+			             		ConsumerSecret = ConsumerSecret,
+			             		AccessToken = AccessToken,
+			             		AccessTokenSecret = AccessTokenSecret
+			             	};
+
+			var response = TwitterStatus.Update(tokens, status);
+
+			message = response.ErrorMessage;
+			return response.Result == RequestResult.Success;
+
+		}
 	}
 }
\ No newline at end of file