Subversion Repository Public Repository

insightly-api

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
using Ninject.Modules;
using TS.Insightly.API.Controller;
using TS.Insightly.API.Interface;

namespace TS.Insightly.API.ICModule
{
    /// <summary>
    /// Ninject module for binding the various API controllers.
    /// </summary>
    public class ApiModule : NinjectModule
    {
        #region Fields

        private readonly string _apiKey;

        #endregion Fields;

        /// <summary>
        /// Initializes a new instance of the <see cref="ApiModule"/> class.
        /// </summary>
        /// <param name="apiKey">The API key.</param>
        public ApiModule(string apiKey)
        {
            _apiKey = apiKey;
        }

        /// <summary>
        /// Loads the module into the kernel.
        /// </summary>
        public override void Load()
        {
            Bind<IContactController>().To<ContactController>().WithConstructorArgument("apiKey", _apiKey);
            Bind<IOrganisationController>().To<OrganisationController>().WithConstructorArgument("apiKey", _apiKey);
            Bind<IProjectController>().To<ProjectController>().WithConstructorArgument("apiKey", _apiKey);
        }
    }
}

Commits for insightly-api/trunk/Insightly/ICModule/ApiModule.cs

Diff revisions: vs.
Revision Author Commited Message
15 HadleyHope picture HadleyHope Tue 01 Oct, 2013 13:47:15 +0000

Refactored, added Ninject to load controllers for each part of the API.
InsightlyAPI class is now a true facade for the API.