Mercurial > altnet-hispano
view Agendas/trunk/src/Agendas.Twitter/oAuthTwitter.cs @ 120:c3573defd18f
Agregado de Fecha, Usuario y Successful en TrackLog
Modificacion de publicador de blog para usar TrackLog
Agregado de TrackLog en el test de crud de eventos
Fix en publicador de twitter para que no twitee si ya se encuentra en TrackLog pero con Successful en true
author | Jorge@Jorge-PC |
---|---|
date | Fri, 24 Jun 2011 21:18:21 -0300 |
parents | 0bca45e1e664 |
children | 734d3f0853bf |
line wrap: on
line source
using System; using System.Configuration; namespace AltNetHispano.Agendas.Twitter { public class OAuthTwitter { private readonly ITwitterAdapter _twitterAdapter; public OAuthTwitter() { _twitterAdapter = new TwitterAdapter(); } public OAuthTwitter(ITwitterAdapter twitterAdapter) { _twitterAdapter = twitterAdapter; } private string ConsumerKey { get { return ConfigurationManager.AppSettings["consumerKeyAppSignIn"]; } } private string ConsumerSecret { get { return ConfigurationManager.AppSettings["consumerSecretAppSignIn"]; } } public Uri AuthorizationLinkGet(string callbackAddress) { var request = _twitterAdapter.BuildAuthorizationUri(ConsumerKey, ConsumerSecret, callbackAddress); return request; } public string AccessTokenGet(string requestToken, string verifier) { return _twitterAdapter.GetAccessToken(ConsumerKey, ConsumerSecret, requestToken, verifier); } public static string GetResponseContent(string response, string tagName) { var tagStart = "\"" + tagName + "\":"; var tagEnd = ","; var start = response.IndexOf(tagStart) + tagStart.Length; if (start > tagStart.Length) { var end = response.IndexOf(tagEnd, start); if (end > 0) { return response.Substring(start + 1, end - start - 2); } } return string.Empty; } } }