diff --git a/Samples/azure-storage/Azure.CSharp/StorageAccountsOperations.cs b/Samples/azure-storage/Azure.CSharp/StorageAccountsOperations.cs index ef9542ca09..043ab31b3f 100644 --- a/Samples/azure-storage/Azure.CSharp/StorageAccountsOperations.cs +++ b/Samples/azure-storage/Azure.CSharp/StorageAccountsOperations.cs @@ -264,11 +264,8 @@ internal StorageAccountsOperations(StorageManagementClient client) public async Task> CreateWithHttpMessagesAsync(string resourceGroupName, string accountName, StorageAccountCreateParameters parameters, Dictionary> customHeaders = null, CancellationToken cancellationToken = default(CancellationToken)) { // Send Request - AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync( - resourceGroupName, accountName, parameters, customHeaders, cancellationToken); - return await Client.GetPutOrPatchOperationResultAsync(_response, - customHeaders, - cancellationToken); + AzureOperationResponse _response = await BeginCreateWithHttpMessagesAsync(resourceGroupName, accountName, parameters, customHeaders, cancellationToken).ConfigureAwait(false); + return await Client.GetPutOrPatchOperationResultAsync(_response, customHeaders, cancellationToken).ConfigureAwait(false); } /// diff --git a/Samples/azure-storage/Azure.CSharp/StorageAccountsOperationsExtensions.cs b/Samples/azure-storage/Azure.CSharp/StorageAccountsOperationsExtensions.cs index d886c82aaf..40e0222572 100644 --- a/Samples/azure-storage/Azure.CSharp/StorageAccountsOperationsExtensions.cs +++ b/Samples/azure-storage/Azure.CSharp/StorageAccountsOperationsExtensions.cs @@ -27,7 +27,7 @@ public static partial class StorageAccountsOperationsExtensions /// public static CheckNameAvailabilityResult CheckNameAvailability(this IStorageAccountsOperations operations, StorageAccountCheckNameAvailabilityParameters accountName) { - return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).CheckNameAvailabilityAsync(accountName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CheckNameAvailabilityAsync(accountName).GetAwaiter().GetResult(); } /// @@ -75,7 +75,7 @@ public static CheckNameAvailabilityResult CheckNameAvailability(this IStorageAcc /// public static StorageAccount Create(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, StorageAccountCreateParameters parameters) { - return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).CreateAsync(resourceGroupName, accountName, parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.CreateAsync(resourceGroupName, accountName, parameters).GetAwaiter().GetResult(); } /// @@ -126,7 +126,7 @@ public static StorageAccount Create(this IStorageAccountsOperations operations, /// public static void Delete(this IStorageAccountsOperations operations, string resourceGroupName, string accountName) { - Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).DeleteAsync(resourceGroupName, accountName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); } /// @@ -169,7 +169,7 @@ public static void Delete(this IStorageAccountsOperations operations, string res /// public static StorageAccount GetProperties(this IStorageAccountsOperations operations, string resourceGroupName, string accountName) { - return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).GetPropertiesAsync(resourceGroupName, accountName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetPropertiesAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); } /// @@ -230,7 +230,7 @@ public static StorageAccount GetProperties(this IStorageAccountsOperations opera /// public static StorageAccount Update(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, StorageAccountUpdateParameters parameters) { - return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).UpdateAsync(resourceGroupName, accountName, parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.UpdateAsync(resourceGroupName, accountName, parameters).GetAwaiter().GetResult(); } /// @@ -287,7 +287,7 @@ public static StorageAccount Update(this IStorageAccountsOperations operations, /// public static StorageAccountKeys ListKeys(this IStorageAccountsOperations operations, string resourceGroupName, string accountName) { - return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).ListKeysAsync(resourceGroupName, accountName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListKeysAsync(resourceGroupName, accountName).GetAwaiter().GetResult(); } /// @@ -322,7 +322,7 @@ public static StorageAccountKeys ListKeys(this IStorageAccountsOperations operat /// public static IEnumerable List(this IStorageAccountsOperations operations) { - return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).ListAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAsync().GetAwaiter().GetResult(); } /// @@ -356,7 +356,7 @@ public static IEnumerable List(this IStorageAccountsOperations o /// public static IEnumerable ListByResourceGroup(this IStorageAccountsOperations operations, string resourceGroupName) { - return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).ListByResourceGroupAsync(resourceGroupName), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListByResourceGroupAsync(resourceGroupName).GetAwaiter().GetResult(); } /// @@ -401,7 +401,7 @@ public static IEnumerable ListByResourceGroup(this IStorageAccou /// public static StorageAccountKeys RegenerateKey(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, StorageAccountRegenerateKeyParameters regenerateKey) { - return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).RegenerateKeyAsync(resourceGroupName, accountName, regenerateKey), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.RegenerateKeyAsync(resourceGroupName, accountName, regenerateKey).GetAwaiter().GetResult(); } /// @@ -456,7 +456,7 @@ public static StorageAccountKeys RegenerateKey(this IStorageAccountsOperations o /// public static StorageAccount BeginCreate(this IStorageAccountsOperations operations, string resourceGroupName, string accountName, StorageAccountCreateParameters parameters) { - return Task.Factory.StartNew(s => ((IStorageAccountsOperations)s).BeginCreateAsync(resourceGroupName, accountName, parameters), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.BeginCreateAsync(resourceGroupName, accountName, parameters).GetAwaiter().GetResult(); } /// diff --git a/Samples/azure-storage/Azure.CSharp/UsageOperationsExtensions.cs b/Samples/azure-storage/Azure.CSharp/UsageOperationsExtensions.cs index ee17c6a27e..c8fddf38e7 100644 --- a/Samples/azure-storage/Azure.CSharp/UsageOperationsExtensions.cs +++ b/Samples/azure-storage/Azure.CSharp/UsageOperationsExtensions.cs @@ -23,7 +23,7 @@ public static partial class UsageOperationsExtensions /// public static IEnumerable List(this IUsageOperations operations) { - return Task.Factory.StartNew(s => ((IUsageOperations)s).ListAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.ListAsync().GetAwaiter().GetResult(); } /// diff --git a/Samples/azure-storage/Azure.Ruby/generated/azure_storage/storage_management_client.rb b/Samples/azure-storage/Azure.Ruby/generated/azure_storage/storage_management_client.rb index 0ba3552e8e..34b423bb13 100644 --- a/Samples/azure-storage/Azure.Ruby/generated/azure_storage/storage_management_client.rb +++ b/Samples/azure-storage/Azure.Ruby/generated/azure_storage/storage_management_client.rb @@ -45,12 +45,11 @@ class StorageManagementClient < MsRestAzure::AzureServiceClient # @param base_url [String] the base URI of the service. # @param options [Array] filters to be applied to the HTTP requests. # - def initialize(credentials, base_url = nil, options = nil) + def initialize(credentials = nil, base_url = nil, options = nil) super(credentials, options) @base_url = base_url || 'https://management.azure.com' - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) + fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? @credentials = credentials @storage_accounts = StorageAccounts.new(self) diff --git a/Samples/petstore/CSharp/SwaggerPetstoreExtensions.cs b/Samples/petstore/CSharp/SwaggerPetstoreExtensions.cs index 36c02102e7..6b3c9bdc2f 100644 --- a/Samples/petstore/CSharp/SwaggerPetstoreExtensions.cs +++ b/Samples/petstore/CSharp/SwaggerPetstoreExtensions.cs @@ -25,7 +25,7 @@ public static partial class SwaggerPetstoreExtensions /// public static void AddPetUsingByteArray(this ISwaggerPetstore operations, string body = default(string)) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).AddPetUsingByteArrayAsync(body), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.AddPetUsingByteArrayAsync(body).GetAwaiter().GetResult(); } /// @@ -61,7 +61,7 @@ public static partial class SwaggerPetstoreExtensions /// public static void AddPet(this ISwaggerPetstore operations, Pet body = default(Pet)) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).AddPetAsync(body), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.AddPetAsync(body).GetAwaiter().GetResult(); } /// @@ -96,7 +96,7 @@ public static partial class SwaggerPetstoreExtensions /// public static void UpdatePet(this ISwaggerPetstore operations, Pet body = default(Pet)) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).UpdatePetAsync(body), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.UpdatePetAsync(body).GetAwaiter().GetResult(); } /// @@ -130,7 +130,7 @@ public static partial class SwaggerPetstoreExtensions /// public static IList FindPetsByStatus(this ISwaggerPetstore operations, IList status = default(IList)) { - return Task.Factory.StartNew(s => ((ISwaggerPetstore)s).FindPetsByStatusAsync(status), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.FindPetsByStatusAsync(status).GetAwaiter().GetResult(); } /// @@ -171,7 +171,7 @@ public static partial class SwaggerPetstoreExtensions /// public static IList FindPetsByTags(this ISwaggerPetstore operations, IList tags = default(IList)) { - return Task.Factory.StartNew(s => ((ISwaggerPetstore)s).FindPetsByTagsAsync(tags), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.FindPetsByTagsAsync(tags).GetAwaiter().GetResult(); } /// @@ -213,7 +213,7 @@ public static partial class SwaggerPetstoreExtensions /// public static string FindPetsWithByteArray(this ISwaggerPetstore operations, long petId) { - return Task.Factory.StartNew(s => ((ISwaggerPetstore)s).FindPetsWithByteArrayAsync(petId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.FindPetsWithByteArrayAsync(petId).GetAwaiter().GetResult(); } /// @@ -255,7 +255,7 @@ public static string FindPetsWithByteArray(this ISwaggerPetstore operations, lon /// public static Pet GetPetById(this ISwaggerPetstore operations, long petId) { - return Task.Factory.StartNew(s => ((ISwaggerPetstore)s).GetPetByIdAsync(petId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetPetByIdAsync(petId).GetAwaiter().GetResult(); } /// @@ -299,7 +299,7 @@ public static Pet GetPetById(this ISwaggerPetstore operations, long petId) /// public static void UpdatePetWithForm(this ISwaggerPetstore operations, string petId, string name = default(string), string status = default(string)) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).UpdatePetWithFormAsync(petId, name, status), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.UpdatePetWithFormAsync(petId, name, status).GetAwaiter().GetResult(); } /// @@ -338,7 +338,7 @@ public static Pet GetPetById(this ISwaggerPetstore operations, long petId) /// public static void DeletePet(this ISwaggerPetstore operations, long petId, string apiKey = default(string)) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).DeletePetAsync(petId, apiKey), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeletePetAsync(petId, apiKey).GetAwaiter().GetResult(); } /// @@ -377,7 +377,7 @@ public static Pet GetPetById(this ISwaggerPetstore operations, long petId) /// public static void UploadFile(this ISwaggerPetstore operations, long petId, string additionalMetadata = default(string), Stream file = default(Stream)) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).UploadFileAsync(petId, additionalMetadata, file), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.UploadFileAsync(petId, additionalMetadata, file).GetAwaiter().GetResult(); } /// @@ -414,7 +414,7 @@ public static Pet GetPetById(this ISwaggerPetstore operations, long petId) /// public static IDictionary GetInventory(this ISwaggerPetstore operations) { - return Task.Factory.StartNew(s => ((ISwaggerPetstore)s).GetInventoryAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetInventoryAsync().GetAwaiter().GetResult(); } /// @@ -448,7 +448,7 @@ public static Pet GetPetById(this ISwaggerPetstore operations, long petId) /// public static Order PlaceOrder(this ISwaggerPetstore operations, Order body = default(Order)) { - return Task.Factory.StartNew(s => ((ISwaggerPetstore)s).PlaceOrderAsync(body), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.PlaceOrderAsync(body).GetAwaiter().GetResult(); } /// @@ -486,7 +486,7 @@ public static Pet GetPetById(this ISwaggerPetstore operations, long petId) /// public static Order GetOrderById(this ISwaggerPetstore operations, string orderId) { - return Task.Factory.StartNew(s => ((ISwaggerPetstore)s).GetOrderByIdAsync(orderId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetOrderByIdAsync(orderId).GetAwaiter().GetResult(); } /// @@ -528,7 +528,7 @@ public static Order GetOrderById(this ISwaggerPetstore operations, string orderI /// public static void DeleteOrder(this ISwaggerPetstore operations, string orderId) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).DeleteOrderAsync(orderId), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteOrderAsync(orderId).GetAwaiter().GetResult(); } /// @@ -566,7 +566,7 @@ public static void DeleteOrder(this ISwaggerPetstore operations, string orderId) /// public static void CreateUser(this ISwaggerPetstore operations, User body = default(User)) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).CreateUserAsync(body), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.CreateUserAsync(body).GetAwaiter().GetResult(); } /// @@ -600,7 +600,7 @@ public static void DeleteOrder(this ISwaggerPetstore operations, string orderId) /// public static void CreateUsersWithArrayInput(this ISwaggerPetstore operations, IList body = default(IList)) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).CreateUsersWithArrayInputAsync(body), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.CreateUsersWithArrayInputAsync(body).GetAwaiter().GetResult(); } /// @@ -631,7 +631,7 @@ public static void DeleteOrder(this ISwaggerPetstore operations, string orderId) /// public static void CreateUsersWithListInput(this ISwaggerPetstore operations, IList body = default(IList)) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).CreateUsersWithListInputAsync(body), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.CreateUsersWithListInputAsync(body).GetAwaiter().GetResult(); } /// @@ -665,7 +665,7 @@ public static void DeleteOrder(this ISwaggerPetstore operations, string orderId) /// public static string LoginUser(this ISwaggerPetstore operations, string username = default(string), string password = default(string)) { - return Task.Factory.StartNew(s => ((ISwaggerPetstore)s).LoginUserAsync(username, password), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.LoginUserAsync(username, password).GetAwaiter().GetResult(); } /// @@ -699,7 +699,7 @@ public static void DeleteOrder(this ISwaggerPetstore operations, string orderId) /// public static void LogoutUser(this ISwaggerPetstore operations) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).LogoutUserAsync(), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.LogoutUserAsync().GetAwaiter().GetResult(); } /// @@ -727,7 +727,7 @@ public static void LogoutUser(this ISwaggerPetstore operations) /// public static User GetUserByName(this ISwaggerPetstore operations, string username) { - return Task.Factory.StartNew(s => ((ISwaggerPetstore)s).GetUserByNameAsync(username), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + return operations.GetUserByNameAsync(username).GetAwaiter().GetResult(); } /// @@ -767,7 +767,7 @@ public static User GetUserByName(this ISwaggerPetstore operations, string userna /// public static void UpdateUser(this ISwaggerPetstore operations, string username, User body = default(User)) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).UpdateUserAsync(username, body), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.UpdateUserAsync(username, body).GetAwaiter().GetResult(); } /// @@ -807,7 +807,7 @@ public static User GetUserByName(this ISwaggerPetstore operations, string userna /// public static void DeleteUser(this ISwaggerPetstore operations, string username) { - Task.Factory.StartNew(s => ((ISwaggerPetstore)s).DeleteUserAsync(username), operations, CancellationToken.None, TaskCreationOptions.None, TaskScheduler.Default).Unwrap().GetAwaiter().GetResult(); + operations.DeleteUserAsync(username).GetAwaiter().GetResult(); } /// diff --git a/Samples/petstore/Python/swaggerpetstore/models/order.py b/Samples/petstore/Python/swaggerpetstore/models/order.py index 571eba2aeb..b9553ca742 100644 --- a/Samples/petstore/Python/swaggerpetstore/models/order.py +++ b/Samples/petstore/Python/swaggerpetstore/models/order.py @@ -21,7 +21,7 @@ class Order(Model): :type ship_date: datetime :param status: Order Status. Possible values include: 'placed', 'approved', 'delivered' - :type status: str + :type status: str or :class:`enum ` :param complete: :type complete: bool """ diff --git a/Samples/petstore/Python/swaggerpetstore/models/pet.py b/Samples/petstore/Python/swaggerpetstore/models/pet.py index c7870da53c..a5715e5d70 100644 --- a/Samples/petstore/Python/swaggerpetstore/models/pet.py +++ b/Samples/petstore/Python/swaggerpetstore/models/pet.py @@ -23,7 +23,7 @@ class Pet(Model): :type tags: list of :class:`Tag ` :param status: pet status in the store. Possible values include: 'available', 'pending', 'sold' - :type status: str + :type status: str or :class:`enum ` """ _validation = { diff --git a/Samples/petstore/Ruby/generated/petstore/models/order.rb b/Samples/petstore/Ruby/generated/petstore/models/order.rb index 0ce8839621..480f4b1470 100644 --- a/Samples/petstore/Ruby/generated/petstore/models/order.rb +++ b/Samples/petstore/Ruby/generated/petstore/models/order.rb @@ -19,8 +19,8 @@ class Order # @return [DateTime] attr_accessor :ship_date - # @return Order Status. Possible values include: 'placed', 'approved', - # 'delivered' + # @return [Enum] Order Status. Possible values include: 'placed', + # 'approved', 'delivered' attr_accessor :status # @return [Boolean] diff --git a/Samples/petstore/Ruby/generated/petstore/models/pet.rb b/Samples/petstore/Ruby/generated/petstore/models/pet.rb index 0f85a980a4..8a74ae741e 100644 --- a/Samples/petstore/Ruby/generated/petstore/models/pet.rb +++ b/Samples/petstore/Ruby/generated/petstore/models/pet.rb @@ -24,8 +24,8 @@ class Pet # @return [Array] attr_accessor :tags - # @return pet status in the store. Possible values include: 'available', - # 'pending', 'sold' + # @return [Enum] pet status in the store. Possible values include: + # 'available', 'pending', 'sold' attr_accessor :status diff --git a/Samples/petstore/Ruby/generated/petstore/swagger_petstore.rb b/Samples/petstore/Ruby/generated/petstore/swagger_petstore.rb index b3e8b21deb..41ab53b155 100644 --- a/Samples/petstore/Ruby/generated/petstore/swagger_petstore.rb +++ b/Samples/petstore/Ruby/generated/petstore/swagger_petstore.rb @@ -16,12 +16,11 @@ class SwaggerPetstore < MsRest::ServiceClient # @param base_url [String] the base URI of the service. # @param options [Array] filters to be applied to the HTTP requests. # - def initialize(credentials, base_url = nil, options = nil) + def initialize(credentials = nil, base_url = nil, options = nil) super(credentials, options) @base_url = base_url || 'http://petstore.swagger.io/v2' - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) + fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? @credentials = credentials add_telemetry diff --git a/src/generator/AutoRest.Ruby/Templates/ServiceClientTemplate.cshtml b/src/generator/AutoRest.Ruby/Templates/ServiceClientTemplate.cshtml index a35e6bdeae..ddcf1678ae 100644 --- a/src/generator/AutoRest.Ruby/Templates/ServiceClientTemplate.cshtml +++ b/src/generator/AutoRest.Ruby/Templates/ServiceClientTemplate.cshtml @@ -47,11 +47,11 @@ module @Settings.Namespace # @if (!Model.IsCustomBaseUri) { - @:def initialize(credentials, base_url = nil, options = nil) + @:def initialize(credentials = nil, base_url = nil, options = nil) } else { - @:def initialize(credentials, options = nil) + @:def initialize(credentials = nil, options = nil) } super(credentials, options) @if (!Model.IsCustomBaseUri) @@ -63,8 +63,7 @@ module @Settings.Namespace @:@@base_url = '@Model.BaseUrl' } @EmptyLine - fail ArgumentError, 'credentials is nil' if credentials.nil? - fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) + fail ArgumentError, 'invalid type of credentials input parameter' unless credentials.is_a?(MsRest::ServiceClientCredentials) unless credentials.nil? @@credentials = credentials @EmptyLine @foreach (var operation in Model.Operations.Where( each => !each.IsCodeModelMethodGroup))