|
43 | 43 |
|
44 | 44 | URITEMPLATE = re.compile('{[^}]*}') |
45 | 45 | VARNAME = re.compile('[a-zA-Z0-9_-]+') |
46 | | -DISCOVERY_URI = ('https://www.googleapis.com/discovery/v0.3/describe/' |
47 | | - '{api}/{apiVersion}') |
| 46 | +DISCOVERY_URI = ('https://www.googleapis.com/discovery/v1/apis/' |
| 47 | + '{api}/{apiVersion}/rest') |
48 | 48 | DEFAULT_METHOD_DOC = 'A description of how to use this function' |
49 | 49 |
|
50 | 50 | # Query parameters that work, but don't appear in discovery |
@@ -164,7 +164,7 @@ def build_from_document( |
164 | 164 | """ |
165 | 165 |
|
166 | 166 | service = simplejson.loads(service) |
167 | | - base = urlparse.urljoin(base, service['restBasePath']) |
| 167 | + base = urlparse.urljoin(base, service['basePath']) |
168 | 168 | if future: |
169 | 169 | future = simplejson.loads(future) |
170 | 170 | auth_discovery = future.get('auth', {}) |
@@ -232,16 +232,16 @@ def __init__(self): |
232 | 232 | self._requestBuilder = requestBuilder |
233 | 233 |
|
234 | 234 | def createMethod(theclass, methodName, methodDesc, futureDesc): |
235 | | - pathUrl = methodDesc['restPath'] |
| 235 | + pathUrl = methodDesc['path'] |
236 | 236 | httpMethod = methodDesc['httpMethod'] |
237 | | - methodId = methodDesc['rpcMethod'] |
| 237 | + methodId = methodDesc['id'] |
238 | 238 |
|
239 | 239 | if 'parameters' not in methodDesc: |
240 | 240 | methodDesc['parameters'] = {} |
241 | 241 | for name in STACK_QUERY_PARAMETERS: |
242 | 242 | methodDesc['parameters'][name] = { |
243 | 243 | 'type': 'string', |
244 | | - 'restParameterType': 'query' |
| 244 | + 'location': 'query' |
245 | 245 | } |
246 | 246 |
|
247 | 247 | if httpMethod in ['PUT', 'POST', 'PATCH']: |
@@ -274,9 +274,9 @@ def createMethod(theclass, methodName, methodDesc, futureDesc): |
274 | 274 | required_params.append(param) |
275 | 275 | if desc.get('repeated', False): |
276 | 276 | repeated_params.append(param) |
277 | | - if desc.get('restParameterType') == 'query': |
| 277 | + if desc.get('location') == 'query': |
278 | 278 | query_params.append(param) |
279 | | - if desc.get('restParameterType') == 'path': |
| 279 | + if desc.get('location') == 'path': |
280 | 280 | path_params[param] = param |
281 | 281 | param_type[param] = desc.get('type', 'string') |
282 | 282 |
|
@@ -380,7 +380,7 @@ def method(self, **kwargs): |
380 | 380 | setattr(theclass, methodName, method) |
381 | 381 |
|
382 | 382 | def createNextMethod(theclass, methodName, methodDesc, futureDesc): |
383 | | - methodId = methodDesc['rpcMethod'] + '.next' |
| 383 | + methodId = methodDesc['id'] + '.next' |
384 | 384 |
|
385 | 385 | def methodNext(self, previous): |
386 | 386 | """ |
|
0 commit comments