diff --git a/CONTRIBUTING b/CONTRIBUTING new file mode 100644 index 0000000..2827b7d --- /dev/null +++ b/CONTRIBUTING @@ -0,0 +1,27 @@ +Want to contribute? Great! First, read this page (including the small print at the end). + +### Before you contribute +Before we can use your code, you must sign the +[Google Individual Contributor License Agreement] +(https://cla.developers.google.com/about/google-individual) +(CLA), which you can do online. The CLA is necessary mainly because you own the +copyright to your changes, even after your contribution becomes part of our +codebase, so we need your permission to use and distribute your code. We also +need to be sure of various other things—for instance that you'll tell us if you +know that your code infringes on other people's patents. You don't have to sign +the CLA until after you've submitted your code for review and a member has +approved it, but you must do it before we can put your code into our codebase. +Before you start working on a larger contribution, you should get in touch with +us first through the issue tracker with your idea so that we can help out and +possibly guide you. Coordinating up front makes it much easier to avoid +frustration later on. + +### Code reviews +All submissions, including submissions by project members, require review. We +use Github pull requests for this purpose. + +### The small print +Contributions made by corporations are covered by a different agreement than +the one above, the +[Software Grant and Corporate Contributor License Agreement] +(https://cla.developers.google.com/about/google-corporate). diff --git a/README.md b/README.md index c7a13a9..e068225 100644 --- a/README.md +++ b/README.md @@ -9,30 +9,34 @@ Library for converting V3 API request to v4 API requests. ## Typical usage example -There are two methods of using the gav4 libary. The first being you can -`apply` the library to an authorized Google Analytics Service object, which -exposes a get method that operates much like the current v3 Core Reporting -API. Alternatively you can call the conversion methods directly. +There are two methods of using the gav4 library. You can `apply` the library to an authorized Google Analytics Service object, which exposes a get method that operates much like the current Core Reporting API V3. - from gcloud import datastore import gav4 + gav4.apply_gav4(analytics) + # Call the gav4_get method with a V3 request and get a V3 response. v3_response = analytics.gav4_get(v3_request).execute() - # Alternatively you can convert the request directly + +Alternatively you can convert the requests and responses directly. + + + # Convert a V3 request into a V4 request. v4_request = gav4.convert_request(v3_request) + # Call the V4 API. v4_response = analytics.reports().batchGet(body=v4_request).execute() + # Convert the V4 API response into a V3 response. v3_response = gav4.convert_report(v4_response.get('reports', [])[0]) ## Contributing 1. **Please sign one of the contributor license agreements below.** -2. Fork the repo, develop and test your code changes, add docs. +2. Fork the repository, develop and test your code changes, add docs. 3. Make sure that your commit messages clearly describe the changes. 4. Send a pull request. diff --git a/setup.py b/setup.py index 5dc945c..4e33856 100644 --- a/setup.py +++ b/setup.py @@ -1,4 +1,17 @@ #!/usr/bin/env python +# Copyright 2016 Google Inc. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS-IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. import os