~ubuntu-branches/ubuntu/trusty/smuxi/trusty-proposed

« back to all changes in this revision

Viewing changes to lib/Twitterizer/Twitterizer2/Methods/Trends/AvailableTrendsCommand.cs

  • Committer: Package Import Robot
  • Author(s): Mirco Bauer
  • Date: 2013-05-25 22:11:31 UTC
  • mfrom: (1.2.12)
  • Revision ID: package-import@ubuntu.com-20130525221131-nd2mc0kzubuwyx20
Tags: 0.8.11-1
* [22d13d5] Imported Upstream version 0.8.11
* [6d2b95a] Refreshed patches
* [89eb66e] Added ServiceStack libraries to smuxi-engine package
* [848ab10] Enable Campfire engine
* [c6dbdc7] Always build db4o for predictable build result
* [13ec489] Exclude OS X specific libraries from dh_clideps

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
//-----------------------------------------------------------------------
 
2
// <copyright file="AvailableTrendsCommand.cs" company="Patrick 'Ricky' Smith">
 
3
//  This file is part of the Twitterizer library (http://www.twitterizer.net/)
 
4
// 
 
5
//  Copyright (c) 2010, Patrick "Ricky" Smith (ricky@digitally-born.com)
 
6
//  All rights reserved.
 
7
//  
 
8
//  Redistribution and use in source and binary forms, with or without modification, are 
 
9
//  permitted provided that the following conditions are met:
 
10
// 
 
11
//  - Redistributions of source code must retain the above copyright notice, this list 
 
12
//    of conditions and the following disclaimer.
 
13
//  - Redistributions in binary form must reproduce the above copyright notice, this list 
 
14
//    of conditions and the following disclaimer in the documentation and/or other 
 
15
//    materials provided with the distribution.
 
16
//  - Neither the name of the Twitterizer nor the names of its contributors may be 
 
17
//    used to endorse or promote products derived from this software without specific 
 
18
//    prior written permission.
 
19
// 
 
20
//  THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND 
 
21
//  ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 
 
22
//  WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. 
 
23
//  IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, 
 
24
//  INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT 
 
25
//  NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR 
 
26
//  PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, 
 
27
//  WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 
 
28
//  ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 
 
29
//  POSSIBILITY OF SUCH DAMAGE.
 
30
// </copyright>
 
31
// <author>Ricky Smith</author>
 
32
// <summary>The available trends command class</summary>
 
33
//-----------------------------------------------------------------------
 
34
 
 
35
namespace Twitterizer.Commands
 
36
{
 
37
    using System;
 
38
    using Twitterizer;
 
39
    using Twitterizer.Core;
 
40
    using System.Globalization;
 
41
 
 
42
    /// <summary>
 
43
    /// The create list command class
 
44
    /// </summary>
 
45
#if !SILVERLIGHT
 
46
    [Serializable]
 
47
#endif
 
48
    internal sealed class AvailableTrendsCommand : TwitterCommand<TwitterTrendLocationCollection>
 
49
    {
 
50
        #region Constructors
 
51
        /// <summary>
 
52
        /// Initializes a new instance of the <see cref="AvailableTrendsCommand"/> class.
 
53
        /// </summary>
 
54
        /// <param name="tokens">The request tokens.</param>
 
55
        /// <param name="options">The options.</param>
 
56
        public AvailableTrendsCommand(OAuthTokens tokens, AvailableTrendsOptions options)
 
57
            : base(
 
58
                HTTPVerb.GET,
 
59
                "trends/available.json",
 
60
                tokens,
 
61
                options)
 
62
        {
 
63
        }
 
64
        #endregion
 
65
 
 
66
 
 
67
        public override void Init()
 
68
        {
 
69
            AvailableTrendsOptions options = this.OptionalProperties as AvailableTrendsOptions;
 
70
            if (options == null)
 
71
            {
 
72
                return;
 
73
            }
 
74
            
 
75
            if (options.Lat != null)
 
76
                this.RequestParameters.Add("lat", options.Lat.ToString());
 
77
 
 
78
            if (options.Long != null)
 
79
                this.RequestParameters.Add("long", options.Long.ToString());        
 
80
        }
 
81
    }
 
82
}