Class: Google::InternalGoogleApi
- Inherits:
-
Object
- Object
- Google::InternalGoogleApi
- Defined in:
- lib/Time_Traveler/google_api_inter.rb
Overview
Service for all Google API calls
Constant Summary collapse
- Google_URL =
Setting the URL and parameters
'https://maps.googleapis.com/maps/api/'
- Search_Type =
'place/textsearch'
- Return_Type =
'json'
- Google_API_URL =
URI.join(Google_URL, "#{Search_Type}/", "#{Return_Type}")
Instance Attribute Summary collapse
-
#google_data ⇒ Object
readonly
Search_URL = URI.join(Google_API_URL, “#Parms”) maps.googleapis.com/maps/api/place/textsearch/xml?query=清華大學&key=AIzaSyADFcZbph8b9jvV5D9zgrlOm2oMQpv6krI.
Class Method Summary collapse
Instance Attribute Details
#google_data ⇒ Object (readonly)
Search_URL = URI.join(Google_API_URL, “#Parms”) maps.googleapis.com/maps/api/place/textsearch/xml?query=清華大學&key=AIzaSyADFcZbph8b9jvV5D9zgrlOm2oMQpv6krI
13 14 15 |
# File 'lib/Time_Traveler/google_api_inter.rb', line 13 def google_data @google_data end |
Class Method Details
.config ⇒ Object
19 20 21 22 |
# File 'lib/Time_Traveler/google_api_inter.rb', line 19 def self.config return @config if @config @config = { googlemap_id: ENV['GOOGLE_API'] } end |
.config=(credentials) ⇒ Object
15 16 17 |
# File 'lib/Time_Traveler/google_api_inter.rb', line 15 def self.config=(credentials) @config ? @config.update(credentials) : @config = credentials end |
.this_rating(station) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/Time_Traveler/google_api_inter.rb', line 24 def self.(station) return @this_rating if @this_rating = HTTP.get(Google_API_URL, params: { key: 'AIzaSyADFcZbph8b9jvV5D9zgrlOm2oMQpv6krI', query: station }) print = JSON.load(.to_s)['results'] end |