public RolesApi(ISalesforceClient client, ISalesforceFieldMapping fieldMapping)
        {
            Assert.ArgumentNotNull(client, "client");

              this.Client = client;
              this.FieldMapping = fieldMapping;
        }
Esempio n. 2
0
        public static IEnumerable <T> QueryAllWithOffsetWorkaround <T>(this ISalesforceClient client, string query, int offset)
        {
            Assert.ArgumentNotNull(client, "client");
            Assert.ArgumentNotNullOrEmpty(query, "query");

            var queryResult = client.Query <T>(query);

            if (queryResult.Done)
            {
                return(queryResult.Records.Skip(offset));
            }

            string url = queryResult.NextRecordsUrl.Split('-')[0] + "-" + offset;

            //request URL could be incorrect so catch exception
            try
            {
                queryResult = client.HttpGet <QueryResult <T> >(url);
            }
            catch
            {
                return(Enumerable.Empty <T>());
            }

            return(client.GetAll(queryResult));
        }
Esempio n. 3
0
        public RolesApi(ISalesforceClient client, ISalesforceFieldMapping fieldMapping)
        {
            Assert.ArgumentNotNull(client, "client");

            this.Client       = client;
            this.FieldMapping = fieldMapping;
        }
Esempio n. 4
0
        public void SetUpTest()
        {
            ProviderHelper <SalesforceProvider, ProviderCollection <SalesforceProvider> > .DefaultProvider = new SalesforceProvider();

            var configuration = SalesforceManager.GetConfiguration("salesforce");

            this.Client = configuration.Client;
        }
        public void SetUpTest()
        {
            ProviderHelper<SalesforceProvider, ProviderCollection<SalesforceProvider>>.DefaultProvider = new SalesforceProvider();

              var configuration = SalesforceManager.GetConfiguration("salesforce");

              this.Client = configuration.Client;
        }
Esempio n. 6
0
        public static IEnumerable <T> QueryAll <T>(this ISalesforceClient client, string query)
        {
            Assert.ArgumentNotNull(client, "client");
            Assert.ArgumentNotNullOrEmpty(query, "query");

            var queryResult = client.Query <T>(query);

            return(client.GetAll(queryResult));
        }
Esempio n. 7
0
 public Synchronizer
 (
     ILogger <Synchronizer> logger,
     ISalesforceClient salesforceClient,
     IAccountService accountService
 )
 {
     _logger           = logger ?? throw new ArgumentNullException(nameof(logger));
     _salesforceClient = salesforceClient ?? throw new ArgumentNullException(nameof(salesforceClient));
     _accountService   = accountService ?? throw new ArgumentNullException(nameof(accountService));
 }
Esempio n. 8
0
        public static QueryResult <T> Query <T>(this ISalesforceClient client, string query)
        {
            Assert.ArgumentNotNull(client, "client");
            Assert.ArgumentNotNullOrEmpty(query, "query");

            if (!query.StartsWith("query/?q="))
            {
                query = "query/?q=" + query;
            }

            return(client.HttpGet <QueryResult <T> >(query));
        }
Esempio n. 9
0
        public void SetUpTest()
        {
            var configuration = SalesforceManager.GetConfiguration("salesforce");

            this.Client      = configuration.Client;
            this.ContactsApi = configuration.Api.ContactsApi;
            this.RolesApi    = configuration.Api.RolesApi;

            this.InitializeRoles("Test-Role-Get", "Test-Role-1");

            this.InitializeUsersInRole("Test-Role-1", "*****@*****.**");
        }
Esempio n. 10
0
        public static IEnumerable <T> GetAll <T>(this ISalesforceClient client, QueryResult <T> queryResult)
        {
            Assert.ArgumentNotNull(client, "client");
            Assert.ArgumentNotNull(queryResult, "queryResult");

            foreach (var record in queryResult.Records)
            {
                yield return(record);
            }

            while (!queryResult.Done)
            {
                queryResult = client.HttpGet <QueryResult <T> >(queryResult.NextRecordsUrl);

                foreach (var record in queryResult.Records)
                {
                    yield return(record);
                }
            }
        }
        public ContactsApi(ISalesforceClient client, ISalesforceFieldMapping fieldMapping, IEnumerable<ISalesforceProfileProperty> properties)
        {
            Assert.ArgumentNotNull(client, "client");
              Assert.ArgumentNotNull(fieldMapping, "fieldMapping");
              Assert.ArgumentNotNull(properties, "properties");

              this.MaxSalesforceOffset = 2000;

              this.Client = client;
              this.FieldMapping = fieldMapping;

              var fields = new HashSet<string>(fieldMapping.GetAllFields());
              fields.UnionWith(properties.Select(i => i.SalesforceName));

              fields.Remove(null);
              fields.Remove(string.Empty);
              fields.Remove(fieldMapping.Password);
              fields.Remove(fieldMapping.PasswordAnswer);

              this.FieldNamesString = string.Join(",", fields);
        }
        public ContactsApi(ISalesforceClient client, ISalesforceFieldMapping fieldMapping, IEnumerable <ISalesforceProfileProperty> properties)
        {
            Assert.ArgumentNotNull(client, "client");
            Assert.ArgumentNotNull(fieldMapping, "fieldMapping");
            Assert.ArgumentNotNull(properties, "properties");

            this.MaxSalesforceOffset = 2000;

            this.Client       = client;
            this.FieldMapping = fieldMapping;

            var fields = new HashSet <string>(fieldMapping.GetAllFields());

            fields.UnionWith(properties.Select(i => i.SalesforceName));

            fields.Remove(null);
            fields.Remove(string.Empty);
            fields.Remove(fieldMapping.Password);
            fields.Remove(fieldMapping.PasswordAnswer);

            this.FieldNamesString = string.Join(",", fields);
        }
 public virtual SLimits GetSalesforceLimits(ISalesforceClient client)
 {
     return client.HttpGet<SLimits>("limits");
 }
Esempio n. 14
0
 public virtual SLimits GetSalesforceLimits(ISalesforceClient client)
 {
     return(client.HttpGet <SLimits>("limits"));
 }
 public static SLimits GetSalesforceLimits(ISalesforceClient client)
 {
     return Provider.GetSalesforceLimits(client);
 }
        public void SetUpTest()
        {
            var configuration = SalesforceManager.GetConfiguration("salesforce");

              this.Client = configuration.Client;
              this.ContactsApi = configuration.Api.ContactsApi;
              this.RolesApi = configuration.Api.RolesApi;

              this.InitializeRoles("Test-Role-Get", "Test-Role-1");

              this.InitializeUsersInRole("Test-Role-1", "*****@*****.**");
        }
Esempio n. 17
0
        private static string DEFAULT_SOURCE_NAME = "TAKE HOME";    // provided value "Take Home Challenge Inc." is too long

        public LoanController(ILogger <LoanController> log, ISalesforceClient sfdc, IBlendClient blend)
        {
            Logger     = log;
            this.sfdc  = sfdc;
            this.blend = blend;
        }
 public static SLimits GetSalesforceLimits(ISalesforceClient client)
 {
     return(Provider.GetSalesforceLimits(client));
 }