Skip to content

Commit

Permalink
added IncludeDSTRules to Find-BingTimeZone
Browse files Browse the repository at this point in the history
  • Loading branch information
techthoughts2 committed Dec 17, 2023
1 parent fb07b20 commit 42652d3
Show file tree
Hide file tree
Showing 11 changed files with 151 additions and 38 deletions.
4 changes: 3 additions & 1 deletion docs/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [0.7.1]
## [0.7.3]

- Module Changes
- `Find-BingTimeZone`
- Added new parameter for pulling more details DST details: `$IncludeDSTRules`
- Updated help for all functions
- Minor spelling corrections on output messages
- Build Updates
Expand Down
20 changes: 18 additions & 2 deletions docs/Find-BingTimeZone.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ Retrieves time zone information for a specific location on Earth.
### textquery
```
Find-BingTimeZone -Query <String> [-RegionBias <ccTLD>] [-Language <languages>] -BingMapsAPIKey <String>
[<CommonParameters>]
[-IncludeDSTRules] [<CommonParameters>]
```

### Point
```
Find-BingTimeZone -PointLatitude <String> -PointLongitude <String> [-RegionBias <ccTLD>]
[-Language <languages>] -BingMapsAPIKey <String> [<CommonParameters>]
[-Language <languages>] -BingMapsAPIKey <String> [-IncludeDSTRules] [<CommonParameters>]
```

## DESCRIPTION
Expand Down Expand Up @@ -143,6 +143,22 @@ Accept pipeline input: False
Accept wildcard characters: False
```
### -IncludeDSTRules
Include Daylight Saving Time (DST) rules in the search results.
Returns additional information about the DST observance and rules applicable to the places found in the search.
```yaml
Type: SwitchParameter
Parameter Sets: (All)
Aliases:

Required: False
Position: Named
Default value: False
Accept pipeline input: False
Accept wildcard characters: False
```
### CommonParameters
This cmdlet supports the common parameters: -Debug, -ErrorAction, -ErrorVariable, -InformationAction, -InformationVariable, -OutVariable, -OutBuffer, -PipelineVariable, -Verbose, -WarningAction, and -WarningVariable.
For more information, see about_CommonParameters (http://go.microsoft.com/fwlink/?LinkID=113216).
Expand Down
30 changes: 15 additions & 15 deletions docs/Search-BingNearbyPlace.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ schema: 2.0.0
# Search-BingNearbyPlace

## SYNOPSIS
Nearby Search lets you search for different place types within a specified area.
Nearby Search lets you search for places of interest within a specified area using Bing Maps API.

## SYNTAX

Expand Down Expand Up @@ -40,10 +40,13 @@ Search-BingNearbyPlace [-Type <typeIdentifier>] [-PointLatitude <String>] [-Poin
```

## DESCRIPTION
Performs a nearby search request with provided parameters.
Nearby search is useful for finding place types near a specific geographic location.
By default the location bias is IP based.
Location bias can be controlled via parameters.
The Search-BingNearbyPlace function conducts a nearby search for various place types, such as attractions,
restaurants, or parks, within a specified geographic area.
Users can define the search area using coordinates,
radius, or a rectangular area.
By default, search results are biased based on the user's IP location,
but this can be customized using various geographic parameters.
Location bias and language can also be controlled via parameters.

## EXAMPLES

Expand All @@ -52,44 +55,42 @@ Location bias can be controlled via parameters.
Search-BingNearbyPlace -Type Attractions -BingMapsAPIKey $bingAPIKey
```

Performs a nearby search biased by IP and returns Attraction places types.
Searches for attractions near the user's IP location.

### EXAMPLE 2
```
Search-BingNearbyPlace -Type Restaurants -MaxResults 20 -BingMapsAPIKey $bingAPIKey
```

Performs a nearby search biased by IP and returns Restaurant places types with a maximum of 20 results returned.
Finds up to 20 restaurants near the user's IP location.

### EXAMPLE 3
```
Search-BingNearbyPlace -Type CafeRestaurants -PointLatitude '29.7049806' -PointLongitude '-98.068343' -BingMapsAPIKey $bingAPIKey
```

Performs a nearby search near the provided Lat/Long and returns CafeRestaurant places types.
Searches for cafe restaurants near the specified coordinates.

### EXAMPLE 4
```
Search-BingNearbyPlace -Type BreweriesAndBrewPubs -CircleLatitude '29.7049806' -CircleLongitude '-98.068343' -CircleRadius '5000' -BingMapsAPIKey $bingAPIKey
```

Performs a nearby search biased by circle lat/long/radius and returns Bars and Pubs places types.
Searches for breweries and brewpubs within a 5000-meter radius of the specified circle coordinates.

### EXAMPLE 5
```
Search-BingNearbyPlace -Type Parks -SouthLatitude '39.8592387' -WestLongitude '-75.295486' -NorthLatitude '40.0381942' -EastLongitude '-75.0064087' -BingMapsAPIKey $bingAPIKey
```

Performs a nearby search biased by rectangular two lat/lng pairs in decimal degrees, representing the south/west and north/east points of a rectangle.
Park places types are returned.
Searches for parks within a rectangular area defined by two sets of latitude and longitude coordinates.

### EXAMPLE 6
```
Search-BingNearbyPlace -Type Museums -PointLatitude '29.7049806' -PointLongitude '-98.068343' -Language en -MaxResults 20 -BingMapsAPIKey $bingAPIKey
```

Performs a nearby search near the provided Lat/Long and returns Museum places types.
Results are returned in English with a maximum of 20 results returned.
Finds up to 20 museums near the specified coordinates, with results in English.

### EXAMPLE 7
```
Expand All @@ -104,8 +105,7 @@ $searchBingNearbyPlaceSplat = @{
Search-BingNearbyPlace @searchBingNearbyPlaceSplat
```

Performs a nearby search near the provided Lat/Long and returns Museum places types.
Results are returned in English with a maximum of 20 results returned.
Finds up to 20 museums near the specified coordinates, with results in English.

## PARAMETERS

Expand Down
4 changes: 2 additions & 2 deletions docs/pwshPlaces.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Module Name: pwshPlaces
Module Guid: 9a9914bd-d115-4f42-bb5d-19c5e5561a3f
Download Help Link: NA
Help Version: 0.7.1
Help Version: 0.7.3
Locale: en-US
---

Expand Down Expand Up @@ -30,7 +30,7 @@ Converts addresses to geographic coordinates and vice versa using Bing Maps API.
Engages Geocoding API to return address and geographic coordinates based on provided query parameters.

### [Search-BingNearbyPlace](Search-BingNearbyPlace.md)
Nearby Search lets you search for different place types within a specified area.
Nearby Search lets you search for places of interest within a specified area using Bing Maps API.

### [Search-GMapNearbyPlace](Search-GMapNearbyPlace.md)
Nearby Search lets you search for places within a specified area. You can refine your search request by supplying keywords, type of place you are searching for and other parameters.
Expand Down
52 changes: 46 additions & 6 deletions src/Tests/Integration/pwshPlaces-Infra.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ $PathToManifest = [System.IO.Path]::Combine('..', '..', 'Artifacts', "$ModuleNam
#-------------------------------------------------------------------------
Import-Module $PathToManifest -Force
#-------------------------------------------------------------------------
Describe 'Infrastructure Tests' -Tag Infrastructure {
Describe 'Integration Tests' -Tag Infrastructure {
# for local dev testing only
# BeforeEach {
# $env:GoogleAPIKey = ''
Expand All @@ -18,6 +18,7 @@ Describe 'Infrastructure Tests' -Tag Infrastructure {
Context 'Google Maps Function Tests' {

Context 'Find-GMapPlace' {

It 'should return the expected results' {
$findGMapPlaceSplat = @{
Query = '+18306252807'
Expand All @@ -35,9 +36,11 @@ Describe 'Infrastructure Tests' -Tag Infrastructure {
$eval.rating | Should -Not -BeNullOrEmpty
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

} #context_Find-GMapPlace

Context 'Get-GMapPlaceDetail' {

It 'should return the expected results' {
$getGMapPlaceDetailsSplat = @{
PlaceID = 'ChIJf9Yxhme9XIYRkXo-Bl62Q10'
Expand All @@ -61,9 +64,11 @@ Describe 'Infrastructure Tests' -Tag Infrastructure {
$eval.Longitude | Should -Not -BeNullOrEmpty
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

} #context_Get-GMapPlaceDetails

Context 'Invoke-GMapGeoCode' {

It 'should return the expected results for lat long lookup' {
$invokeGMapGeoCodeSplat = @{
Address = '148 S Castell Ave, New Braunfels, TX 78130, USA'
Expand All @@ -73,6 +78,7 @@ Describe 'Infrastructure Tests' -Tag Infrastructure {
($eval.place_id | Measure-Object).Count | Should -BeGreaterOrEqual 1
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

It 'should return the expected results for reverse geocoding' {
$invokeGMapGeoCodeSplat = @{
Latitude = '29.7012853'
Expand All @@ -83,6 +89,7 @@ Describe 'Infrastructure Tests' -Tag Infrastructure {
($eval.place_id | Measure-Object).Count | Should -BeGreaterOrEqual 1
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

It 'should return expected results for place lookup' {
$invokeGMapGeoCodeSplat = @{
PlaceID = 'ChIJf9Yxhme9XIYRkXo-Bl62Q10'
Expand All @@ -95,9 +102,11 @@ Describe 'Infrastructure Tests' -Tag Infrastructure {
$eval.Longitude | Should -Not -BeNullOrEmpty
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

} #context_Invoke-GMapGeoCode

Context 'Search-GMapNearbyPlace' {

It 'should return the expected results' {
$searchGMapNearbyPlaceSplat = @{
Latitude = '29.7049806'
Expand All @@ -116,9 +125,11 @@ Describe 'Infrastructure Tests' -Tag Infrastructure {
($eval.place_id | Measure-Object).Count | Should -BeGreaterOrEqual 2
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

} #context_Search-GMapNearbyPlace

Context 'Search-GMapText' {

It 'should return the expected results' {
$searchGMapTextSplat = @{
Query = 'Coco'
Expand All @@ -134,13 +145,16 @@ Describe 'Infrastructure Tests' -Tag Infrastructure {
}
$eval = Search-GMapText @searchGMapTextSplat
($eval.place_id | Measure-Object).Count | Should -BeGreaterOrEqual 8
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

} #context_Search-GMapText
} #context_GoogleMaps

Context 'Bing Maps Function Tests' {

Context 'Invoke-BingGeoCode' {

It 'should return the expected results for lat long lookup' {
$invokeBingGeoCodeSplat = @{
AddressLine = '148 S Castell Ave'
Expand All @@ -153,6 +167,7 @@ Describe 'Infrastructure Tests' -Tag Infrastructure {
($eval.name | Measure-Object).Count | Should -BeGreaterOrEqual 1
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

It 'should return the expected results for reverse geocoding' {
$invokeBingGeoCodeSplat = @{
Latitude = '29.7030'
Expand All @@ -163,9 +178,11 @@ Describe 'Infrastructure Tests' -Tag Infrastructure {
($eval.name | Measure-Object).Count | Should -BeGreaterOrEqual 1
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

} #context_Invoke-GMapGeoCode

Context 'Find-BingPlace' {

It 'should return the expected results' {
$findBingPlaceSplat = @{
Query = 'cafe'
Expand All @@ -179,9 +196,11 @@ Describe 'Infrastructure Tests' -Tag Infrastructure {
($eval.name | Measure-Object).Count | Should -BeGreaterOrEqual 1
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

} #context_Find-BingPlace

Context 'Search-BingNearbyPlace' {

It 'should return the expected results' {
$searchBingNearbyPlaceSplat = @{
Type = 'Museums'
Expand All @@ -195,21 +214,42 @@ Describe 'Infrastructure Tests' -Tag Infrastructure {
($eval.name | Measure-Object).Count | Should -BeGreaterOrEqual 1
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

} #context_Find-BingPlace

Context 'Find-BingTimeZone' {
It 'should return the expected results' {

It 'should return the expected results for queries' {
$findBingTimeZoneSplat = @{
PointLatitude = '29.70'
PointLongitude = '-98.11'
BingMapsAPIKey = $env:BingAPIKey
Query = 'New Braunfels, TX'
BingMapsAPIKey = $env:BingAPIKey
IncludeDSTRules = $true
}
$eval = Find-BingTimeZone @findBingTimeZoneSplat
$eval.TimeZoneName | Should -BeExactly 'Central Standard Time'
$eval.TimeZoneShort | Should -BeExactly 'CST'
$eval.dstRule.dstStartMonth | Should -BeExactly 'Mar'
$eval.dstRule.dstEndMonth | Should -BeExactly 'Nov'
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

It 'should return the expected results for point' {
$findBingTimeZoneSplat = @{
PointLatitude = '29.70'
PointLongitude = '-98.11'
BingMapsAPIKey = $env:BingAPIKey
IncludeDSTRules = $true
}
$eval = Find-BingTimeZone @findBingTimeZoneSplat
$eval.TimeZoneName | Should -BeExactly 'Central Standard Time'
$eval.TimeZoneShort | Should -BeExactly 'CST'
$eval.dstRule.dstStartMonth | Should -BeExactly 'Mar'
$eval.dstRule.dstEndMonth | Should -BeExactly 'Nov'
Start-Sleep -Milliseconds (Get-Random -Minimum 250 -Maximum 1000)
} #it

} #context_Find-BingPlace

} #context_BingMaps
} #describe_infra_tests

} #describe_integration_tests
4 changes: 4 additions & 0 deletions src/Tests/Unit/Private/Format-BingTimeZone.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ InModuleScope 'pwshPlaces' {
$eval.TimeZoneCurrentName | Should -BeExactly 'Central Daylight Time'
$eval.TimeZoneCurrentShort | Should -BeExactly 'CDT'
$eval.UTCOffSetDST | Should -BeExactly '-5:00'
$eval.dstRule.dstStartMonth | Should -BeExactly 'Mar'
$eval.dstRule.dstEndMonth | Should -BeExactly 'Nov'
} #it

It 'should return the expected results for point' {
Expand All @@ -48,6 +50,8 @@ InModuleScope 'pwshPlaces' {
$eval.TimeZoneCurrentName | Should -BeExactly 'Central Daylight Time'
$eval.TimeZoneCurrentShort | Should -BeExactly 'CDT'
$eval.UTCOffSetDST | Should -BeExactly '-5:00'
$eval.dstRule.dstStartMonth | Should -BeExactly 'Mar'
$eval.dstRule.dstEndMonth | Should -BeExactly 'Nov'
} #it

} #context_Success
Expand Down
Loading

0 comments on commit 42652d3

Please sign in to comment.