Public/New-ObservationScalars.ps1

<#
    .SYNOPSIS
    Creates an object that contains the observation and all the scalars
 
    .DESCRIPTION
    Creates the message body in hashtable form to send to the eCC Salesforce API to accept measurements
 
    .INPUTS
    None. You cannot pipe objects to New-ObservationScalars.
 
    .OUTPUTS
    The message in hashtable format
 
    .PARAMETER Observation
    The observation hashtable from New-Observation
 
    .PARAMETER Scalars
    An array of scalars from New-Scalar
 
    .LINK
    New-Observation
    New-Scalar
#>

function New-ObservationScalars {
    param($Observation, $Scalars)
    $post = @{}
    $post.body = @{ "observation" = $Observation }
    $i = 1
    $Scalars | ForEach-Object { $post.body."scalar-$($i)" = $_; $i++ } | Out-Null
    $post
}