Scripts/Get-CoinbaseStatus.ps1


Function Get-CoinbaseStatus {

    <#
 
    .SYNOPSIS
 
    Get communications about any issues with Coinbase products including planned and unplanned outages
 
    .DESCRIPTION
 
    Get communications about any issues with Coinbase products including planned and unplanned outages
 
    .PARAMETER Online (optional)
 
    Open Coinbase Status webpage
 
    .EXAMPLE
 
    Get-CoinbbaseStatus
 
    .EXAMPLE
 
    Get-CoinbbaseStatus -Online
 
    .NOTES
 
    N/A
 
    .LINK
 
    N/A
 
    #>


    [CmdletBinding ()]

    Param (

        [Switch]$Online

    )

    BEGIN {

        Function Show-Output ($Values) {

            [PSCustomObject]@{

                Issue = $Values[0]
                Date = $Values[1]
                Status = $Values[2]

            }

        }

    }


    PROCESS {

        Try {

            If ($Online) {

                Start-Process -FilePath 'https://status.coinbase.com'

            }

            Else {

                $Results = Invoke-RestMethod -Uri 'https://status.coinbase.com/history.rss'

                ForEach ($Item In $Results) {

                    Show-Output ($Item.Title, $Item.PubDate, 'Ok')

                }

            }

        }

        Catch {

            Show-Output ('', '', $PSItem.Exception.Message)

        }

    }

    END {}

}