From d74644ae1639c054b8f341787b4d130cb9c33f17 Mon Sep 17 00:00:00 2001 From: Stephen Maunder Date: Mon, 20 Nov 2017 09:15:11 +0000 Subject: [PATCH] Change Method to be more specific --- ...{Invoke-Method.ps1 => Invoke-SnipeitMethod.ps1} | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) rename SnipeitPS/Private/{Invoke-Method.ps1 => Invoke-SnipeitMethod.ps1} (96%) diff --git a/SnipeitPS/Private/Invoke-Method.ps1 b/SnipeitPS/Private/Invoke-SnipeitMethod.ps1 similarity index 96% rename from SnipeitPS/Private/Invoke-Method.ps1 rename to SnipeitPS/Private/Invoke-SnipeitMethod.ps1 index a5188a4..f340fa6 100644 --- a/SnipeitPS/Private/Invoke-Method.ps1 +++ b/SnipeitPS/Private/Invoke-SnipeitMethod.ps1 @@ -1,4 +1,4 @@ -function Invoke-Method { +function Invoke-SnipeitMethod { <# .SYNOPSIS Extracted invokation of the REST method to own function. @@ -42,7 +42,7 @@ } Process { - if ($GetParameters -and ($URi -notlike "*\?*")) + if ($GetParameters -and ($URi -notlike "*\?*")) { Write-Debug "Using `$GetParameters: $($GetParameters | Out-String)" [string]$URI += (ConvertTo-GetParameter $GetParameters) @@ -86,7 +86,7 @@ # API returned a Content: lets work wit it $response = ConvertFrom-Json -InputObject $webResponse.Content - + if ($response.status -eq "error") { Write-Verbose "[$($MyInvocation.MyCommand.Name)] An error response was received from; resolving" # This could be handled nicely in an function such as: @@ -95,14 +95,14 @@ } else { $result = $response - if (($response) -and ($response | Get-Member -Name payload)) + if (($response) -and ($response | Get-Member -Name payload)) { $result = $response.payload } elseif (($response) -and ($response | Get-Member -Name rows)) { $result = $response.rows } - + $result } } @@ -111,7 +111,7 @@ # This could be wanted behavior of the API Write-Verbose "[$($MyInvocation.MyCommand.Name)] No content was returned from." } - + } else { Write-Verbose "[$($MyInvocation.MyCommand.Name)] No Web result object was returned from. This is unusual!" @@ -121,4 +121,4 @@ END { Write-Verbose "[$($MyInvocation.MyCommand.Name)] Function ended" } -} \ No newline at end of file +}