parameters: (
      service,
      base=None,
      future=None,
      http=None,
      developerKey=None,
      model=None,
      requestBuilder=HttpRequest,
      credentials=None)
return_statement: return Resource(http=http, baseUrl=base, model=model,
                    developerKey=developerKey, requestBuilder=requestBuilder,
                    resourceDesc=service, rootDesc=service, schema=schema)
docstring: Create a Resource for interacting with an API.
  
    Same as `build()`, but constructs the Resource object from a discovery
    document that is it given, as opposed to retrieving one over HTTP.
  
    Args:
      service: string or object, the JSON discovery document describing the API.
        The value passed in may either be the JSON string or the deserialized
        JSON.
      base: string, base URI for all HTTP requests, usually the discovery URI.
        This parameter is no longer used as rootUrl and servicePath are included
        within the discovery document. (deprecated)
      future: string, discovery document with future capabilities (deprecated).
      http: httplib2.Http, An instance of httplib2.Http or something that acts
        like it that HTTP requests will be made through.
      developerKey: string, Key for controlling API usage, generated
        from the API Console.
      model: Model class instance that serializes and de-serializes requests and
        responses.
      requestBuilder: Takes an http request and packages it up to be executed.
      credentials: object, credentials to be used for authentication.
  
    Returns:
      A Resource object with methods for interacting with the service.
docstring_summary: Create a Resource for interacting with an API.
docstring_tokens: Create a Resource for interacting with an API .
function: def build_from_document(
      service,
      base=None,
      future=None,
      http=None,
      developerKey=None,
      model=None,
      requestBuilder=HttpRequest,
      credentials=None):
    """Create a Resource for interacting with an API.
  
    Same as `build()`, but constructs the Resource object from a discovery
    document that is it given, as opposed to retrieving one over HTTP.
  
    Args:
      service: string or object, the JSON discovery document describing the API.
        The value passed in may either be the JSON string or the deserialized
        JSON.
      base: string, base URI for all HTTP requests, usually the discovery URI.
        This parameter is no longer used as rootUrl and servicePath are included
        within the discovery document. (deprecated)
      future: string, discovery document with future capabilities (deprecated).
      http: httplib2.Http, An instance of httplib2.Http or something that acts
        like it that HTTP requests will be made through.
      developerKey: string, Key for controlling API usage, generated
        from the API Console.
      model: Model class instance that serializes and de-serializes requests and
        responses.
      requestBuilder: Takes an http request and packages it up to be executed.
      credentials: object, credentials to be used for authentication.
  
    Returns:
      A Resource object with methods for interacting with the service.
    """
  
    # future is no longer used.
    future = {}
  
    if isinstance(service, six.string_types):
      service = json.loads(service)
    base = urljoin(service['rootUrl'], service['servicePath'])
    schema = Schemas(service)
  
    if credentials:
      # If credentials were passed in, we could have two cases:
      # 1. the scopes were specified, in which case the given credentials
      #    are used for authorizing the http;
      # 2. the scopes were not provided (meaning the Application Default
      #    Credentials are to be used). In this case, the Application Default
      #    Credentials are built and used instead of the original credentials.
      #    If there are no scopes found (meaning the given service requires no
      #    authentication), there is no authorization of the http.
      if (isinstance(credentials, GoogleCredentials) and
          credentials.create_scoped_required()):
        scopes = service.get('auth', {}).get('oauth2', {}).get('scopes', {})
        if scopes:
          credentials = credentials.create_scoped(list(scopes.keys()))
        else:
          # No need to authorize the http object
          # if the service does not require authentication.
          credentials = None
  
      if credentials:
        http = credentials.authorize(http)
  
    if model is None:
      features = service.get('features', [])
      model = JsonModel('dataWrapper' in features)
    return Resource(http=http, baseUrl=base, model=model,
                    developerKey=developerKey, requestBuilder=requestBuilder,
                    resourceDesc=service, rootDesc=service, schema=schema)
function_tokens: def build_from_document ( service , base = None , future = None , http = None , developerKey = None , model = None , requestBuilder = HttpRequest , credentials = None ) : # future is no longer used. future = { } if isinstance ( service , six . string_types ) : service = json . loads ( service ) base = urljoin ( service [ 'rootUrl' ] , service [ 'servicePath' ] ) schema = Schemas ( service ) if credentials : # If credentials were passed in, we could have two cases: # 1. the scopes were specified, in which case the given credentials #    are used for authorizing the http; # 2. the scopes were not provided (meaning the Application Default #    Credentials are to be used). In this case, the Application Default #    Credentials are built and used instead of the original credentials. #    If there are no scopes found (meaning the given service requires no #    authentication), there is no authorization of the http. if ( isinstance ( credentials , GoogleCredentials ) and credentials . create_scoped_required ( ) ) : scopes = service . get ( 'auth' , { } ) . get ( 'oauth2' , { } ) . get ( 'scopes' , { } ) if scopes : credentials = credentials . create_scoped ( list ( scopes . keys ( ) ) ) else : # No need to authorize the http object # if the service does not require authentication. credentials = None if credentials : http = credentials . authorize ( http ) if model is None : features = service . get ( 'features' , [ ] ) model = JsonModel ( 'dataWrapper' in features ) return Resource ( http = http , baseUrl = base , model = model , developerKey = developerKey , requestBuilder = requestBuilder , resourceDesc = service , rootDesc = service , schema = schema )