protected virtual void Dispose(bool disposing) { if (!_disposedValue) { if (disposing) { _allDevices = null; _allLocations = null; _allRooms = null; _allScenes = null; _allRules = null; _allSchedules = null; _allApps = null; _allSubscriptions = null; _allInstalledApps = null; _allDeviceProfiles = null; _devicesApi = null; _locationsApi = null; _roomsApi = null; _scenesApi = null; _rulesApi = null; _schedulesApi = null; _appsApi = null; _subscriptionsApi = null; _installedAppsApi = null; _deviceProfilesApi = null; } _disposedValue = true; } }
public void ShouldWorkNormally() { // Arrange decimal testAmount = 1.56m; var client = A.Fake <IRestClient>(); var options = Options.Create(new RulesOptions() { Url = "http://localhost:6000" }); var postResult = A.Fake <RestResponse <decimal> >(); postResult.Data = testAmount; postResult.StatusCode = System.Net.HttpStatusCode.OK; A.CallTo(() => client.Execute <decimal>(A <RestRequest> ._, Method.POST)) .Returns(postResult); // Act var sut = new RulesApi(client, options); var rulesRequest = A.Fake <object>(); var result = sut.Execute <decimal>("fake_endpoint", rulesRequest); // Assert Assert.Equal(testAmount, result); }
public SmartThingsClient(string accessToken) { var configuration = new Configuration(); configuration.AccessToken = accessToken ?? throw new ArgumentNullException(accessToken); _accessToken = accessToken; _devicesApi = new DevicesApi(configuration); _locationsApi = new LocationsApi(configuration); _roomsApi = new RoomsApi(configuration); _scenesApi = new ScenesApi(configuration); _rulesApi = new RulesApi(configuration); _schedulesApi = new SchedulesApi(configuration); _appsApi = new AppsApi(configuration); _subscriptionsApi = new SubscriptionsApi(configuration); _installedAppsApi = new InstalledappsApi(configuration); _deviceProfilesApi = new ProfilesApi(configuration); _capabilitiesApi = new CapabilitiesApi(configuration); _presentationApi = new PresentationsApi(configuration); //_accessToken = accessToken; //_devicesApi = new DevicesApi(); //_locationsApi = new LocationsApi(); //_roomsApi = new RoomsApi(); //_scenesApi = new ScenesApi(); //_rulesApi = new RulesApi(); //_schedulesApi = new SchedulesApi(); //_appsApi = new AppsApi(); //_subscriptionsApi = new SubscriptionsApi(); //_installedAppsApi = new InstalledappsApi(); //_deviceProfilesApi = new ProfilesApi(); //_capabilitiesApi = new CapabilitiesApi(); //_presentationApi = new PresentationsApi(); }
/// <summary> Initializes a new instance of the Stackstorm.Api.Client.St2Client class. </summary> /// <exception cref="ArgumentException">Thrown when one or more arguments have unsupported or /// illegal values. </exception> /// <param name="authUrl"> URL of the authentication endpoint. </param> /// <param name="apiUrl"> URL of the API. </param> /// <param name="username"> The username. </param> /// <param name="password"> The password. </param> /// <param name="ignoreCertificateValidation"> true to ignore certificate validation. </param> public St2Client(string authUrl, string apiUrl, string username, string password, bool ignoreCertificateValidation = false) { if (String.IsNullOrWhiteSpace(authUrl)) { throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'authUrl'.", "authUrl"); } if (String.IsNullOrWhiteSpace(apiUrl)) { throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'apiUrl'.", "apiUrl"); } if (String.IsNullOrWhiteSpace(password)) { throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'password'.", "password"); } if (String.IsNullOrWhiteSpace(username)) { throw new ArgumentException("Argument cannot be null, empty, or composed entirely of whitespace: 'username'.", "username"); } _apiUrl = new Uri(apiUrl); _authUrl = new Uri(authUrl); _password = password; _username = username; if (ignoreCertificateValidation) { ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; } Actions = new ActionsApi(this); Packs = new PacksApi(this); Executions = new ExecutionsApi(this); Rules = new RulesApi(this); VSphere = new VSphere(this); Core = new Core(this); Email = new Email(this); AzureGov = new AzureGov(this); }
public SmartThingsClient(string accessToken) { var configuration = new Configuration(); configuration.AccessToken = accessToken ?? throw new ArgumentNullException(accessToken); //configuration.BasePath = "https://graph-eu01-euwest1.api.smartthings.com/v1"; _devicesApi = new DevicesApi(configuration); _locationsApi = new LocationsApi(configuration); _roomsApi = new RoomsApi(configuration); _scenesApi = new ScenesApi(configuration); _rulesApi = new RulesApi(configuration); _schedulesApi = new SchedulesApi(configuration); _appsApi = new AppsApi(configuration); _subscriptionsApi = new SubscriptionsApi(configuration); _installedAppsApi = new InstalledAppsApi(configuration); _deviceProfilesApi = new DeviceProfilesApi(configuration); }
public void Init() { instance = new RulesApi(); }
public RulesApiTests() { instance = new RulesApi(); }