From 6dfac3fc08b1686ba735c6b587251c1d4aaf541a Mon Sep 17 00:00:00 2001 From: Theresa Date: Tue, 16 Aug 2022 15:03:37 +0200 Subject: [PATCH 1/3] feat: add relative_time_description property to PlaceReview --- places.go | 3 +++ 1 file changed, 3 insertions(+) diff --git a/places.go b/places.go index d95db03..3391fd0 100644 --- a/places.go +++ b/places.go @@ -519,6 +519,9 @@ type PlaceReview struct { // Rating the user's overall rating for this place. This is a whole number, ranging // from 1 to 5. Rating int `json:"rating,omitempty"` + // RelativeTimeDescription the time that the review was submitted in text, relative + // to the current time. + RelativeTimeDescription string `json:"relative_time_description,omitempty"` // Text is the user's review. When reviewing a location with Google Places, text // reviews are considered optional. Therefore, this field may by empty. Note that // this field may include simple HTML markup. From ba70421b3e0334c33ae356fd962b0831431d65c4 Mon Sep 17 00:00:00 2001 From: Theresa Date: Tue, 16 Aug 2022 15:03:50 +0200 Subject: [PATCH 2/3] add relativeTimeDescription to TestPlaceDetails --- places_test.go | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/places_test.go b/places_test.go index 3118651..3a9d807 100644 --- a/places_test.go +++ b/places_test.go @@ -709,6 +709,7 @@ func TestPlaceDetails(t *testing.T) { "author_url" : "https://plus.google.com/114299517944848975298", "language" : "en", "rating" : 3, + "relative_time_description" : "10 months ago", "text" : "Overall disappointing. This is the second time i've been there and my experience was... Nothing to nibble on for 45 mins and then the bread came. My first entree was the marron which I thought was tasteless - perhaps others would say delicate? but there you go. The XO sea was fantastic. I chose the vegetarian main dish which was all about the texture which was great but nothing at all outstanding about the dish. My husband and daughter chose the duck for their main course it was the smallest main course i've ever seen - their faces were priceless when it arrived!. Snow egg was beautiful but the granita on the bottom had some solid chunks of hard ice. The service was quite good...", "time" : 1441848853 } @@ -813,6 +814,11 @@ func TestPlaceDetails(t *testing.T) { t.Errorf("expected %+v, was %+v", rating, resp.Reviews[0].Rating) } + relativeTimeDescription := "10 months ago" + if relativeTimeDescription != resp.Reviews[0].RelativeTimeDescription { + t.Errorf("expected %+v, was %+v", relativeTimeDescription, resp.Reviews[0].RelativeTimeDescription) + } + text := "Overall disappointing. This is the second time i've been there and my experience was... Nothing to nibble on for 45 mins and then the bread came. My first entree was the marron which I thought was tasteless - perhaps others would say delicate? but there you go. The XO sea was fantastic. I chose the vegetarian main dish which was all about the texture which was great but nothing at all outstanding about the dish. My husband and daughter chose the duck for their main course it was the smallest main course i've ever seen - their faces were priceless when it arrived!. Snow egg was beautiful but the granita on the bottom had some solid chunks of hard ice. The service was quite good..." if text != resp.Reviews[0].Text { t.Errorf("expected %+v, was %+v", text, resp.Reviews[0].Text) From fa7ba5228c6d9932501f38768fd7cd175a72abc2 Mon Sep 17 00:00:00 2001 From: Angela Yu <5506675+wangela@users.noreply.github.com> Date: Fri, 1 Dec 2023 15:40:35 -0800 Subject: [PATCH 3/3] chore: update places_test.go Reverting to simplified test data committed after this PR was created. --- places_test.go | 39 +++++---------------------------------- 1 file changed, 5 insertions(+), 34 deletions(-) diff --git a/places_test.go b/places_test.go index f491716..cd9df28 100644 --- a/places_test.go +++ b/places_test.go @@ -727,7 +727,7 @@ func TestPlaceDetails(t *testing.T) { "Sunday: 12:00 – 8:45 PM" ] }, - "secondary_opening_hours": [ + "secondary_opening_hours": [ { "open_now": true, "periods": [ @@ -784,39 +784,10 @@ func TestPlaceDetails(t *testing.T) { ] } ], - "photo_reference" : "CmRdAAAAm1qTaarpM_sUatFI7JxjwxVTgKCGSjz62q_vHpNMoZDP3PpBHGW-rAHQEEprl_c1MyvXFhvZb2mXj8yhKvnEMsSveb-cMuDaDgS7LS8sPPrMrt5s_Mx0G0ereom3j6KxEhAkaQH1_nWxpl4W2mFZ1CKoGhQV_Jx9MIn0skBS3tRAuIFzgHARww", - "width" : 816 - } - ], - "place_id": "ChIJ4cQcDV2uEmsRMxTEHBIe9ZQ", - "price_level" : 4, - "profile_photo_url": "https://lh3.googleusercontent.com/-EXtIWgDBHgs/AAAAAAAAAAI/AAAAAAAAAAA/AIcfdXCXHH76RsCp2i2B0qjO1WngDfIrQQ/s120-p-rw-no-mo/photo.jpg", - "author_name" : "Rachel Lewis", - "author_url" : "https://plus.google.com/114299517944848975298", - "language" : "en", - "rating" : 3, - "relative_time_description" : "10 months ago", - "text" : "Overall disappointing. This is the second time i've been there and my experience was... Nothing to nibble on for 45 mins and then the bread came. My first entree was the marron which I thought was tasteless - perhaps others would say delicate? but there you go. The XO sea was fantastic. I chose the vegetarian main dish which was all about the texture which was great but nothing at all outstanding about the dish. My husband and daughter chose the duck for their main course it was the smallest main course i've ever seen - their faces were priceless when it arrived!. Snow egg was beautiful but the granita on the bottom had some solid chunks of hard ice. The service was quite good...", - "time" : 1441848853 - } - ], - "rating" : 4.1, - "reviews" : [ - { - "aspects" : [ - { - "rating" : 1, - "type" : "overall" - } - ], - "serves_dinner": true, - "types" : [ "restaurant", "food", "point_of_interest", "establishment" ], - "url" : "https://plus.google.com/105746337161979416551/about?hl=en-US", - "user_ratings_total" : 275, - "utc_offset" : 660, - "vicinity" : "3 Overseas Passenger Terminal, George Street, The Rocks", - "website" : "http://www.quay.com.au/", - "wheelchair_accessible_entrance": true, + "place_id": "ChIJ4cQcDV2uEmsRMxTEHBIe9ZQ", + "serves_dinner": true, + "utc_offset": 660, + "wheelchair_accessible_entrance": true }, "status": "OK" }