Skip to content

Commit 54ac74b

Browse files
committed
Fix more 500 errors
Correct property for company city Fix HuduAssetLayout
1 parent fbc8187 commit 54ac74b

File tree

2 files changed

+16
-13
lines changed

2 files changed

+16
-13
lines changed

Public/New-HuduAssetLayout.ps1

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,36 +1,36 @@
11
function New-HuduAssetLayout {
22
[CmdletBinding()]
33
# This will silence the warning for variables with Password in their name.
4-
[Diagnostics.CodeAnalysis.SuppressMessageAttribute("PSAvoidUsingPlainTextForPassword", "")]
4+
[Diagnostics.CodeAnalysis.SuppressMessageAttribute('PSAvoidUsingPlainTextForPassword', '')]
55
Param (
66
[Parameter(Mandatory = $true)]
77
[String]$Name,
88
[Parameter(Mandatory = $true)]
99
[String]$Icon,
1010
[Parameter(Mandatory = $true)]
1111
[String]$Color,
12-
[Alias("icon_color")]
12+
[Alias('icon_color')]
1313
[Parameter(Mandatory = $true)]
1414
[String]$IconColor,
15-
[Alias("include_passwords")]
15+
[Alias('include_passwords')]
1616
[bool]$IncludePasswords = '',
17-
[Alias("include_photos")]
17+
[Alias('include_photos')]
1818
[bool]$IncludePhotos = '',
19-
[Alias("include_comments")]
19+
[Alias('include_comments')]
2020
[bool]$IncludeComments = '',
21-
[Alias("include_files")]
21+
[Alias('include_files')]
2222
[bool]$IncludeFiles = '',
23-
[Alias("password_types")]
23+
[Alias('password_types')]
2424
[String]$PasswordTypes = '',
2525
[Parameter(Mandatory = $true)]
26-
[array]$Fields,
26+
[system.collections.generic.list[hashtable]]$Fields,
2727
[bool]$Active = $true
2828
)
2929

3030
foreach ($field in $fields) {
31-
$field.show_in_list = [System.Convert]::ToBoolean($field.show_in_list)
32-
$field.required = [System.Convert]::ToBoolean($field.required)
33-
$field.expiration = [System.Convert]::ToBoolean($field.expiration)
31+
if ($field.show_in_list) { $field.show_in_list = [System.Convert]::ToBoolean($field.show_in_list) } else { $field.remove('show_in_list') }
32+
if ($field.required) { $field.required = [System.Convert]::ToBoolean($field.required) } else { $field.remove('required') }
33+
if ($field.expiration) { $field.expiration = [System.Convert]::ToBoolean($field.expiration) } else { $field.remove('expiration') }
3434
}
3535

3636
$AssetLayout = [ordered]@{asset_layout = [ordered]@{} }
@@ -66,7 +66,9 @@ function New-HuduAssetLayout {
6666

6767
$JSON = $AssetLayout | ConvertTo-Json -Depth 10
6868

69-
$Response = Invoke-HuduRequest -Method post -Resource "/api/v1/asset_layouts" -body $JSON
69+
Write-Verbose $JSON
70+
71+
$Response = Invoke-HuduRequest -Method post -Resource '/api/v1/asset_layouts' -Body $JSON
7072

7173
$Response
7274
}

Public/New-HuduCompany.ps1

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ function New-HuduCompany {
3131
if (-not ([string]::IsNullOrEmpty($Nickname))) { $Company.company.add('nickname', $Nickname) }
3232
if (-not ([string]::IsNullOrEmpty($AddressLine1))) { $Company.company.add('address_line_1', $AddressLine1) }
3333
if (-not ([string]::IsNullOrEmpty($AddressLine2))) { $Company.company.add('address_line_2', $AddressLine2) }
34-
if (-not ([string]::IsNullOrEmpty($City))) { $Company.company.add('city', $AddressLine1) }
34+
if (-not ([string]::IsNullOrEmpty($City))) { $Company.company.add('city', $City) }
3535
if (-not ([string]::IsNullOrEmpty($State))) { $Company.company.add('state', $State) }
3636
if (-not ([string]::IsNullOrEmpty($Zip))) { $Company.company.add('zip', $Zip) }
3737
if (-not ([string]::IsNullOrEmpty($CountryName))) { $Company.company.add('country_name', $CountryName) }
@@ -42,6 +42,7 @@ function New-HuduCompany {
4242
if (-not ([string]::IsNullOrEmpty($Notes))) { $Company.company.add('notes', $Notes) }
4343

4444
$JSON = $Company | ConvertTo-Json -Depth 10
45+
Write-Verbose $JSON
4546

4647
$Response = Invoke-HuduRequest -Method post -Resource '/api/v1/companies' -Body $JSON
4748

0 commit comments

Comments
 (0)