Public/New-Scaler.ps1

<#
    .SYNOPSIS
    Creates an scalar object.

    .DESCRIPTION
    Creates the scalar JSON message in hashtable form to send to the eCC Salesforce API to accept measurements

    .INPUTS
    None. You cannot pipe objects to New-Scalar.

    .OUTPUTS
    None.

    .PARAMETER MetricTypeCode
    The metric type code from the org metrics. See Get-MetricDefinitions

    .PARAMETER UnitTypeCode
    The unit type code from the org metrics. See Get-MetricDefinitions

    .PARAMETER Value
    The value in units specified by UnitTypeCode

    .PARAMETER DateTime
    The date/time of the scalar measurement.
#>

function New-Scalar {
    param([String]$MetricTypeCode, [String]$UnitTypeCode, [String]$Value, [System.DateTime]$DateTime )
    @{
        "attributes" = @{
            "type" = "Scalar__c"
        }
        "Metric_Type_Code__c" = $MetricTypeCode
        "Value__c" = $Value
        "Unit_Type_Code__c" = $UnitTypeCode
        "Observation_Date_Time__c" = $DateTime
        "Observation_Result_Status__c" = "R"
        "Observation_Method__c" = "AMEAS^auto-measurement^MDC"
    }
}