Mercurial > altnet-hispano
view Agendas/trunk/src/Agendas.Twitter/oAuthTwitter.cs @ 291:5f1e3d35e113
Patrocinadores: Correcciones en Vistas.
author | juanjose.montesdeocaarbos |
---|---|
date | Thu, 09 Feb 2012 00:12:00 -0300 |
parents | a7420f05716a |
children |
line wrap: on
line source
using System; using System.Collections.Generic; using System.Web.Script.Serialization; using AltNetHispano.Agendas.Configurations; 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 AgendasConfigurationManager.Publicadores.Twitter.SignIn.ConsumerKey; } } private string ConsumerSecret { get { return AgendasConfigurationManager.Publicadores.Twitter.SignIn.ConsumerSecret; } } 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 serializer = new JavaScriptSerializer(); var responseDictionary = (Dictionary<string,object>)serializer.DeserializeObject(response); return responseDictionary.ContainsKey(tagName) ? responseDictionary[tagName].ToString() : string.Empty; } } }