Merge pull request #2 from snazy2000/develop

Changes to fix changes in newer build
This commit is contained in:
Stephen 2017-12-29 14:49:46 +00:00 committed by GitHub
commit 51a49cbae0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 3 deletions

View file

@ -62,12 +62,16 @@ function New-Asset()
) )
$Values = @{ $Values = @{
"asset_tag" = $tag
"name" = $Name "name" = $Name
"status_id" = $status_id "status_id" = $status_id
"model_id" = $model_id "model_id" = $model_id
} }
if ($PSBoundParameters.ContainsKey('tag'))
{
$Values += @{"asset_tag" = $tag}
}
if ($customfields) if ($customfields)
{ {
$Values += $customfields $Values += $customfields

View file

@ -10,7 +10,10 @@ function Set-AssetOwner()
[int]$id, [int]$id,
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
[int]$user_id, [int]$assigned_id,
[ValidateSet("location","asset","user")]
[string] $checkout_to_type = "user",
[parameter(mandatory = $true)] [parameter(mandatory = $true)]
[string]$url, [string]$url,
@ -20,7 +23,15 @@ function Set-AssetOwner()
) )
$Values = @{ $Values = @{
"user_id" = $user_id "id" = $assigned_id
"checkout_to_type" = $checkout_to_type
}
switch ($checkout_to_type)
{
'location' { $Values += @{ "assigned_location" = $assigned_id } }
'user' { $Values += @{ "assigned_user" = $assigned_id } }
'asset' { $Values += @{ "assigned_asset" = $assigned_id } }
} }
$Body = $Values | ConvertTo-Json; $Body = $Values | ConvertTo-Json;