googlemaps-services 1.3.5 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9a29bf1ab90463cf58a2920a07ea63a791cf6637
4
- data.tar.gz: 27203036b8394d7f9bb304864f8156fd0c454ded
3
+ metadata.gz: c7ef65d4e04d36a5429f201972fe84cd62ec063d
4
+ data.tar.gz: c2805471af22dd29286cc3bde204a29676860f58
5
5
  SHA512:
6
- metadata.gz: 5cdbce608cb68fe2b5fb418e8f4193f0c8d137f1239ec26efa9c58919e1eac2099b1c2dd261fc4e729f3a096e01d32f93bd55bff66e22404299a500899b91d75
7
- data.tar.gz: 9b6422d246c467abe6d29db91239e4f11abbf48e72c10584ba55e0f54234dc18fb60e8dca44661e6c840f6168f07acdf78254409e27c99294a3bee5494ae698e
6
+ metadata.gz: a5fe169d40fcadc8be9ea7e3d4de6c59f9d3a85ced23e9d28252e756b6f0c7275d66fbf0536e8655a3bac8835a2a194cd23ade000236c8666e9f1f1c837278a3
7
+ data.tar.gz: 913240e8c1c994ee6fd0f1bf37a92596412ff93be5e1b0ac06e85b7244209a6445a2a0dc3ddcfc93df218dce4e047ed052f240344bf57245423d335defd6b0ff
@@ -1,6 +1,6 @@
1
1
  # coding: utf-8
2
+ require 'googlemaps/services/global_constants'
2
3
  require 'googlemaps/services/exceptions'
3
- require 'googlemaps/services/version'
4
4
  require 'googlemaps/services/util'
5
5
  require 'nokogiri'
6
6
  require 'base64'
@@ -18,10 +18,6 @@ module GoogleMaps
18
18
 
19
19
  # Performs requests to the Google Maps API web services.
20
20
  class GoogleClient
21
- USER_AGENT = 'GoogleMapsRubyClient/' + VERSION
22
- DEFAULT_BASE_URL = 'https://maps.googleapis.com'
23
- RETRIABLE_STATUSES = [500, 503, 504]
24
-
25
21
  include GoogleMaps::Services::Exceptions
26
22
 
27
23
  # @return [Symbol] API key. Required, unless "client_id" and "client_secret" are set.
@@ -80,7 +76,7 @@ module GoogleMaps
80
76
  self.client_secret = client_secret
81
77
  self.channel = channel
82
78
  self.retry_timeout = retry_timeout
83
- self.request_headers = request_headers.merge({ 'User-Agent' => USER_AGENT })
79
+ self.request_headers = request_headers.merge({ 'User-Agent' => Constants::USER_AGENT })
84
80
  self.queries_per_second = queries_per_second
85
81
  self.sent_times = Array.new
86
82
 
@@ -90,7 +86,7 @@ module GoogleMaps
90
86
  end
91
87
  end
92
88
 
93
- # Performs HTTP GET requests with credentials, returning the body as JSON or XML.
89
+ # Performs HTTP GET/POST requests with credentials, returning the body as JSON or XML.
94
90
  #
95
91
  # @param [String] url URL path for the request. Should begin with a slash.
96
92
  # @param [Hash] params HTTP GET parameters.
@@ -101,10 +97,11 @@ module GoogleMaps
101
97
  # @param [Proc] extract_body A function that extracts the body from the request. If the request was not successful, the function should raise a
102
98
  # GoogleMaps::Services::Exceptions::HTTPError or GoogleMaps::Services::Exceptions::APIError as appropriate.
103
99
  # @param [Hash] request_headers HTTP headers per request.
100
+ # @param [Hash] post_json The request body which will be formatted as JSON.
104
101
  #
105
102
  # @return [Hash, Array, nil] response body (either in JSON or XML) or nil.
106
- def get(url:, params:, first_request_time: nil, retry_counter: nil, base_url: DEFAULT_BASE_URL,
107
- accepts_clientid: true, extract_body: nil, request_headers: nil)
103
+ def request(url:, params:, first_request_time: nil, retry_counter: nil, base_url: Constants::DEFAULT_BASE_URL,
104
+ accepts_clientid: true, extract_body: nil, request_headers: nil, post_json: nil)
108
105
  first_request_time = Util.current_time unless first_request_time
109
106
 
110
107
  elapsed = Time.now - first_request_time
@@ -130,14 +127,16 @@ module GoogleMaps
130
127
  # Construct the Request URI
131
128
  uri = HTTP::URI.parse(base_url + authed_url)
132
129
 
133
- # Create the request, add the headers and make the GET request
134
- resp = HTTP.headers(request_headers)
135
- .timeout(:write => self.write_timeout, :connect => self.connect_timeout, :read => self.read_timeout)
136
- .get(uri.to_s)
130
+ # Create the request, add the headers & timeouts
131
+ req = HTTP.headers(request_headers)
132
+ .timeout(:write => self.write_timeout, :connect => self.connect_timeout, :read => self.read_timeout)
133
+
134
+ # Make the HTTP GET/POST request
135
+ resp = post_json ? req.post(uri.to_s, :json => post_json) : req.get(uri.to_s)
137
136
 
138
- if RETRIABLE_STATUSES.include? resp.code.to_i
137
+ if Constants::RETRIABLE_STATUSES.include? resp.code.to_i
139
138
  # Retry request
140
- self.get(url, params, first_request_time, retry_counter + 1, base_url, accepts_clientid, extract_body)
139
+ self.request(url, params, first_request_time, retry_counter + 1, base_url, accepts_clientid, extract_body, post_json)
141
140
  end
142
141
 
143
142
  # Check if the time of the nth previous query (where n is queries_per_second)
@@ -169,7 +168,7 @@ module GoogleMaps
169
168
  return result
170
169
  rescue RetriableRequest
171
170
  # Retry request
172
- return self.get(url, params, first_request_time, retry_counter + 1, base_url, accepts_clientid, extract_body)
171
+ return self.request(url, params, first_request_time, retry_counter + 1, base_url, accepts_clientid, extract_body, post_json)
173
172
  end
174
173
  end
175
174
 
@@ -1,3 +1,4 @@
1
+ require 'googlemaps/services/global_constants'
1
2
  require 'googlemaps/services/util'
2
3
 
3
4
  module GoogleMaps
@@ -8,8 +9,6 @@ module GoogleMaps
8
9
  # directions = GoogleMaps::Services::Directions.new(client)
9
10
  # result = directions.query(origin: "Brussels", destination: {:lat => 52.520645, :lng => 13.409779})
10
11
  class Directions
11
- TRAVEL_MODES = %w(driving walking bicycling transit)
12
- AVOID_FEATURES = %w(tolls highways ferries indoor)
13
12
 
14
13
  # @return [Symbol] The HTTP client.
15
14
  attr_accessor :client
@@ -54,7 +53,7 @@ module GoogleMaps
54
53
  }
55
54
 
56
55
  if mode
57
- unless TRAVEL_MODES.include? mode
56
+ unless Constants::TRAVEL_MODES.include? mode
58
57
  raise StandardError, 'invalid travel mode.'
59
58
  end
60
59
  params['mode'] = mode
@@ -73,7 +72,7 @@ module GoogleMaps
73
72
  end
74
73
 
75
74
  if avoid
76
- unless ArrayBox.contains_all?(AVOID_FEATURES, avoid)
75
+ unless ArrayBox.contains_all?(Constants::AVOID_FEATURES, avoid)
77
76
  raise StandardError, 'invalid avoid feature.'
78
77
  end
79
78
  params['avoid'] = Convert.join_array('|', avoid)
@@ -117,9 +116,9 @@ module GoogleMaps
117
116
 
118
117
  case self.client.response_format
119
118
  when :xml
120
- self.client.get(url: '/maps/api/directions/xml', params: params).xpath('//route')
119
+ self.client.request(url: '/maps/api/directions/xml', params: params).xpath('//route')
121
120
  when :json
122
- self.client.get(url: '/maps/api/directions/json', params: params)['routes']
121
+ self.client.request(url: '/maps/api/directions/json', params: params)['routes']
123
122
  else
124
123
  raise StandardError, 'Unsupported response format. Should be either :json or :xml.'
125
124
  end
@@ -1,3 +1,4 @@
1
+ require 'googlemaps/services/global_constants'
1
2
  require 'googlemaps/services/util'
2
3
 
3
4
  module GoogleMaps
@@ -8,8 +9,6 @@ module GoogleMaps
8
9
  # distancematrix = GoogleMaps::Services::DistanceMatrix.new(client)
9
10
  # result = distancematrix.query(origins: ["Brussels", "Ghent"], destinations: ["Bruges"])
10
11
  class DistanceMatrix
11
- AVOIDS = %w(tolls highways ferries)
12
- TRAVEL_MODES = %w(driving walking bicycling transit)
13
12
 
14
13
  # @return [Symbol] the HTTP client.
15
14
  attr_accessor :client
@@ -46,7 +45,7 @@ module GoogleMaps
46
45
  }
47
46
 
48
47
  if mode
49
- raise StandardError, 'Invalid travel mode.' unless TRAVEL_MODES.include? mode
48
+ raise StandardError, 'Invalid travel mode.' unless Constants::TRAVEL_MODES.include? mode
50
49
  params['mode'] = mode
51
50
  end
52
51
 
@@ -55,7 +54,7 @@ module GoogleMaps
55
54
  end
56
55
 
57
56
  if avoid
58
- raise StandardError, 'Invalid route restriction.' unless AVOIDS.include? avoid
57
+ raise StandardError, 'Invalid route restriction.' unless Constants::AVOID_FEATURES.include? avoid
59
58
  params['avoid'] = avoid
60
59
  end
61
60
 
@@ -87,7 +86,7 @@ module GoogleMaps
87
86
  params['traffic_model'] = traffic_model
88
87
  end
89
88
 
90
- self.client.get(url: "/maps/api/distancematrix/#{self.client.response_format}", params: params)
89
+ self.client.request(url: "/maps/api/distancematrix/#{self.client.response_format}", params: params)
91
90
  end
92
91
  end
93
92
  end
@@ -1,6 +1,5 @@
1
1
  require 'googlemaps/services/util'
2
2
 
3
-
4
3
  module GoogleMaps
5
4
  module Services
6
5
 
@@ -52,9 +51,9 @@ module GoogleMaps
52
51
 
53
52
  case self.client.response_format
54
53
  when :xml
55
- self.client.get(url: '/maps/api/elevation/xml', params: params).xpath('//result')
54
+ self.client.request(url: '/maps/api/elevation/xml', params: params).xpath('//result')
56
55
  when :json
57
- self.client.get(url: '/maps/api/elevation/json', params: params)['results']
56
+ self.client.request(url: '/maps/api/elevation/json', params: params)['results']
58
57
  else
59
58
  raise StandardError, 'Unsupported response format. Should be either :json or :xml.'
60
59
  end
@@ -55,9 +55,9 @@ module GoogleMaps
55
55
 
56
56
  case self.client.response_format
57
57
  when :xml
58
- self.client.get(url: '/maps/api/geocode/xml', params: params).xpath('//result')
58
+ self.client.request(url: '/maps/api/geocode/xml', params: params).xpath('//result')
59
59
  when :json
60
- self.client.get(url: '/maps/api/geocode/json', params: params)['results']
60
+ self.client.request(url: '/maps/api/geocode/json', params: params)['results']
61
61
  else
62
62
  raise StandardError, 'Unsupported response format. Should be either :json or :xml.'
63
63
  end
@@ -107,9 +107,9 @@ module GoogleMaps
107
107
 
108
108
  case self.client.response_format
109
109
  when :xml
110
- self.client.get(url: '/maps/api/geocode/xml', params: params).xpath('//result')
110
+ self.client.request(url: '/maps/api/geocode/xml', params: params).xpath('//result')
111
111
  when :json
112
- self.client.get(url: '/maps/api/geocode/json', params: params)['results']
112
+ self.client.request(url: '/maps/api/geocode/json', params: params)['results']
113
113
  else
114
114
  raise StandardError, 'Unsupported response format. Should be either :json or :xml.'
115
115
  end
@@ -0,0 +1,115 @@
1
+ require 'googlemaps/services/global_constants'
2
+ require 'googlemaps/services/exceptions'
3
+ require 'json'
4
+
5
+ module GoogleMaps
6
+ module Services
7
+
8
+ # Performs requests to the Google Geolocation API.
9
+ #
10
+ # @example
11
+ # geolocation = GoogleMaps::Services::Geolocation.new(client)
12
+ # location = geolocation.query(home_mobile_country_code: "310",
13
+ # home_mobile_network_code: "410",
14
+ # radio_type: "gsm",
15
+ # carrier: "Vodafone",
16
+ # consider_ip: "true")
17
+ # # {"location"=>{"lat"=>51.021327, "lng"=>3.7070152}, "accuracy"=>2598.0}
18
+ class Geolocation
19
+ include GoogleMaps::Services::Exceptions
20
+
21
+ # @return [Symbol] The HTTP client.
22
+ attr_accessor :client
23
+
24
+ def initialize(client)
25
+ self.client = client
26
+ end
27
+
28
+ # The Google Maps Geolocation API returns a location and accuracy radius based on information about cell towers and given WiFi nodes.
29
+ #
30
+ # For more information, see: https://developers.google.com/maps/documentation/geolocation/intro
31
+ #
32
+ # @param [String] home_mobile_country_code The mobile country code (MCC) for the device's home network.
33
+ # @param [String] home_mobile_network_code The mobile network code (MNC) for the device's home network.
34
+ # @param [String] radio_type The mobile radio type. Supported values are lte, gsm, cdma, and wcdma.
35
+ # While this field is optional, it should be included if a value is available,
36
+ # for more accurate results.
37
+ # @param [String] carrier The carrier name.
38
+ # @param [TrueClass, FalseClass] consider_ip Specifies whether to fall back to IP geolocation if wifi and cell tower
39
+ # signals are not available. Note that the IP address in the request header
40
+ # may not be the IP of the device.
41
+ # @param [Array] cell_towers The array of cell tower hashes.
42
+ # See: https://developers.google.com/maps/documentation/geolocation/intro#cell_tower_object
43
+ # @param [Array] wifi_access_points The array of WiFi access point hashes.
44
+ # See: https://developers.google.com/maps/documentation/geolocation/intro#wifi_access_point_object
45
+ #
46
+ # @return [HashMap] The location with accuracy radius.
47
+ def query(home_mobile_country_code: nil, home_mobile_network_code: nil, radio_type: nil,
48
+ carrier: nil, consider_ip: true, cell_towers: nil, wifi_access_points: nil)
49
+ params = {}
50
+
51
+ if home_mobile_country_code
52
+ params["homeMobileCountryCode"] = home_mobile_country_code
53
+ end
54
+
55
+ if home_mobile_network_code
56
+ params["homeMobileNetworkCode"] = home_mobile_network_code
57
+ end
58
+
59
+ if radio_type
60
+ raise StandardError, "invalid radio type value." unless Constants::SUPPORTED_RADIO_TYPES.include? radio_type
61
+ params["radioType"] = radio_type
62
+ end
63
+
64
+ if carrier
65
+ params["carrier"] = carrier
66
+ end
67
+
68
+ params["considerIp"] = consider_ip unless consider_ip
69
+
70
+
71
+ if cell_towers
72
+ params["cellTowers"] = cell_towers
73
+ end
74
+
75
+ if wifi_access_points
76
+ params["wifiAccessPoints"] = wifi_access_points
77
+ end
78
+
79
+ self.client.request(url: '/geolocation/v1/geolocate',
80
+ params: {},
81
+ base_url: Constants::GOOGLEAPIS_BASE_URL,
82
+ extract_body: lambda(&method(:_geolocation_extract)),
83
+ post_json: params)
84
+ end
85
+
86
+ # Extracts result from the Geolocation API HTTP response.
87
+ #
88
+ # @private
89
+ #
90
+ # @param [HTTP::Response] response HTTP response object.
91
+ #
92
+ # @return [Hash] The result as a Hash.
93
+ def _geolocation_extract(response)
94
+ status_code = response.code.to_i
95
+ begin
96
+ body = JSON.parse(response.body)
97
+ rescue JSON::ParserError
98
+ raise APIError.new(status_code), 'Received malformed response.'
99
+ end
100
+
101
+ if body.key?('error')
102
+ raise APIError.new(status_code), body['error']['errors'][0]['reason']
103
+ end
104
+
105
+ if status_code != 200
106
+ raise HTTPError.new(status_code)
107
+ end
108
+ body
109
+ end
110
+
111
+ private :_geolocation_extract
112
+ end
113
+
114
+ end
115
+ end
@@ -0,0 +1,40 @@
1
+ # coding: utf-8
2
+ require 'googlemaps/services/version'
3
+
4
+ # Global constants used across the library
5
+ #
6
+ # @since 1.3.5
7
+ module Constants
8
+ # The User-Agent header
9
+ USER_AGENT = 'GoogleMapsRubyClient/' + GoogleMaps::Services::VERSION
10
+
11
+ # The default base URL for all Google Maps requests
12
+ DEFAULT_BASE_URL = 'https://maps.googleapis.com'
13
+
14
+ # The default base URL for all Google APIs requests
15
+ GOOGLEAPIS_BASE_URL = 'https://www.googleapis.com'
16
+
17
+ # HTTP statuses that will trigger a retry request
18
+ RETRIABLE_STATUSES = [500, 503, 504]
19
+
20
+ # The supported transportation modes
21
+ TRAVEL_MODES = %w(driving walking bicycling transit)
22
+
23
+ # The features to avoid
24
+ AVOID_FEATURES = %w(tolls highways ferries indoor)
25
+
26
+ # The base URL for Roads API
27
+ ROADS_BASE_URL = 'https://roads.googleapis.com'
28
+
29
+ # The supported scale values
30
+ ALLOWED_SCALES = [2, 4]
31
+
32
+ # The supported image formats
33
+ SUPPORTED_IMG_FORMATS = ["png32", "gif", "jpg", "jpg-baseline"]
34
+
35
+ # The supported map types
36
+ SUPPORTED_MAP_TYPES = ["satellite", "hybrid", "terrain"]
37
+
38
+ # The supported mobile radio types
39
+ SUPPORTED_RADIO_TYPES = %w(lte gsm cdma wcdma)
40
+ end
@@ -130,7 +130,7 @@ module GoogleMaps
130
130
  params['pagetoken'] = page_token
131
131
  end
132
132
 
133
- self.client.get(url: "/maps/api/place/#{url_part}search/#{self.client.response_format}", params: params)
133
+ self.client.request(url: "/maps/api/place/#{url_part}search/#{self.client.response_format}", params: params)
134
134
  end
135
135
 
136
136
  # Comprehensive details for an individual place.
@@ -145,7 +145,7 @@ module GoogleMaps
145
145
  params['language'] = language
146
146
  end
147
147
 
148
- self.client.get(url: "/maps/api/place/details/#{self.client.response_format}", params: params)
148
+ self.client.request(url: "/maps/api/place/details/#{self.client.response_format}", params: params)
149
149
  end
150
150
 
151
151
  # Downloads a photo from the Places API.
@@ -168,7 +168,7 @@ module GoogleMaps
168
168
  params['maxheight'] = max_height
169
169
  end
170
170
 
171
- self.client.get(url: '/maps/api/place/photo', params: params)
171
+ self.client.request(url: '/maps/api/place/photo', params: params)
172
172
  end
173
173
 
174
174
  # Returns Place predictions given a textual search string and optional geographic bounds.
@@ -233,9 +233,9 @@ module GoogleMaps
233
233
 
234
234
  case self.client.response_format
235
235
  when :xml
236
- self.client.get(url: "/maps/api/place/#{url_part}autocomplete/xml", params: params).xpath('//prediction')
236
+ self.client.request(url: "/maps/api/place/#{url_part}autocomplete/xml", params: params).xpath('//prediction')
237
237
  when :json
238
- self.client.get(url: "/maps/api/place/#{url_part}autocomplete/json", params: params)['predictions']
238
+ self.client.request(url: "/maps/api/place/#{url_part}autocomplete/json", params: params)['predictions']
239
239
  else
240
240
  raise StandardError, 'Unsupported response format. Should be either :json or :xml.'
241
241
  end
@@ -1,10 +1,10 @@
1
+ require 'googlemaps/services/global_constants'
1
2
  require 'googlemaps/services/exceptions'
2
3
  require 'googlemaps/services/util'
3
4
  require 'json'
4
5
 
5
6
  module GoogleMaps
6
7
  module Services
7
- ROADS_BASE_URL = 'https://roads.googleapis.com'
8
8
 
9
9
  # Performs requests to the Google Maps Roads API.
10
10
  class Roads
@@ -34,7 +34,7 @@ module GoogleMaps
34
34
  params['interpolate'] = 'true'
35
35
  end
36
36
 
37
- self.client.get(url: '/v1/snapToRoads', params: params, base_url: ROADS_BASE_URL,
37
+ self.client.request(url: '/v1/snapToRoads', params: params, base_url: Constants::ROADS_BASE_URL,
38
38
  accepts_clientid: false, extract_body: lambda(&method(:_roads_extract)))['snappedPoints']
39
39
  end
40
40
 
@@ -49,7 +49,7 @@ module GoogleMaps
49
49
 
50
50
  params = {'placeId' => place_ids}
51
51
 
52
- self.client.get(url: '/v1/speedLimits', params: params, base_url: ROADS_BASE_URL,
52
+ self.client.request(url: '/v1/speedLimits', params: params, base_url: Constants::ROADS_BASE_URL,
53
53
  accepts_clientid: false, extract_body: lambda(&method(:_roads_extract)))['speedLimits']
54
54
  end
55
55
 
@@ -62,7 +62,7 @@ module GoogleMaps
62
62
  def snapped_speed_limits(path:)
63
63
  params = {'path' => Convert.piped_location(path)}
64
64
 
65
- self.client.get(url: '/v1/speedLimits', params: params, base_url: ROADS_BASE_URL,
65
+ self.client.request(url: '/v1/speedLimits', params: params, base_url: Constants::ROADS_BASE_URL,
66
66
  accepts_clientid: false, extract_body: lambda(&method(:_roads_extract)))
67
67
  end
68
68
 
@@ -76,15 +76,15 @@ module GoogleMaps
76
76
  def nearest_roads(points:)
77
77
  params = {'points' => Convert.piped_location(points)}
78
78
 
79
- self.client.get(url: '/v1/nearestRoads', params: params, base_url: ROADS_BASE_URL,
79
+ self.client.request(url: '/v1/nearestRoads', params: params, base_url: Constants::ROADS_BASE_URL,
80
80
  accepts_clientid: false, extract_body: lambda(&method(:_roads_extract)))['snappedPoints']
81
81
  end
82
82
 
83
- # Extracts a result from a Roads API HTTP response.
83
+ # Extracts result from the Roads API HTTP response.
84
84
  #
85
85
  # @private
86
86
  #
87
- # @param [Net::HTTPResponse] resp HTTP response object.
87
+ # @param [HTTP::Response] resp HTTP response object.
88
88
  #
89
89
  # @return [Hash, Array] Valid JSON response.
90
90
  def _roads_extract(resp)
@@ -118,5 +118,6 @@ module GoogleMaps
118
118
 
119
119
  private :_roads_extract
120
120
  end
121
+
121
122
  end
122
123
  end
@@ -1,10 +1,8 @@
1
+ require 'googlemaps/services/global_constants'
1
2
  require 'googlemaps/services/util'
2
3
 
3
4
  module GoogleMaps
4
5
  module Services
5
- ALLOWED_SCALES = [2, 4]
6
- SUPPORTED_IMG_FORMATS = ["png32", "gif", "jpg", "jpg-baseline"]
7
- SUPPORTED_MAP_TYPES = ["satellite", "hybrid", "terrain"]
8
6
 
9
7
  # Performs requests to the Google Static Map API.
10
8
  #
@@ -58,17 +56,17 @@ module GoogleMaps
58
56
  end
59
57
 
60
58
  if scale != 1
61
- raise StandardError, "invalid scale value." unless ALLOWED_SCALES.include? scale
59
+ raise StandardError, "invalid scale value." unless Constants::ALLOWED_SCALES.include? scale
62
60
  params['scale'] = scale
63
61
  end
64
62
 
65
63
  if format != "png"
66
- raise StandardError, "invalid image format." unless SUPPORTED_IMG_FORMATS.include? format
64
+ raise StandardError, "invalid image format." unless Constants::SUPPORTED_IMG_FORMATS.include? format
67
65
  params['format'] = format
68
66
  end
69
67
 
70
68
  if maptype != "roadmap"
71
- raise StandardError, "invalid maptype value." unless SUPPORTED_MAP_TYPES.include? maptype
69
+ raise StandardError, "invalid maptype value." unless Constants::SUPPORTED_MAP_TYPES.include? maptype
72
70
  params['maptype'] = maptype
73
71
  end
74
72
 
@@ -92,7 +90,7 @@ module GoogleMaps
92
90
  params['style'] = style
93
91
  end
94
92
 
95
- self.client.get(url: "/maps/api/staticmap", params: params)
93
+ self.client.request(url: "/maps/api/staticmap", params: params)
96
94
  end
97
95
 
98
96
  end
@@ -66,7 +66,7 @@ module GoogleMaps
66
66
  params['pitch'] = pitch
67
67
  end
68
68
 
69
- self.client.get(url: "/maps/api/streetview", params: params)
69
+ self.client.request(url: "/maps/api/streetview", params: params)
70
70
  end
71
71
  end
72
72
  end
@@ -35,7 +35,7 @@ module GoogleMaps
35
35
  params['language'] = language
36
36
  end
37
37
 
38
- self.client.get(url: "/maps/api/timezone/#{self.client.response_format}", params: params)
38
+ self.client.request(url: "/maps/api/timezone/#{self.client.response_format}", params: params)
39
39
  end
40
40
  end
41
41
 
@@ -1,5 +1,5 @@
1
1
  module GoogleMaps
2
2
  module Services
3
- VERSION = '1.3.5'.freeze
3
+ VERSION = '1.4.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: googlemaps-services
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.5
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Faissal Elamraoui
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-03-05 00:00:00.000000000 Z
11
+ date: 2017-04-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
@@ -19,7 +19,7 @@ dependencies:
19
19
  version: '1.7'
20
20
  - - ">="
21
21
  - !ruby/object:Gem::Version
22
- version: 1.7.0.1
22
+ version: 1.7.1
23
23
  type: :runtime
24
24
  prerelease: false
25
25
  version_requirements: !ruby/object:Gem::Requirement
@@ -29,69 +29,69 @@ dependencies:
29
29
  version: '1.7'
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
- version: 1.7.0.1
32
+ version: 1.7.1
33
33
  - !ruby/object:Gem::Dependency
34
34
  name: http
35
35
  requirement: !ruby/object:Gem::Requirement
36
36
  requirements:
37
37
  - - "~>"
38
38
  - !ruby/object:Gem::Version
39
- version: '2.1'
39
+ version: '2.2'
40
40
  - - ">="
41
41
  - !ruby/object:Gem::Version
42
- version: 2.1.0
42
+ version: 2.2.1
43
43
  type: :runtime
44
44
  prerelease: false
45
45
  version_requirements: !ruby/object:Gem::Requirement
46
46
  requirements:
47
47
  - - "~>"
48
48
  - !ruby/object:Gem::Version
49
- version: '2.1'
49
+ version: '2.2'
50
50
  - - ">="
51
51
  - !ruby/object:Gem::Version
52
- version: 2.1.0
52
+ version: 2.2.1
53
53
  - !ruby/object:Gem::Dependency
54
54
  name: bundler
55
55
  requirement: !ruby/object:Gem::Requirement
56
56
  requirements:
57
57
  - - "~>"
58
58
  - !ruby/object:Gem::Version
59
- version: '1.12'
59
+ version: '1.14'
60
60
  type: :development
61
61
  prerelease: false
62
62
  version_requirements: !ruby/object:Gem::Requirement
63
63
  requirements:
64
64
  - - "~>"
65
65
  - !ruby/object:Gem::Version
66
- version: '1.12'
66
+ version: '1.14'
67
67
  - !ruby/object:Gem::Dependency
68
68
  name: rake
69
69
  requirement: !ruby/object:Gem::Requirement
70
70
  requirements:
71
71
  - - "~>"
72
72
  - !ruby/object:Gem::Version
73
- version: '10.0'
73
+ version: '12.0'
74
74
  type: :development
75
75
  prerelease: false
76
76
  version_requirements: !ruby/object:Gem::Requirement
77
77
  requirements:
78
78
  - - "~>"
79
79
  - !ruby/object:Gem::Version
80
- version: '10.0'
80
+ version: '12.0'
81
81
  - !ruby/object:Gem::Dependency
82
82
  name: rspec
83
83
  requirement: !ruby/object:Gem::Requirement
84
84
  requirements:
85
85
  - - "~>"
86
86
  - !ruby/object:Gem::Version
87
- version: '3.0'
87
+ version: '3.5'
88
88
  type: :development
89
89
  prerelease: false
90
90
  version_requirements: !ruby/object:Gem::Requirement
91
91
  requirements:
92
92
  - - "~>"
93
93
  - !ruby/object:Gem::Version
94
- version: '3.0'
94
+ version: '3.5'
95
95
  description: This library brings the Google Maps API Web Services to your Ruby/RoR
96
96
  application. It supports both JSON and XML response formats.
97
97
  email:
@@ -106,6 +106,8 @@ files:
106
106
  - lib/googlemaps/services/elevation.rb
107
107
  - lib/googlemaps/services/exceptions.rb
108
108
  - lib/googlemaps/services/geocoding.rb
109
+ - lib/googlemaps/services/geolocation.rb
110
+ - lib/googlemaps/services/global_constants.rb
109
111
  - lib/googlemaps/services/places.rb
110
112
  - lib/googlemaps/services/roads.rb
111
113
  - lib/googlemaps/services/staticmap.rb
@@ -133,7 +135,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
133
135
  version: '0'
134
136
  requirements: []
135
137
  rubyforge_project:
136
- rubygems_version: 2.5.1
138
+ rubygems_version: 2.6.11
137
139
  signing_key:
138
140
  specification_version: 4
139
141
  summary: Ruby Client library for Google Maps API Web Services