google_place_reviews 0.0.1 → 0.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/google_place_reviews.rb +8 -8
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: d045f109852ec010b06279f927b12fddca479b4abba71e982ae01f0506c09f27
|
|
4
|
+
data.tar.gz: ddca1682053303cc264bde177223cfc3a1f139aa7bbf14481247b4b68287766d
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 1eb98e2b3fa3e8fadabd33c16ee38ab56b9f5c7044dcdcb53016e154e13602bfa666ebe721e79a6b5cd7dfcfa15a7918da133cc6ee1eca277a5955921b8bab3f
|
|
7
|
+
data.tar.gz: d700fc35f4e525c509799d2db5d33ee67f68d09cced607b2a83b81646d32d7e5ee35b4ae2df1499ef3d096258f8d1694739e19e1e223af1f02734a2e99ca8e59
|
data/lib/google_place_reviews.rb
CHANGED
|
@@ -3,11 +3,11 @@ require 'json'
|
|
|
3
3
|
module GooglePlaceReviews
|
|
4
4
|
|
|
5
5
|
def self.geocode(shopname,address)
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
6
|
+
url = 'https://maps.googleapis.com/maps/api/geocode/json?address='
|
|
7
|
+
resp = RestClient.get "#{url}#{shopname}#{address}&key=#{Rails.application.credentials.google_maps_api_key}"
|
|
8
|
+
if JSON.parse(resp.body)["status"] == "OK"
|
|
9
|
+
JSON.parse(resp.body)["results"][0]["place_id"]
|
|
10
|
+
end
|
|
11
11
|
end
|
|
12
12
|
|
|
13
13
|
def self.getReviewsByPlaceId(place_id)
|
|
@@ -23,11 +23,11 @@ def self.getReviewsByPlaceId(place_id)
|
|
|
23
23
|
review.push(:author_name => result[i]["author_name"],:rating => result[i]["rating"],:text => result[i]["text"] )
|
|
24
24
|
end
|
|
25
25
|
end
|
|
26
|
-
#Return nil if "status" : "INVALID_REQUEST" or "result" : {}
|
|
26
|
+
#Return [nil,nil] if "status" : "INVALID_REQUEST" or "result" : {}
|
|
27
27
|
return result,review
|
|
28
28
|
end
|
|
29
29
|
|
|
30
|
-
def getOpenHoursPlaceId(place_id)
|
|
30
|
+
def self.getOpenHoursPlaceId(place_id)
|
|
31
31
|
url = 'https://maps.googleapis.com/maps/api/place/details/json?place_id='
|
|
32
32
|
resp = RestClient.get "#{url}#{place_id}&fields=opening_hours&key=#{Rails.application.credentials.google_maps_api_key}"
|
|
33
33
|
if JSON.parse(resp.body)["status"] == "OK"
|
|
@@ -48,7 +48,7 @@ def getOpenHoursPlaceId(place_id)
|
|
|
48
48
|
|
|
49
49
|
end
|
|
50
50
|
|
|
51
|
-
def getRatingReviewRatTotal(place_id)
|
|
51
|
+
def self.getRatingReviewRatTotal(place_id)
|
|
52
52
|
url = 'https://maps.googleapis.com/maps/api/place/details/json?place_id='
|
|
53
53
|
resp = RestClient.get "#{url}#{place_id}&fields=rating,review,user_ratings_total&key=#{Rails.application.credentials.google_maps_api_key}"
|
|
54
54
|
if JSON.parse(resp.body)["status"] == "OK"
|
metadata
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: google_place_reviews
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
version: 0.0.
|
|
4
|
+
version: 0.0.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Marcio Camargo
|
|
@@ -35,7 +35,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
|
35
35
|
- !ruby/object:Gem::Version
|
|
36
36
|
version: '0'
|
|
37
37
|
requirements: []
|
|
38
|
-
rubygems_version: 3.0.
|
|
38
|
+
rubygems_version: 3.0.6
|
|
39
39
|
signing_key:
|
|
40
40
|
specification_version: 4
|
|
41
41
|
summary: Fetch reviews from Google Place
|