comparison 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
comparison
equal deleted inserted replaced
107:1ee5711256db 108:786a90e26c9b
1 using System; 1 using System;
2 using System.Collections.Generic; 2 using System.Collections.Generic;
3 using System.Configuration;
3 using AltNetHispano.Agendas.Domain; 4 using AltNetHispano.Agendas.Domain;
5 using Twitterizer;
4 6
5 namespace AltNetHispano.Agendas.Twitter 7 namespace AltNetHispano.Agendas.Twitter
6 { 8 {
7 public class TwitterPublicador : IPublicador 9 public class TwitterPublicador : IPublicador
8 { 10 {
11 private string ConsumerKey
12 {
13 get { return ConfigurationManager.AppSettings["consumerKey"]; }
14 }
15
16 private string ConsumerSecret
17 {
18 get { return ConfigurationManager.AppSettings["consumerSecret"]; }
19 }
20
21
22 private string AccessToken
23 {
24 get { return ConfigurationManager.AppSettings["accessToken"]; }
25 }
26
27
28 private string AccessTokenSecret
29 {
30 get { return ConfigurationManager.AppSettings["accessTokenSecret"]; }
31 }
32
9 public void Publicar(IEnumerable<Track> tracks) 33 public void Publicar(IEnumerable<Track> tracks)
10 { 34 {
11 throw new NotImplementedException(); 35 throw new NotImplementedException();
12 } 36 }
37
38 public bool Publicar (string status, out string message)
39 {
40 var tokens = new OAuthTokens
41 {
42 ConsumerKey = ConsumerKey,
43 ConsumerSecret = ConsumerSecret,
44 AccessToken = AccessToken,
45 AccessTokenSecret = AccessTokenSecret
46 };
47
48 var response = TwitterStatus.Update(tokens, status);
49
50 message = response.ErrorMessage;
51 return response.Result == RequestResult.Success;
52
53 }
13 } 54 }
14 } 55 }