google-api-client 0.50.0 → 0.53.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.yardopts +0 -14
- data/CHANGELOG.md +233 -0
- data/OVERVIEW.md +36 -27
- data/generated/google/apis/accesscontextmanager_v1/classes.rb +326 -0
- data/generated/google/apis/accesscontextmanager_v1/representations.rb +139 -0
- data/generated/google/apis/accesscontextmanager_v1.rb +1 -1
- data/generated/google/apis/adexchangebuyer2_v2beta1/classes.rb +50 -6
- data/generated/google/apis/adexchangebuyer2_v2beta1/representations.rb +18 -0
- data/generated/google/apis/adexchangebuyer2_v2beta1/service.rb +3 -1
- data/generated/google/apis/adexchangebuyer2_v2beta1.rb +1 -1
- data/generated/google/apis/admin_datatransfer_v1/classes.rb +6 -16
- data/generated/google/apis/admin_datatransfer_v1/service.rb +3 -3
- data/generated/google/apis/admin_datatransfer_v1.rb +2 -2
- data/generated/google/apis/admin_directory_v1/classes.rb +453 -321
- data/generated/google/apis/admin_directory_v1/representations.rb +15 -15
- data/generated/google/apis/admin_directory_v1/service.rb +325 -185
- data/generated/google/apis/admin_directory_v1.rb +2 -2
- data/generated/google/apis/admin_reports_v1/classes.rb +48 -43
- data/generated/google/apis/admin_reports_v1/service.rb +198 -179
- data/generated/google/apis/admin_reports_v1.rb +2 -2
- data/generated/google/apis/admob_v1.rb +1 -1
- data/generated/google/apis/admob_v1beta.rb +1 -1
- data/generated/google/apis/alertcenter_v1beta1.rb +1 -1
- data/generated/google/apis/analytics_v3/service.rb +1 -1
- data/generated/google/apis/analyticsadmin_v1alpha/classes.rb +10 -2
- data/generated/google/apis/analyticsadmin_v1alpha/representations.rb +1 -0
- data/generated/google/apis/analyticsadmin_v1alpha/service.rb +41 -21
- data/generated/google/apis/analyticsadmin_v1alpha.rb +2 -2
- data/generated/google/apis/analyticsdata_v1alpha/classes.rb +93 -28
- data/generated/google/apis/analyticsdata_v1alpha/representations.rb +2 -0
- data/generated/google/apis/analyticsdata_v1alpha/service.rb +5 -5
- data/generated/google/apis/analyticsdata_v1alpha.rb +2 -2
- data/generated/google/apis/androidenterprise_v1/service.rb +4 -1
- data/generated/google/apis/androidenterprise_v1.rb +1 -1
- data/generated/google/apis/androidmanagement_v1/classes.rb +69 -4
- data/generated/google/apis/androidmanagement_v1/representations.rb +19 -0
- data/generated/google/apis/androidmanagement_v1.rb +1 -1
- data/generated/google/apis/androidpublisher_v3/service.rb +4 -4
- data/generated/google/apis/androidpublisher_v3.rb +1 -1
- data/generated/google/apis/apigateway_v1/classes.rb +1116 -0
- data/generated/google/apis/apigateway_v1/representations.rb +442 -0
- data/generated/google/apis/apigateway_v1/service.rb +1172 -0
- data/{lib/google/apis/core/logging.rb → generated/google/apis/apigateway_v1.rb} +14 -10
- data/generated/google/apis/apigateway_v1beta/classes.rb +22 -17
- data/generated/google/apis/apigateway_v1beta/representations.rb +1 -1
- data/generated/google/apis/apigateway_v1beta.rb +1 -1
- data/generated/google/apis/apigee_v1/classes.rb +102 -29
- data/generated/google/apis/apigee_v1/representations.rb +42 -0
- data/generated/google/apis/apigee_v1/service.rb +264 -55
- data/generated/google/apis/apigee_v1.rb +1 -1
- data/generated/google/apis/appengine_v1/classes.rb +7 -0
- data/generated/google/apis/appengine_v1/representations.rb +1 -0
- data/generated/google/apis/appengine_v1.rb +1 -1
- data/generated/google/apis/appengine_v1beta/classes.rb +8 -0
- data/generated/google/apis/appengine_v1beta/representations.rb +1 -0
- data/generated/google/apis/appengine_v1beta.rb +1 -1
- data/generated/google/apis/area120tables_v1alpha1.rb +4 -1
- data/generated/google/apis/artifactregistry_v1/classes.rb +242 -0
- data/generated/google/apis/artifactregistry_v1/representations.rb +116 -0
- data/generated/google/apis/artifactregistry_v1/service.rb +210 -0
- data/generated/google/apis/artifactregistry_v1.rb +38 -0
- data/generated/google/apis/artifactregistry_v1beta1/classes.rb +0 -120
- data/generated/google/apis/artifactregistry_v1beta1/representations.rb +0 -62
- data/generated/google/apis/artifactregistry_v1beta1/service.rb +4 -1
- data/generated/google/apis/artifactregistry_v1beta1.rb +1 -1
- data/generated/google/apis/artifactregistry_v1beta2/classes.rb +917 -0
- data/generated/google/apis/artifactregistry_v1beta2/representations.rb +381 -0
- data/generated/google/apis/artifactregistry_v1beta2/service.rb +947 -0
- data/generated/google/apis/artifactregistry_v1beta2.rb +38 -0
- data/generated/google/apis/{assuredworkloads_v1beta1 → assuredworkloads_v1}/classes.rb +49 -137
- data/generated/google/apis/{assuredworkloads_v1beta1 → assuredworkloads_v1}/representations.rb +27 -87
- data/generated/google/apis/{assuredworkloads_v1beta1 → assuredworkloads_v1}/service.rb +46 -46
- data/generated/google/apis/{assuredworkloads_v1beta1.rb → assuredworkloads_v1.rb} +6 -6
- data/generated/google/apis/binaryauthorization_v1/classes.rb +0 -6
- data/generated/google/apis/binaryauthorization_v1/representations.rb +0 -1
- data/generated/google/apis/binaryauthorization_v1.rb +1 -1
- data/generated/google/apis/binaryauthorization_v1beta1/classes.rb +2 -7
- data/generated/google/apis/binaryauthorization_v1beta1/representations.rb +0 -1
- data/generated/google/apis/binaryauthorization_v1beta1.rb +1 -1
- data/generated/google/apis/chat_v1/service.rb +308 -0
- data/generated/google/apis/chat_v1.rb +1 -1
- data/generated/google/apis/cloudasset_v1/classes.rb +332 -3
- data/generated/google/apis/cloudasset_v1/representations.rb +139 -0
- data/generated/google/apis/cloudasset_v1.rb +1 -1
- data/generated/google/apis/cloudasset_v1beta1/classes.rb +326 -0
- data/generated/google/apis/cloudasset_v1beta1/representations.rb +139 -0
- data/generated/google/apis/cloudasset_v1beta1.rb +1 -1
- data/generated/google/apis/cloudasset_v1p5beta1/classes.rb +326 -0
- data/generated/google/apis/cloudasset_v1p5beta1/representations.rb +139 -0
- data/generated/google/apis/cloudasset_v1p5beta1.rb +1 -1
- data/generated/google/apis/cloudbuild_v1/classes.rb +4 -4
- data/generated/google/apis/cloudbuild_v1/service.rb +1 -1
- data/generated/google/apis/cloudbuild_v1.rb +1 -1
- data/generated/google/apis/cloudbuild_v1alpha1/classes.rb +3 -3
- data/generated/google/apis/cloudbuild_v1alpha1.rb +1 -1
- data/generated/google/apis/cloudbuild_v1alpha2/classes.rb +3 -3
- data/generated/google/apis/cloudbuild_v1alpha2.rb +1 -1
- data/generated/google/apis/cloudfunctions_v1/classes.rb +6 -0
- data/generated/google/apis/cloudfunctions_v1/representations.rb +1 -0
- data/generated/google/apis/cloudfunctions_v1.rb +1 -1
- data/generated/google/apis/cloudidentity_v1/classes.rb +240 -0
- data/generated/google/apis/cloudidentity_v1/representations.rb +125 -0
- data/generated/google/apis/cloudidentity_v1/service.rb +210 -6
- data/generated/google/apis/cloudidentity_v1.rb +1 -1
- data/generated/google/apis/cloudidentity_v1beta1/classes.rb +1 -1
- data/generated/google/apis/cloudidentity_v1beta1/service.rb +16 -6
- data/generated/google/apis/cloudidentity_v1beta1.rb +1 -1
- data/generated/google/apis/cloudiot_v1/classes.rb +0 -6
- data/generated/google/apis/cloudiot_v1/representations.rb +0 -1
- data/generated/google/apis/cloudiot_v1.rb +1 -1
- data/generated/google/apis/cloudkms_v1/classes.rb +0 -6
- data/generated/google/apis/cloudkms_v1/representations.rb +0 -1
- data/generated/google/apis/cloudkms_v1.rb +1 -1
- data/generated/google/apis/cloudresourcemanager_v1/classes.rb +0 -26
- data/generated/google/apis/cloudresourcemanager_v1/representations.rb +0 -24
- data/generated/google/apis/cloudresourcemanager_v1.rb +1 -1
- data/generated/google/apis/cloudresourcemanager_v1beta1/classes.rb +0 -26
- data/generated/google/apis/cloudresourcemanager_v1beta1/representations.rb +0 -24
- data/generated/google/apis/cloudresourcemanager_v1beta1.rb +1 -1
- data/generated/google/apis/cloudresourcemanager_v2/classes.rb +0 -26
- data/generated/google/apis/cloudresourcemanager_v2/representations.rb +0 -24
- data/generated/google/apis/cloudresourcemanager_v2.rb +1 -1
- data/generated/google/apis/cloudresourcemanager_v2beta1/classes.rb +0 -26
- data/generated/google/apis/cloudresourcemanager_v2beta1/representations.rb +0 -24
- data/generated/google/apis/cloudresourcemanager_v2beta1.rb +1 -1
- data/generated/google/apis/cloudscheduler_v1beta1/classes.rb +19 -0
- data/generated/google/apis/cloudscheduler_v1beta1/representations.rb +2 -0
- data/generated/google/apis/cloudscheduler_v1beta1/service.rb +12 -2
- data/generated/google/apis/cloudscheduler_v1beta1.rb +1 -1
- data/generated/google/apis/cloudsearch_v1/classes.rb +10 -5
- data/generated/google/apis/cloudsearch_v1.rb +1 -1
- data/generated/google/apis/cloudtasks_v2/classes.rb +0 -6
- data/generated/google/apis/cloudtasks_v2/representations.rb +0 -1
- data/generated/google/apis/cloudtasks_v2.rb +1 -1
- data/generated/google/apis/cloudtasks_v2beta2/classes.rb +59 -6
- data/generated/google/apis/cloudtasks_v2beta2/representations.rb +19 -1
- data/generated/google/apis/cloudtasks_v2beta2.rb +1 -1
- data/generated/google/apis/cloudtasks_v2beta3/classes.rb +102 -6
- data/generated/google/apis/cloudtasks_v2beta3/representations.rb +35 -1
- data/generated/google/apis/cloudtasks_v2beta3/service.rb +16 -2
- data/generated/google/apis/cloudtasks_v2beta3.rb +1 -1
- data/generated/google/apis/composer_v1/classes.rb +123 -0
- data/generated/google/apis/composer_v1/representations.rb +49 -0
- data/generated/google/apis/composer_v1/service.rb +19 -15
- data/generated/google/apis/composer_v1.rb +1 -1
- data/generated/google/apis/composer_v1beta1/classes.rb +173 -0
- data/generated/google/apis/composer_v1beta1/representations.rb +64 -0
- data/generated/google/apis/composer_v1beta1/service.rb +39 -1
- data/generated/google/apis/composer_v1beta1.rb +1 -1
- data/generated/google/apis/compute_alpha/classes.rb +1071 -341
- data/generated/google/apis/compute_alpha/representations.rb +248 -19
- data/generated/google/apis/compute_alpha/service.rb +291 -15
- data/generated/google/apis/compute_alpha.rb +1 -1
- data/generated/google/apis/compute_beta/classes.rb +926 -283
- data/generated/google/apis/compute_beta/representations.rb +221 -18
- data/generated/google/apis/compute_beta/service.rb +24 -15
- data/generated/google/apis/compute_beta.rb +1 -1
- data/generated/google/apis/compute_v1/classes.rb +426 -160
- data/generated/google/apis/compute_v1/representations.rb +56 -0
- data/generated/google/apis/compute_v1/service.rb +700 -551
- data/generated/google/apis/compute_v1.rb +1 -1
- data/generated/google/apis/container_v1/classes.rb +55 -16
- data/generated/google/apis/container_v1/representations.rb +17 -0
- data/generated/google/apis/container_v1/service.rb +4 -2
- data/generated/google/apis/container_v1.rb +1 -1
- data/generated/google/apis/container_v1beta1/classes.rb +31 -20
- data/generated/google/apis/container_v1beta1/representations.rb +2 -0
- data/generated/google/apis/container_v1beta1/service.rb +6 -2
- data/generated/google/apis/container_v1beta1.rb +1 -1
- data/generated/google/apis/containeranalysis_v1alpha1/classes.rb +0 -6
- data/generated/google/apis/containeranalysis_v1alpha1/representations.rb +0 -1
- data/generated/google/apis/containeranalysis_v1alpha1.rb +1 -1
- data/generated/google/apis/containeranalysis_v1beta1/classes.rb +2 -7
- data/generated/google/apis/containeranalysis_v1beta1/representations.rb +0 -1
- data/generated/google/apis/containeranalysis_v1beta1.rb +1 -1
- data/generated/google/apis/content_v2/classes.rb +4 -4
- data/generated/google/apis/content_v2.rb +1 -1
- data/generated/google/apis/content_v2_1/classes.rb +625 -11
- data/generated/google/apis/content_v2_1/representations.rb +266 -0
- data/generated/google/apis/content_v2_1/service.rb +295 -0
- data/generated/google/apis/content_v2_1.rb +1 -1
- data/generated/google/apis/datacatalog_v1beta1/classes.rb +6 -6
- data/generated/google/apis/datacatalog_v1beta1/representations.rb +1 -1
- data/generated/google/apis/datacatalog_v1beta1.rb +1 -1
- data/generated/google/apis/dataflow_v1b3/classes.rb +17 -1
- data/generated/google/apis/dataflow_v1b3/representations.rb +2 -0
- data/generated/google/apis/dataflow_v1b3.rb +1 -1
- data/generated/google/apis/datalabeling_v1beta1.rb +1 -1
- data/generated/google/apis/datamigration_v1beta1/classes.rb +0 -6
- data/generated/google/apis/datamigration_v1beta1/representations.rb +0 -1
- data/generated/google/apis/datamigration_v1beta1.rb +1 -1
- data/generated/google/apis/dataproc_v1/classes.rb +107 -7
- data/generated/google/apis/dataproc_v1/representations.rb +36 -1
- data/generated/google/apis/dataproc_v1/service.rb +42 -0
- data/generated/google/apis/dataproc_v1.rb +1 -1
- data/generated/google/apis/dataproc_v1beta2/classes.rb +75 -7
- data/generated/google/apis/dataproc_v1beta2/representations.rb +32 -1
- data/generated/google/apis/dataproc_v1beta2/service.rb +42 -0
- data/generated/google/apis/dataproc_v1beta2.rb +1 -1
- data/generated/google/apis/deploymentmanager_alpha/classes.rb +276 -644
- data/generated/google/apis/deploymentmanager_alpha/representations.rb +10 -143
- data/generated/google/apis/deploymentmanager_alpha/service.rb +247 -398
- data/generated/google/apis/deploymentmanager_alpha.rb +6 -5
- data/generated/google/apis/deploymentmanager_v2/classes.rb +0 -6
- data/generated/google/apis/deploymentmanager_v2/representations.rb +0 -1
- data/generated/google/apis/deploymentmanager_v2/service.rb +5 -25
- data/generated/google/apis/deploymentmanager_v2.rb +1 -1
- data/generated/google/apis/deploymentmanager_v2beta/classes.rb +0 -6
- data/generated/google/apis/deploymentmanager_v2beta/representations.rb +0 -1
- data/generated/google/apis/deploymentmanager_v2beta/service.rb +8 -40
- data/generated/google/apis/deploymentmanager_v2beta.rb +1 -1
- data/generated/google/apis/dialogflow_v2/classes.rb +3930 -507
- data/generated/google/apis/dialogflow_v2/representations.rb +1866 -285
- data/generated/google/apis/dialogflow_v2/service.rb +12 -4
- data/generated/google/apis/dialogflow_v2.rb +1 -1
- data/generated/google/apis/dialogflow_v2beta1/classes.rb +4100 -682
- data/generated/google/apis/dialogflow_v2beta1/representations.rb +1877 -296
- data/generated/google/apis/dialogflow_v2beta1/service.rb +496 -32
- data/generated/google/apis/dialogflow_v2beta1.rb +1 -1
- data/generated/google/apis/dialogflow_v3/classes.rb +11752 -0
- data/generated/google/apis/dialogflow_v3/representations.rb +5158 -0
- data/generated/google/apis/dialogflow_v3/service.rb +3414 -0
- data/generated/google/apis/{bigqueryreservation_v1alpha2.rb → dialogflow_v3.rb} +13 -12
- data/generated/google/apis/dialogflow_v3beta1/classes.rb +5190 -2229
- data/generated/google/apis/dialogflow_v3beta1/representations.rb +1789 -342
- data/generated/google/apis/dialogflow_v3beta1/service.rb +591 -2
- data/generated/google/apis/dialogflow_v3beta1.rb +1 -1
- data/generated/google/apis/displayvideo_v1/classes.rb +97 -3
- data/generated/google/apis/displayvideo_v1/representations.rb +45 -0
- data/generated/google/apis/displayvideo_v1/service.rb +103 -39
- data/generated/google/apis/displayvideo_v1.rb +1 -1
- data/generated/google/apis/dlp_v2/service.rb +297 -10
- data/generated/google/apis/dlp_v2.rb +1 -1
- data/generated/google/apis/dns_v1/classes.rb +71 -0
- data/generated/google/apis/dns_v1/representations.rb +33 -0
- data/generated/google/apis/dns_v1.rb +1 -1
- data/generated/google/apis/dns_v1beta2/classes.rb +6 -0
- data/generated/google/apis/dns_v1beta2/representations.rb +1 -0
- data/generated/google/apis/dns_v1beta2.rb +1 -1
- data/generated/google/apis/documentai_v1beta2/classes.rb +217 -186
- data/generated/google/apis/documentai_v1beta2/representations.rb +107 -24
- data/generated/google/apis/documentai_v1beta2.rb +1 -1
- data/generated/google/apis/documentai_v1beta3/classes.rb +238 -201
- data/generated/google/apis/documentai_v1beta3/representations.rb +107 -24
- data/generated/google/apis/documentai_v1beta3/service.rb +81 -2
- data/generated/google/apis/documentai_v1beta3.rb +1 -1
- data/generated/google/apis/doubleclickbidmanager_v1_1.rb +1 -1
- data/generated/google/apis/drive_v2/classes.rb +4 -1
- data/generated/google/apis/drive_v2/service.rb +24 -56
- data/generated/google/apis/drive_v2.rb +1 -1
- data/generated/google/apis/drive_v3/classes.rb +4 -1
- data/generated/google/apis/drive_v3/service.rb +14 -30
- data/generated/google/apis/drive_v3.rb +1 -1
- data/generated/google/apis/eventarc_v1beta1/classes.rb +8 -15
- data/generated/google/apis/eventarc_v1beta1/representations.rb +0 -1
- data/generated/google/apis/eventarc_v1beta1/service.rb +25 -5
- data/generated/google/apis/eventarc_v1beta1.rb +1 -1
- data/generated/google/apis/file_v1/classes.rb +61 -0
- data/generated/google/apis/file_v1/representations.rb +19 -0
- data/generated/google/apis/file_v1.rb +1 -1
- data/generated/google/apis/firebasedatabase_v1beta/classes.rb +130 -0
- data/generated/google/apis/firebasedatabase_v1beta/representations.rb +82 -0
- data/generated/google/apis/firebasedatabase_v1beta/service.rb +292 -0
- data/generated/google/apis/firebasedatabase_v1beta.rb +44 -0
- data/generated/google/apis/games_v1/classes.rb +67 -14
- data/generated/google/apis/games_v1/representations.rb +31 -2
- data/generated/google/apis/games_v1/service.rb +33 -0
- data/generated/google/apis/games_v1.rb +1 -1
- data/generated/google/apis/gameservices_v1/service.rb +14 -14
- data/generated/google/apis/gameservices_v1.rb +1 -1
- data/generated/google/apis/gameservices_v1beta/service.rb +14 -14
- data/generated/google/apis/gameservices_v1beta.rb +1 -1
- data/generated/google/apis/genomics_v2alpha1/classes.rb +11 -7
- data/generated/google/apis/genomics_v2alpha1.rb +1 -1
- data/generated/google/apis/gmailpostmastertools_v1beta1/classes.rb +9 -0
- data/generated/google/apis/gmailpostmastertools_v1beta1/representations.rb +1 -0
- data/generated/google/apis/gmailpostmastertools_v1beta1.rb +1 -1
- data/generated/google/apis/healthcare_v1/classes.rb +18 -23
- data/generated/google/apis/healthcare_v1/representations.rb +0 -1
- data/generated/google/apis/healthcare_v1/service.rb +13 -12
- data/generated/google/apis/healthcare_v1.rb +1 -1
- data/generated/google/apis/healthcare_v1beta1/classes.rb +63 -36
- data/generated/google/apis/healthcare_v1beta1/representations.rb +3 -1
- data/generated/google/apis/healthcare_v1beta1/service.rb +37 -37
- data/generated/google/apis/healthcare_v1beta1.rb +1 -1
- data/generated/google/apis/iam_v1/classes.rb +101 -0
- data/generated/google/apis/iam_v1/representations.rb +33 -0
- data/generated/google/apis/iam_v1/service.rb +62 -0
- data/generated/google/apis/iam_v1.rb +1 -1
- data/generated/google/apis/iap_v1/classes.rb +0 -6
- data/generated/google/apis/iap_v1/representations.rb +0 -1
- data/generated/google/apis/iap_v1.rb +1 -1
- data/generated/google/apis/iap_v1beta1/classes.rb +0 -6
- data/generated/google/apis/iap_v1beta1/representations.rb +0 -1
- data/generated/google/apis/iap_v1beta1.rb +1 -1
- data/generated/google/apis/jobs_v3/classes.rb +9 -807
- data/generated/google/apis/jobs_v3/representations.rb +0 -272
- data/generated/google/apis/jobs_v3.rb +1 -1
- data/generated/google/apis/jobs_v3p1beta1/classes.rb +9 -768
- data/generated/google/apis/jobs_v3p1beta1/representations.rb +0 -257
- data/generated/google/apis/jobs_v3p1beta1.rb +1 -1
- data/generated/google/apis/jobs_v4/classes.rb +2699 -0
- data/generated/google/apis/jobs_v4/representations.rb +934 -0
- data/generated/google/apis/jobs_v4/service.rb +903 -0
- data/generated/google/apis/{jobs_v2.rb → jobs_v4.rb} +6 -6
- data/generated/google/apis/licensing_v1/classes.rb +26 -8
- data/generated/google/apis/licensing_v1/representations.rb +12 -0
- data/generated/google/apis/licensing_v1/service.rb +32 -29
- data/generated/google/apis/licensing_v1.rb +1 -1
- data/generated/google/apis/lifesciences_v2beta/classes.rb +25 -0
- data/generated/google/apis/lifesciences_v2beta/representations.rb +15 -0
- data/generated/google/apis/lifesciences_v2beta.rb +1 -1
- data/generated/google/apis/localservices_v1.rb +4 -1
- data/generated/google/apis/logging_v2/classes.rb +5 -4
- data/generated/google/apis/logging_v2.rb +1 -1
- data/generated/google/apis/managedidentities_v1/classes.rb +16 -11
- data/generated/google/apis/managedidentities_v1/representations.rb +0 -1
- data/generated/google/apis/managedidentities_v1.rb +1 -1
- data/generated/google/apis/managedidentities_v1alpha1/classes.rb +18 -12
- data/generated/google/apis/managedidentities_v1alpha1/representations.rb +0 -1
- data/generated/google/apis/managedidentities_v1alpha1.rb +1 -1
- data/generated/google/apis/managedidentities_v1beta1/classes.rb +4 -7
- data/generated/google/apis/managedidentities_v1beta1/representations.rb +0 -1
- data/generated/google/apis/managedidentities_v1beta1.rb +1 -1
- data/generated/google/apis/manufacturers_v1/classes.rb +2 -2
- data/generated/google/apis/manufacturers_v1.rb +1 -1
- data/generated/google/apis/metastore_v1beta/classes.rb +1151 -0
- data/generated/google/apis/metastore_v1beta/representations.rb +479 -0
- data/generated/google/apis/metastore_v1beta/service.rb +800 -0
- data/generated/google/apis/metastore_v1beta.rb +35 -0
- data/generated/google/apis/ml_v1/classes.rb +51 -24
- data/generated/google/apis/ml_v1/representations.rb +16 -1
- data/generated/google/apis/ml_v1.rb +1 -1
- data/generated/google/apis/monitoring_v3/classes.rb +15 -10
- data/generated/google/apis/monitoring_v3/service.rb +5 -4
- data/generated/google/apis/monitoring_v3.rb +1 -1
- data/generated/google/apis/notebooks_v1/classes.rb +13 -6
- data/generated/google/apis/notebooks_v1/representations.rb +12 -1
- data/generated/google/apis/notebooks_v1/service.rb +34 -0
- data/generated/google/apis/notebooks_v1.rb +1 -1
- data/generated/google/apis/osconfig_v1/classes.rb +419 -0
- data/generated/google/apis/osconfig_v1/representations.rb +168 -0
- data/generated/google/apis/osconfig_v1.rb +1 -1
- data/generated/google/apis/osconfig_v1beta/classes.rb +419 -0
- data/generated/google/apis/osconfig_v1beta/representations.rb +168 -0
- data/generated/google/apis/osconfig_v1beta.rb +1 -1
- data/generated/google/apis/pagespeedonline_v5/service.rb +3 -3
- data/generated/google/apis/pagespeedonline_v5.rb +1 -1
- data/generated/google/apis/people_v1/classes.rb +6 -2
- data/generated/google/apis/people_v1.rb +1 -1
- data/generated/google/apis/privateca_v1beta1/classes.rb +2 -1
- data/generated/google/apis/privateca_v1beta1.rb +1 -1
- data/generated/google/apis/prod_tt_sasportal_v1alpha1.rb +1 -1
- data/generated/google/apis/pubsub_v1/classes.rb +0 -6
- data/generated/google/apis/pubsub_v1/representations.rb +0 -1
- data/generated/google/apis/pubsub_v1.rb +1 -1
- data/generated/google/apis/pubsub_v1beta2/classes.rb +0 -6
- data/generated/google/apis/pubsub_v1beta2/representations.rb +0 -1
- data/generated/google/apis/pubsub_v1beta2.rb +1 -1
- data/generated/google/apis/recommendationengine_v1beta1/service.rb +2 -1
- data/generated/google/apis/recommendationengine_v1beta1.rb +1 -1
- data/generated/google/apis/recommender_v1/classes.rb +2 -2
- data/generated/google/apis/recommender_v1.rb +1 -1
- data/generated/google/apis/recommender_v1beta1/classes.rb +2 -2
- data/generated/google/apis/recommender_v1beta1/service.rb +317 -0
- data/generated/google/apis/recommender_v1beta1.rb +1 -1
- data/generated/google/apis/redis_v1/classes.rb +2 -2
- data/generated/google/apis/redis_v1.rb +1 -1
- data/generated/google/apis/redis_v1beta1/classes.rb +2 -2
- data/generated/google/apis/redis_v1beta1.rb +1 -1
- data/generated/google/apis/remotebuildexecution_v1/classes.rb +5 -30
- data/generated/google/apis/remotebuildexecution_v1/representations.rb +1 -16
- data/generated/google/apis/remotebuildexecution_v1.rb +1 -1
- data/generated/google/apis/remotebuildexecution_v1alpha/classes.rb +5 -30
- data/generated/google/apis/remotebuildexecution_v1alpha/representations.rb +1 -16
- data/generated/google/apis/remotebuildexecution_v1alpha.rb +1 -1
- data/generated/google/apis/remotebuildexecution_v2/classes.rb +5 -30
- data/generated/google/apis/remotebuildexecution_v2/representations.rb +1 -16
- data/generated/google/apis/remotebuildexecution_v2.rb +1 -1
- data/generated/google/apis/reseller_v1/service.rb +5 -5
- data/generated/google/apis/reseller_v1.rb +4 -4
- data/generated/google/apis/run_v1/classes.rb +2 -1
- data/generated/google/apis/run_v1.rb +1 -1
- data/generated/google/apis/run_v1alpha1/classes.rb +2 -1
- data/generated/google/apis/run_v1alpha1.rb +1 -1
- data/generated/google/apis/safebrowsing_v4/classes.rb +277 -277
- data/generated/google/apis/safebrowsing_v4/representations.rb +128 -128
- data/generated/google/apis/safebrowsing_v4/service.rb +44 -44
- data/generated/google/apis/safebrowsing_v4.rb +1 -1
- data/generated/google/apis/searchconsole_v1/classes.rb +7 -0
- data/generated/google/apis/searchconsole_v1/representations.rb +1 -0
- data/generated/google/apis/searchconsole_v1.rb +1 -1
- data/generated/google/apis/securitycenter_v1/classes.rb +109 -10
- data/generated/google/apis/securitycenter_v1/representations.rb +38 -0
- data/generated/google/apis/securitycenter_v1/service.rb +1464 -430
- data/generated/google/apis/securitycenter_v1.rb +1 -1
- data/generated/google/apis/securitycenter_v1beta1/classes.rb +75 -0
- data/generated/google/apis/securitycenter_v1beta1/representations.rb +33 -0
- data/generated/google/apis/securitycenter_v1beta1.rb +1 -1
- data/generated/google/apis/securitycenter_v1beta2/classes.rb +75 -0
- data/generated/google/apis/securitycenter_v1beta2/representations.rb +33 -0
- data/generated/google/apis/securitycenter_v1beta2.rb +1 -1
- data/generated/google/apis/serviceconsumermanagement_v1beta1/classes.rb +11 -10
- data/generated/google/apis/serviceconsumermanagement_v1beta1.rb +1 -1
- data/generated/google/apis/servicecontrol_v1/service.rb +2 -2
- data/generated/google/apis/servicecontrol_v1.rb +3 -3
- data/generated/google/apis/servicecontrol_v2/service.rb +2 -2
- data/generated/google/apis/servicecontrol_v2.rb +3 -3
- data/generated/google/apis/servicedirectory_v1/classes.rb +721 -0
- data/generated/google/apis/servicedirectory_v1/representations.rb +304 -0
- data/generated/google/apis/servicedirectory_v1/service.rb +957 -0
- data/generated/google/apis/servicedirectory_v1.rb +35 -0
- data/generated/google/apis/servicedirectory_v1beta1/classes.rb +0 -6
- data/generated/google/apis/servicedirectory_v1beta1/representations.rb +0 -1
- data/generated/google/apis/servicedirectory_v1beta1.rb +1 -1
- data/generated/google/apis/servicemanagement_v1/classes.rb +11 -10
- data/generated/google/apis/servicemanagement_v1.rb +1 -1
- data/generated/google/apis/servicenetworking_v1/classes.rb +57 -4
- data/generated/google/apis/servicenetworking_v1/representations.rb +19 -1
- data/generated/google/apis/servicenetworking_v1.rb +1 -1
- data/generated/google/apis/servicenetworking_v1beta/classes.rb +37 -4
- data/generated/google/apis/servicenetworking_v1beta/representations.rb +17 -1
- data/generated/google/apis/servicenetworking_v1beta.rb +1 -1
- data/generated/google/apis/serviceusage_v1/classes.rb +11 -10
- data/generated/google/apis/serviceusage_v1.rb +1 -1
- data/generated/google/apis/serviceusage_v1beta1/classes.rb +11 -10
- data/generated/google/apis/serviceusage_v1beta1.rb +1 -1
- data/generated/google/apis/sheets_v4/classes.rb +309 -0
- data/generated/google/apis/sheets_v4/representations.rb +99 -0
- data/generated/google/apis/sheets_v4.rb +1 -1
- data/generated/google/apis/slides_v1/classes.rb +9 -3
- data/generated/google/apis/slides_v1.rb +1 -1
- data/generated/google/apis/spanner_v1/classes.rb +9 -6
- data/generated/google/apis/spanner_v1/representations.rb +1 -1
- data/generated/google/apis/spanner_v1.rb +1 -1
- data/generated/google/apis/speech_v1p1beta1.rb +1 -1
- data/generated/google/apis/sqladmin_v1beta4/classes.rb +97 -14
- data/generated/google/apis/sqladmin_v1beta4/representations.rb +34 -0
- data/generated/google/apis/sqladmin_v1beta4/service.rb +5 -2
- data/generated/google/apis/sqladmin_v1beta4.rb +1 -1
- data/generated/google/apis/storage_v1/classes.rb +7 -0
- data/generated/google/apis/storage_v1/representations.rb +1 -0
- data/generated/google/apis/storage_v1.rb +1 -1
- data/generated/google/apis/storagetransfer_v1/classes.rb +39 -16
- data/generated/google/apis/storagetransfer_v1/representations.rb +3 -0
- data/generated/google/apis/storagetransfer_v1.rb +1 -1
- data/generated/google/apis/testing_v1/classes.rb +1 -1
- data/generated/google/apis/testing_v1.rb +1 -1
- data/generated/google/apis/trafficdirector_v2/service.rb +1 -1
- data/generated/google/apis/trafficdirector_v2.rb +2 -2
- data/generated/google/apis/transcoder_v1beta1/classes.rb +12 -2
- data/generated/google/apis/transcoder_v1beta1/representations.rb +1 -0
- data/generated/google/apis/transcoder_v1beta1.rb +1 -1
- data/generated/google/apis/translate_v3/classes.rb +1 -1
- data/generated/google/apis/translate_v3.rb +1 -1
- data/generated/google/apis/translate_v3beta1/classes.rb +1 -1
- data/generated/google/apis/translate_v3beta1.rb +1 -1
- data/generated/google/apis/vault_v1/classes.rb +76 -0
- data/generated/google/apis/vault_v1/representations.rb +45 -0
- data/generated/google/apis/vault_v1.rb +1 -1
- data/generated/google/apis/vectortile_v1/classes.rb +59 -4
- data/generated/google/apis/vectortile_v1/representations.rb +19 -0
- data/generated/google/apis/vectortile_v1.rb +1 -1
- data/generated/google/apis/videointelligence_v1/classes.rb +65 -0
- data/generated/google/apis/videointelligence_v1/representations.rb +15 -0
- data/generated/google/apis/videointelligence_v1.rb +1 -1
- data/generated/google/apis/videointelligence_v1beta2/classes.rb +65 -0
- data/generated/google/apis/videointelligence_v1beta2/representations.rb +15 -0
- data/generated/google/apis/videointelligence_v1beta2.rb +1 -1
- data/generated/google/apis/videointelligence_v1p1beta1/classes.rb +65 -0
- data/generated/google/apis/videointelligence_v1p1beta1/representations.rb +15 -0
- data/generated/google/apis/videointelligence_v1p1beta1.rb +1 -1
- data/generated/google/apis/videointelligence_v1p2beta1/classes.rb +65 -0
- data/generated/google/apis/videointelligence_v1p2beta1/representations.rb +15 -0
- data/generated/google/apis/videointelligence_v1p2beta1.rb +1 -1
- data/generated/google/apis/videointelligence_v1p3beta1/classes.rb +65 -0
- data/generated/google/apis/videointelligence_v1p3beta1/representations.rb +15 -0
- data/generated/google/apis/videointelligence_v1p3beta1.rb +1 -1
- data/generated/google/apis/webmasters_v3/classes.rb +8 -0
- data/generated/google/apis/webmasters_v3/representations.rb +1 -0
- data/generated/google/apis/workflows_v1beta/classes.rb +4 -4
- data/generated/google/apis/workflows_v1beta.rb +1 -1
- data/generated/google/apis/youtube_v3/classes.rb +20 -145
- data/generated/google/apis/youtube_v3/representations.rb +0 -57
- data/generated/google/apis/youtube_v3/service.rb +0 -43
- data/generated/google/apis/youtube_v3.rb +1 -1
- data/lib/google/apis/version.rb +1 -23
- metadata +55 -275
- data/.github/CONTRIBUTING.md +0 -31
- data/.github/ISSUE_TEMPLATE/bug_report.md +0 -36
- data/.github/ISSUE_TEMPLATE/feature_request.md +0 -21
- data/.github/ISSUE_TEMPLATE/support_request.md +0 -7
- data/.github/workflows/autoapprove.yml +0 -49
- data/.github/workflows/release-please.yml +0 -77
- data/.gitignore +0 -23
- data/.kokoro/build.bat +0 -11
- data/.kokoro/build.sh +0 -4
- data/.kokoro/continuous/common.cfg +0 -25
- data/.kokoro/continuous/linux.cfg +0 -25
- data/.kokoro/continuous/osx.cfg +0 -8
- data/.kokoro/continuous/post.cfg +0 -30
- data/.kokoro/continuous/windows.cfg +0 -29
- data/.kokoro/osx.sh +0 -4
- data/.kokoro/presubmit/common.cfg +0 -24
- data/.kokoro/presubmit/linux.cfg +0 -24
- data/.kokoro/presubmit/osx.cfg +0 -8
- data/.kokoro/presubmit/windows.cfg +0 -29
- data/.kokoro/release.cfg +0 -94
- data/.kokoro/trampoline.bat +0 -10
- data/.kokoro/trampoline.sh +0 -4
- data/.repo-metadata.json +0 -5
- data/.rspec +0 -2
- data/.rubocop.yml +0 -12
- data/.rubocop_todo.yml +0 -63
- data/CODE_OF_CONDUCT.md +0 -43
- data/Gemfile +0 -55
- data/MIGRATING.md +0 -215
- data/README.md +0 -402
- data/Rakefile +0 -131
- data/api_list_config.yaml +0 -9
- data/api_names.yaml +0 -1082
- data/bin/generate-api +0 -194
- data/docs/api-keys.md +0 -20
- data/docs/auth.md +0 -53
- data/docs/client-secrets.md +0 -69
- data/docs/getting-started.md +0 -340
- data/docs/installation.md +0 -0
- data/docs/logging.md +0 -34
- data/docs/media-upload.md +0 -25
- data/docs/oauth-installed.md +0 -191
- data/docs/oauth-server.md +0 -133
- data/docs/oauth-web.md +0 -280
- data/docs/oauth.md +0 -268
- data/docs/pagination.md +0 -29
- data/docs/performance.md +0 -25
- data/generated/google/apis/bigqueryreservation_v1alpha2/classes.rb +0 -426
- data/generated/google/apis/bigqueryreservation_v1alpha2/representations.rb +0 -195
- data/generated/google/apis/bigqueryreservation_v1alpha2/service.rb +0 -622
- data/generated/google/apis/jobs_v2/classes.rb +0 -4012
- data/generated/google/apis/jobs_v2/representations.rb +0 -1396
- data/generated/google/apis/jobs_v2/service.rb +0 -693
- data/google-api-client.gemspec +0 -36
- data/lib/google/api_client/auth/installed_app.rb +0 -143
- data/lib/google/api_client/auth/key_utils.rb +0 -94
- data/lib/google/api_client/auth/storage.rb +0 -104
- data/lib/google/api_client/auth/storages/file_store.rb +0 -57
- data/lib/google/api_client/auth/storages/redis_store.rb +0 -59
- data/lib/google/api_client/client_secrets.rb +0 -176
- data/lib/google/apis/core/api_command.rb +0 -209
- data/lib/google/apis/core/base_service.rb +0 -447
- data/lib/google/apis/core/batch.rb +0 -236
- data/lib/google/apis/core/composite_io.rb +0 -97
- data/lib/google/apis/core/download.rb +0 -118
- data/lib/google/apis/core/hashable.rb +0 -44
- data/lib/google/apis/core/http_command.rb +0 -447
- data/lib/google/apis/core/json_representation.rb +0 -153
- data/lib/google/apis/core/multipart.rb +0 -135
- data/lib/google/apis/core/upload.rb +0 -273
- data/lib/google/apis/errors.rb +0 -89
- data/lib/google/apis/generator/annotator.rb +0 -339
- data/lib/google/apis/generator/helpers.rb +0 -76
- data/lib/google/apis/generator/model.rb +0 -187
- data/lib/google/apis/generator/template.rb +0 -124
- data/lib/google/apis/generator/templates/_class.tmpl +0 -43
- data/lib/google/apis/generator/templates/_method.tmpl +0 -92
- data/lib/google/apis/generator/templates/_representation.tmpl +0 -51
- data/lib/google/apis/generator/templates/_representation_stub.tmpl +0 -17
- data/lib/google/apis/generator/templates/_representation_type.tmpl +0 -10
- data/lib/google/apis/generator/templates/classes.rb.tmpl +0 -29
- data/lib/google/apis/generator/templates/module.rb.tmpl +0 -40
- data/lib/google/apis/generator/templates/representations.rb.tmpl +0 -32
- data/lib/google/apis/generator/templates/service.rb.tmpl +0 -61
- data/lib/google/apis/generator.rb +0 -71
- data/lib/google/apis/options.rb +0 -116
- data/lib/google/apis.rb +0 -58
- data/rakelib/devsite/devsite_builder.rb +0 -126
- data/rakelib/devsite/link_checker.rb +0 -64
- data/rakelib/devsite/repo_metadata.rb +0 -56
- data/rakelib/metrics.rake +0 -22
- data/rakelib/rubocop.rake +0 -10
- data/rakelib/spec.rake +0 -11
- data/rakelib/yard.rake +0 -11
- data/samples/cli/.env +0 -4
- data/samples/cli/Gemfile +0 -7
- data/samples/cli/README.md +0 -51
- data/samples/cli/google-api-samples +0 -32
- data/samples/cli/lib/base_cli.rb +0 -95
- data/samples/cli/lib/samples/adsense.rb +0 -99
- data/samples/cli/lib/samples/analytics.rb +0 -80
- data/samples/cli/lib/samples/androidpublisher.rb +0 -47
- data/samples/cli/lib/samples/bigquery.rb +0 -101
- data/samples/cli/lib/samples/calendar.rb +0 -83
- data/samples/cli/lib/samples/drive.rb +0 -82
- data/samples/cli/lib/samples/gmail.rb +0 -157
- data/samples/cli/lib/samples/pubsub.rb +0 -114
- data/samples/cli/lib/samples/sheets.rb +0 -61
- data/samples/cli/lib/samples/translate.rb +0 -44
- data/samples/cli/lib/samples/vision.rb +0 -69
- data/samples/cli/lib/samples/you_tube.rb +0 -47
- data/samples/web/Gemfile +0 -9
- data/samples/web/README.md +0 -44
- data/samples/web/app.rb +0 -120
- data/samples/web/views/calendar.erb +0 -34
- data/samples/web/views/drive.erb +0 -33
- data/samples/web/views/home.erb +0 -34
- data/samples/web/views/layout.erb +0 -40
- data/synth.py +0 -40
data/docs/oauth-web.md
DELETED
@@ -1,280 +0,0 @@
|
|
1
|
-
# Using OAuth 2.0 for Web Server Applications
|
2
|
-
|
3
|
-
This document explains how web server applications use the Google API Client Library for Ruby to implement OAuth 2.0 authorization to access Google APIs. OAuth 2.0 allows users to share specific data with an application while keeping their usernames, passwords, and other information private. For example, an application can use OAuth 2.0 to obtain permission from users to store files in their Google Drives.
|
4
|
-
|
5
|
-
This OAuth 2.0 flow is specifically for user authorization. It is designed for applications that can store confidential information and maintain state. A properly authorized web server application can access an API while the user interacts with the application or after the user has left the application.
|
6
|
-
|
7
|
-
Web server applications frequently also use [service accounts](service-accounts.md) to authorize API requests, particularly when calling Cloud APIs to access project-based data rather than user-specific data. Web server applications can use service accounts in conjunction with user authorization.
|
8
|
-
|
9
|
-
## Prerequisites
|
10
|
-
|
11
|
-
### Enable APIs for your project
|
12
|
-
|
13
|
-
Any application that calls Google APIs needs to enable those APIs in the API Console. To enable the appropriate APIs for your project:
|
14
|
-
|
15
|
-
1. Open the [Library](https://console.developers.google.com/apis/library) page in the API Console.
|
16
|
-
1. Select the project associated with your application. Create a project if you do not have one already.
|
17
|
-
1. Use the **Library** page to find each API that your application will use. Click on each API and enable it for your project.
|
18
|
-
|
19
|
-
### Create authorization credentials
|
20
|
-
|
21
|
-
Any application that uses OAuth 2.0 to access Google APIs must have authorization credentials that identify the application to Google's OAuth 2.0 server. The following steps explain how to create credentials for your project. Your applications can then use the credentials to access APIs that you have enabled for that project.
|
22
|
-
|
23
|
-
<ol>
|
24
|
-
<li>Open the <a href="https://console.developers.google.com/apis/credentials">Credentials page</a> in the API Console.</li>
|
25
|
-
|
26
|
-
<li>Click <b>Create credentials > OAuth client ID</b>.</li>
|
27
|
-
<li>Complete the form. Set the application type to <code>Web
|
28
|
-
application</code>. Applications that use languages and frameworks
|
29
|
-
like PHP, Java, Python, Ruby, and .NET must specify authorized
|
30
|
-
<b>redirect URIs</b>. The redirect URIs are the endpoints to which the
|
31
|
-
OAuth 2.0 server can send responses.<br><br>
|
32
|
-
For testing, you can specify URIs that refer to the local machine,
|
33
|
-
such as <code>http://localhost:8080</code>. With that in mind, please
|
34
|
-
note that all of the examples in this document use
|
35
|
-
<code>http://localhost:8080</code> as the redirect URI.
|
36
|
-
<br><br>
|
37
|
-
We recommend that you <a href="#protectauthcode">design your app's auth
|
38
|
-
endpoints</a> so that your application does not expose authorization
|
39
|
-
codes to other resources on the page.</li>
|
40
|
-
</ol>
|
41
|
-
|
42
|
-
After creating your credentials, download the **client_secret.json** file from the API Console. Securely store the file in a location that only your application can access.
|
43
|
-
|
44
|
-
> **Important:** Do not store the **client_secret.json** file in a publicly-accessible location. In addition, if you share the source code to your application—for example, on GitHub—store the **client_secret.json** file outside of your source tree to avoid inadvertently sharing your client credentials.
|
45
|
-
|
46
|
-
### Identify access scopes
|
47
|
-
|
48
|
-
Scopes enable your application to only request access to the resources that it needs while also enabling users to control the amount of access that they grant to your application. Thus, there may be an inverse relationship between the number of scopes requested and the likelihood of obtaining user consent.
|
49
|
-
|
50
|
-
Before you start implementing OAuth 2.0 authorization, we recommend that you identify the scopes that your app will need permission to access.
|
51
|
-
|
52
|
-
We also recommend that your application request access to authorization scopes via an incremental authorization process, in which your application requests access to user data in context. This best practice helps users to more easily understand why your application needs the access it is requesting.
|
53
|
-
|
54
|
-
The [OAuth 2.0 API Scopes document](https://developers.google.com/identity/protocols/googlescopes) contains a full list of scopes that you might use to access Google APIs.
|
55
|
-
|
56
|
-
## Obtaining OAuth 2.0 access tokens
|
57
|
-
|
58
|
-
The following steps show how your application interacts with Google's OAuth 2.0 server to obtain a user's consent to perform an API request on the user's behalf. Your application must have that consent before it can execute a Google API request that requires user authorization.
|
59
|
-
|
60
|
-
### Step 1: Configure the client object
|
61
|
-
|
62
|
-
Your first step is to configure the client object, which your application uses to obtain user authorization and to make authorized API requests.
|
63
|
-
|
64
|
-
The client object identifies the scopes that your application is requesting permission to access. These values inform the consent screen that Google displays to the user. The Choosing access scopes section provides information about how to determine which scopes your application should request permission to access.
|
65
|
-
|
66
|
-
Use the client_secrets.json file that you created to configure a client object in your application. When you configure a client object, you specify the scopes your application needs to access, along with the URL to your application's auth endpoint, which will handle the response from the OAuth 2.0 server.
|
67
|
-
|
68
|
-
For example, to request read-only, offline access to a user's Google Drive:
|
69
|
-
|
70
|
-
```rb
|
71
|
-
require 'google/apis/drive_v2'
|
72
|
-
require 'google/api_client/client_secrets'
|
73
|
-
|
74
|
-
client_secrets = Google::APIClient::ClientSecrets.load
|
75
|
-
auth_client = client_secrets.to_authorization
|
76
|
-
auth_client.update!(
|
77
|
-
:scope => 'https://www.googleapis.com/auth/drive.metadata.readonly',
|
78
|
-
:redirect_uri => 'http://www.example.com/oauth2callback',
|
79
|
-
:additional_parameters => {
|
80
|
-
"access_type" => "offline", # offline access
|
81
|
-
"include_granted_scopes" => "true" # incremental auth
|
82
|
-
}
|
83
|
-
)
|
84
|
-
```
|
85
|
-
|
86
|
-
Your application uses the client object to perform OAuth 2.0 operations, such as generating authorization request URLs and applying access tokens to HTTP requests.
|
87
|
-
|
88
|
-
### Step 2: Redirect to Google's OAuth 2.0 server
|
89
|
-
|
90
|
-
When your application needs to access a user's data, redirect the user to Google's OAuth 2.0 server.
|
91
|
-
|
92
|
-
1. Generate a URL to request access from Google's OAuth 2.0 server:
|
93
|
-
|
94
|
-
```rb
|
95
|
-
auth_uri = auth_client.authorization_uri.to_s
|
96
|
-
```
|
97
|
-
|
98
|
-
2. Redirect the user to auth_uri.
|
99
|
-
|
100
|
-
Google's OAuth 2.0 server authenticates the user and obtains consent from the user for your application to access the requested scopes. The response is sent back to your application using the redirect URL you specified.
|
101
|
-
|
102
|
-
### Step 3: Google prompts user for consent
|
103
|
-
|
104
|
-
In this step, the user decides whether to grant your application the requested access. At this stage, Google displays a consent window that shows the name of your application and the Google API services that it is requesting permission to access with the user's authorization credentials. The user can then consent or refuse to grant access to your application.
|
105
|
-
|
106
|
-
Your application doesn't need to do anything at this stage as it waits for the response from Google's OAuth 2.0 server indicating whether the access was granted. That response is explained in the following step.
|
107
|
-
|
108
|
-
### Step 4: Handle the OAuth 2.0 server response
|
109
|
-
|
110
|
-
The OAuth 2.0 server responds to your application's access request by using the URL specified in the request.
|
111
|
-
|
112
|
-
If the user approves the access request, then the response contains an authorization code. If the user does not approve the request, the response contains an error message. The authorization code or error message that is returned to the web server appears on the query string, as shown below:
|
113
|
-
|
114
|
-
An error response:
|
115
|
-
|
116
|
-
```
|
117
|
-
https://oauth2.example.com/auth?error=access_denied
|
118
|
-
```
|
119
|
-
|
120
|
-
An authorization code response:
|
121
|
-
|
122
|
-
```
|
123
|
-
https://oauth2.example.com/auth?code=4/P7q7W91a-oMsCeLvIaQm6bTrgtp7
|
124
|
-
```
|
125
|
-
|
126
|
-
> Important: If your response endpoint renders an HTML page, any resources on that page will be able to see the authorization code in the URL. Scripts can read the URL directly, and the URL in the Referer HTTP header may be sent to any or all resources on the page.
|
127
|
-
>
|
128
|
-
> Carefully consider whether you want to send authorization credentials to all resources on that page (especially third-party scripts such as social plugins and analytics). To avoid this issue, we recommend that the server first handle the request, then redirect to another URL that doesn't include the response parameters.
|
129
|
-
|
130
|
-
**Sample OAuth 2.0 server response**
|
131
|
-
|
132
|
-
You can test this flow by clicking on the following sample URL, which requests read-only access to view metadata for files in your Google Drive:
|
133
|
-
|
134
|
-
```
|
135
|
-
https://accounts.google.com/o/oauth2/v2/auth?
|
136
|
-
scope=https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fdrive.metadata.readonly&
|
137
|
-
access_type=offline&
|
138
|
-
include_granted_scopes=true&
|
139
|
-
state=state_parameter_passthrough_value&
|
140
|
-
redirect_uri=http%3A%2F%2Foauth2.example.com%2Fcallback&
|
141
|
-
response_type=code&
|
142
|
-
client_id=client_id
|
143
|
-
```
|
144
|
-
|
145
|
-
After completing the OAuth 2.0 flow, you should be redirected to http://localhost/oauth2callback, which will likely yield a 404 NOT FOUND error unless your local machine serves a file at that address. The next step provides more detail about the information returned in the URI when the user is redirected back to your application.
|
146
|
-
|
147
|
-
### Step 5: Exchange authorization code for refresh and access tokens
|
148
|
-
|
149
|
-
After the web server receives the authorization code, it can exchange the authorization code for an access token.
|
150
|
-
|
151
|
-
To exchange an authorization code for an access token, use the fetch_access_token! method:
|
152
|
-
|
153
|
-
```rb
|
154
|
-
auth_client.code = auth_code
|
155
|
-
auth_client.fetch_access_token!
|
156
|
-
```
|
157
|
-
|
158
|
-
## Calling Google APIs
|
159
|
-
|
160
|
-
Use the auth_client object to call Google APIs by completing the following steps:
|
161
|
-
|
162
|
-
1. Build a service object for the API that you want to call. For example, to call version 2 of the Drive API:
|
163
|
-
`drive = Google::Apis::DriveV2::DriveService.new`
|
164
|
-
2. Set the credentials on the service:
|
165
|
-
`drive.authorization = auth_client`
|
166
|
-
3. Make requests to the API service using the interface provided by the service object. For example, to list the files in the authenticated user's Google Drive:
|
167
|
-
`files = drive.list_files`
|
168
|
-
|
169
|
-
Alternately, authorization can be provided on a per-method basis by supplying the options parameter to a method:
|
170
|
-
|
171
|
-
`files = drive.list_files(options: { authorization: auth_client })`
|
172
|
-
|
173
|
-
## Complete example
|
174
|
-
|
175
|
-
The following example prints a JSON-formatted list of files in a user's Google Drive after the user authenticates and gives consent for the application to access the user's Drive files.
|
176
|
-
|
177
|
-
This example uses the Sinatra framework.
|
178
|
-
|
179
|
-
```rb
|
180
|
-
require 'google/apis/drive_v2'
|
181
|
-
require 'google/api_client/client_secrets'
|
182
|
-
require 'json'
|
183
|
-
require 'sinatra'
|
184
|
-
|
185
|
-
enable :sessions
|
186
|
-
set :session_secret, 'setme'
|
187
|
-
|
188
|
-
get '/' do
|
189
|
-
unless session.has_key?(:credentials)
|
190
|
-
redirect to('/oauth2callback')
|
191
|
-
end
|
192
|
-
client_opts = JSON.parse(session[:credentials])
|
193
|
-
auth_client = Signet::OAuth2::Client.new(client_opts)
|
194
|
-
drive = Google::Apis::DriveV2::DriveService.new
|
195
|
-
files = drive.list_files(options: { authorization: auth_client })
|
196
|
-
"<pre>#{JSON.pretty_generate(files.to_h)}</pre>"
|
197
|
-
end
|
198
|
-
|
199
|
-
get '/oauth2callback' do
|
200
|
-
client_secrets = Google::APIClient::ClientSecrets.load
|
201
|
-
auth_client = client_secrets.to_authorization
|
202
|
-
auth_client.update!(
|
203
|
-
:scope => 'https://www.googleapis.com/auth/drive.metadata.readonly',
|
204
|
-
:redirect_uri => url('/oauth2callback'))
|
205
|
-
if request['code'] == nil
|
206
|
-
auth_uri = auth_client.authorization_uri.to_s
|
207
|
-
redirect to(auth_uri)
|
208
|
-
else
|
209
|
-
auth_client.code = request['code']
|
210
|
-
auth_client.fetch_access_token!
|
211
|
-
auth_client.client_secret = nil
|
212
|
-
session[:credentials] = auth_client.to_json
|
213
|
-
redirect to('/')
|
214
|
-
end
|
215
|
-
end
|
216
|
-
```
|
217
|
-
|
218
|
-
## Incremental authorization
|
219
|
-
|
220
|
-
In the OAuth 2.0 protocol, your app requests authorization to access resources, which are identified by scopes. It is considered a best user-experience practice to request authorization for resources at the time you need them. To enable that practice, Google's authorization server supports incremental authorization. This feature lets you request scopes as they are needed and, if the user grants permission, add those scopes to your existing access token for that user.
|
221
|
-
|
222
|
-
For example, an app that lets people sample music tracks and create mixes might need very few resources at sign-in time, perhaps nothing more than the name of the person signing in. However, saving a completed mix would require access to their Google Drive. Most people would find it natural if they only were asked for access to their Google Drive at the time the app actually needed it.
|
223
|
-
|
224
|
-
In this case, at sign-in time the app might request the profile scope to perform basic sign-in, and then later request the https://www.googleapis.com/auth/drive.file scope at the time of the first request to save a mix.
|
225
|
-
|
226
|
-
To implement incremental authorization, you complete the normal flow for requesting an access token but make sure that the authorization request includes previously granted scopes. This approach allows your app to avoid having to manage multiple access tokens.
|
227
|
-
|
228
|
-
The following rules apply to an access token obtained from an incremental authorization:
|
229
|
-
|
230
|
-
The token can be used to access resources corresponding to any of the scopes rolled into the new, combined authorization.
|
231
|
-
When you use the refresh token for the combined authorization to obtain an access token, the access token represents the combined authorization and can be used for any of its scopes.
|
232
|
-
The combined authorization includes all scopes that the user granted to the API project even if the grants were requested from different clients. For example, if a user granted access to one scope using an application's desktop client and then granted another scope to the same application via a mobile client, the combined authorization would include both scopes.
|
233
|
-
If you revoke a token that represents a combined authorization, access to all of that authorization's scopes on behalf of the associated user are revoked simultaneously.
|
234
|
-
The example for configuring the client object demonstrates how to ensure authorization requests follow this best practice. The code snippet below also shows the code that you need to add to use incremental authorization.
|
235
|
-
|
236
|
-
```rb
|
237
|
-
auth_client.update!(
|
238
|
-
:additional_parameters => {"include_granted_scopes" => "true"}
|
239
|
-
)
|
240
|
-
```
|
241
|
-
|
242
|
-
## Refreshing an access token (offline access)
|
243
|
-
|
244
|
-
Access tokens periodically expire. You can refresh an access token without prompting the user for permission (including when the user is not present) if you requested offline access to the scopes associated with the token.
|
245
|
-
|
246
|
-
If you use a Google API Client Library, the client object refreshes the access token as needed as long as you configure that object for offline access.
|
247
|
-
|
248
|
-
Requesting offline access is a requirement for any application that needs to access a Google API when the user is not present. For example, an app that performs backup services or executes actions at predetermined times needs to be able to refresh its access token when the user is not present. The default style of access is called online.
|
249
|
-
|
250
|
-
Server-side web applications, installed applications, and devices all obtain refresh tokens during the authorization process. Refresh tokens are not typically used in client-side (JavaScript) web applications.
|
251
|
-
|
252
|
-
If your application needs offline access to a Google API, set the API client's access type to offline:
|
253
|
-
|
254
|
-
```rb
|
255
|
-
auth_client.update!(
|
256
|
-
:additional_parameters => {"access_type" => "offline"}
|
257
|
-
)
|
258
|
-
```
|
259
|
-
|
260
|
-
After a user grants offline access to the requested scopes, you can continue to use the API client to access Google APIs on the user's behalf when the user is offline. The client object will refresh the access token as needed.
|
261
|
-
|
262
|
-
## Revoking a token
|
263
|
-
|
264
|
-
In some cases a user may wish to revoke access given to an application. A user can revoke access by visiting Account Settings. It is also possible for an application to programmatically revoke the access given to it. Programmatic revocation is important in instances where a user unsubscribes or removes an application. In other words, part of the removal process can include an API request to ensure the permissions granted to the application are removed.
|
265
|
-
|
266
|
-
To programmatically revoke a token, make an HTTP request to the oauth2.revoke endpoint:
|
267
|
-
|
268
|
-
```rb
|
269
|
-
uri = URI('https://accounts.google.com/o/oauth2/revoke')
|
270
|
-
params = { :token => auth_client.access_token }
|
271
|
-
uri.query = URI.encode_www_form(params)
|
272
|
-
response = Net::HTTP.get(uri)
|
273
|
-
```
|
274
|
-
|
275
|
-
The token can be an access token or a refresh token. If the token is an access token and it has a corresponding refresh token, the refresh token will also be revoked.
|
276
|
-
|
277
|
-
If the revocation is successfully processed, then the status code of the response is 200. For error conditions, a status code 400 is returned along with an error code.
|
278
|
-
|
279
|
-
> Note: Following a successful revocation response, it might take some time before the revocation has full effect.
|
280
|
-
|
data/docs/oauth.md
DELETED
@@ -1,268 +0,0 @@
|
|
1
|
-
# OAuth 2.0
|
2
|
-
|
3
|
-
This document describes OAuth 2.0, when to use it, how to acquire client IDs and client secrets, and generally how to use OAuth 2.0 with the Google API Client Library for Ruby.
|
4
|
-
|
5
|
-
## About OAuth 2.0
|
6
|
-
|
7
|
-
OAuth 2.0 is the authorization protocol used by Google APIs. It is summarized on the Authentication page of this library's documentation, and there are other good references as well:
|
8
|
-
|
9
|
-
- [The OAuth 2.0 Authorization Protocol](https://tools.ietf.org/html/rfc6749)
|
10
|
-
- [Using OAuth 2.0 to Access Google APIs](https://developers.google.com/identity/protocols/OAuth2)
|
11
|
-
|
12
|
-
## Acquiring client IDs and secrets
|
13
|
-
|
14
|
-
To find your project's client ID and client secret, do the following:
|
15
|
-
|
16
|
-
Select an existing OAuth 2.0 credential or open the Credentials page.
|
17
|
-
If you haven't done so already, create your project's OAuth 2.0 credentials by clicking Create credentials > OAuth client ID, and providing the information needed to create the credentials.
|
18
|
-
Look for the Client ID in the OAuth 2.0 client IDs section. For details, click the client ID.
|
19
|
-
There are different types of client IDs, so be sure to get the correct type for your application:
|
20
|
-
|
21
|
-
* Web application client IDs
|
22
|
-
* Installed application client IDs
|
23
|
-
* [Service Account](https://developers.google.com/accounts/docs/OAuth2ServiceAccount) client IDs
|
24
|
-
|
25
|
-
**Warning**: Keep your client secret private. If someone obtains your client secret, they could use it to consume your quota, incur charges against your Google APIs Console project, and request access to user data.
|
26
|
-
|
27
|
-
## The Signet library
|
28
|
-
|
29
|
-
The [Signet](https://github.com/googleapis/signet) library is included with the Google API Client Library for Ruby. It handles all steps of the OAuth 2.0 protocol required for making API calls. It is available as a separate gem if you only need an OAuth 2.0 library.
|
30
|
-
|
31
|
-
## Flows
|
32
|
-
|
33
|
-
There are three main OAuth 2.0 flows in the Google API Client Library for Ruby: web server, installed application and service account.
|
34
|
-
|
35
|
-
## Web server
|
36
|
-
|
37
|
-
We start by retrieving the client ID and client secret from a preconfigured client_secrets.json file:
|
38
|
-
|
39
|
-
```rb
|
40
|
-
client_secrets = Google::APIClient::ClientSecrets.load
|
41
|
-
```
|
42
|
-
For web-based applications, we then redirect the user to an authorization page:
|
43
|
-
|
44
|
-
```rb
|
45
|
-
# Request authorization
|
46
|
-
redirect user_credentials.authorization_uri.to_s, 303
|
47
|
-
```
|
48
|
-
|
49
|
-
The user completes the steps on her browser, and control gets returned to the application via the callback URL:
|
50
|
-
|
51
|
-
```rb
|
52
|
-
get '/oauth2callback' do
|
53
|
-
# Exchange token
|
54
|
-
user_credentials.code = params[:code] if params[:code]
|
55
|
-
user_credentials.fetch_access_token!
|
56
|
-
redirect to('/')
|
57
|
-
end
|
58
|
-
```
|
59
|
-
|
60
|
-
user_credentials now has everything needed to make authenticated requests:
|
61
|
-
|
62
|
-
```rb
|
63
|
-
events = calendar.list_events('primary', options: { authorization: user_credentials })
|
64
|
-
```
|
65
|
-
|
66
|
-
Below is the full sample we've been looking at.
|
67
|
-
|
68
|
-
```rb
|
69
|
-
require 'google/apis/calendar_v3'
|
70
|
-
require 'google/api_client/client_secrets'
|
71
|
-
require 'sinatra'
|
72
|
-
require 'logger'
|
73
|
-
|
74
|
-
enable :sessions
|
75
|
-
|
76
|
-
def logger; settings.logger end
|
77
|
-
|
78
|
-
def calendar; settings.calendar; end
|
79
|
-
|
80
|
-
def user_credentials
|
81
|
-
# Build a per-request oauth credential based on token stored in session
|
82
|
-
# which allows us to use a shared API client.
|
83
|
-
@authorization ||= (
|
84
|
-
auth = settings.authorization.dup
|
85
|
-
auth.redirect_uri = to('/oauth2callback')
|
86
|
-
auth.update_token!(session)
|
87
|
-
auth
|
88
|
-
)
|
89
|
-
end
|
90
|
-
|
91
|
-
configure do
|
92
|
-
log_file = File.open('calendar.log', 'a+')
|
93
|
-
log_file.sync = true
|
94
|
-
logger = Logger.new(log_file)
|
95
|
-
logger.level = Logger::DEBUG
|
96
|
-
|
97
|
-
Google::Apis::ClientOptions.default.application_name = 'Ruby Calendar sample'
|
98
|
-
Google::Apis::ClientOptions.default.application_version = '1.0.0'
|
99
|
-
calendar_api = Google::Apis::CalendarV3::CalendarService.new
|
100
|
-
|
101
|
-
client_secrets = Google::APIClient::ClientSecrets.load
|
102
|
-
authorization = client_secrets.to_authorization
|
103
|
-
authorization.scope = 'https://www.googleapis.com/auth/calendar'
|
104
|
-
|
105
|
-
set :authorization, authorization
|
106
|
-
set :logger, logger
|
107
|
-
set :calendar, calendar_api
|
108
|
-
end
|
109
|
-
|
110
|
-
before do
|
111
|
-
# Ensure user has authorized the app
|
112
|
-
unless user_credentials.access_token || request.path_info =~ /^\/oauth2/
|
113
|
-
redirect to('/oauth2authorize')
|
114
|
-
end
|
115
|
-
end
|
116
|
-
|
117
|
-
after do
|
118
|
-
# Serialize the access/refresh token to the session and credential store.
|
119
|
-
session[:access_token] = user_credentials.access_token
|
120
|
-
session[:refresh_token] = user_credentials.refresh_token
|
121
|
-
session[:expires_in] = user_credentials.expires_in
|
122
|
-
session[:issued_at] = user_credentials.issued_at
|
123
|
-
end
|
124
|
-
|
125
|
-
get '/oauth2authorize' do
|
126
|
-
# Request authorization
|
127
|
-
redirect user_credentials.authorization_uri.to_s, 303
|
128
|
-
end
|
129
|
-
|
130
|
-
get '/oauth2callback' do
|
131
|
-
# Exchange token
|
132
|
-
user_credentials.code = params[:code] if params[:code]
|
133
|
-
user_credentials.fetch_access_token!
|
134
|
-
redirect to('/')
|
135
|
-
end
|
136
|
-
|
137
|
-
get '/' do
|
138
|
-
# Fetch list of events on the user's default calandar
|
139
|
-
events = calendar.list_events('primary', options: { authorization: user_credentials })
|
140
|
-
[200, {'Content-Type' => 'application/json'}, events.to_h.to_json]
|
141
|
-
end
|
142
|
-
```
|
143
|
-
|
144
|
-
### Installed application
|
145
|
-
|
146
|
-
We start by retrieving the client ID and client secret from a preconfigured client_secrets.json file:
|
147
|
-
|
148
|
-
```rb
|
149
|
-
client_secrets = Google::APIClient::ClientSecrets.load
|
150
|
-
```
|
151
|
-
|
152
|
-
For installed applications, we can use the Google::APIClient::InstalledAppFlow helper class to handle most of the setup:
|
153
|
-
|
154
|
-
```rb
|
155
|
-
flow = Google::APIClient::InstalledAppFlow.new(
|
156
|
-
:client_id => client_secrets.client_id,
|
157
|
-
:client_secret => client_secrets.client_secret,
|
158
|
-
:scope => ['https://www.googleapis.com/auth/adsense.readonly']
|
159
|
-
)
|
160
|
-
```
|
161
|
-
|
162
|
-
The user completes the steps on her browser, which is opened automatically, and the authorization code is fed into the application automatically, so all it takes is:
|
163
|
-
|
164
|
-
```rb
|
165
|
-
adsense.authorization = flow.authorize(storage)
|
166
|
-
```
|
167
|
-
|
168
|
-
The client now has everything needed to make an authenticated request:
|
169
|
-
|
170
|
-
```rb
|
171
|
-
report = adsense.generate_report(start_date: '2011-01-01', end_date: '2011-08-31',
|
172
|
-
metric: %w(PAGE_VIEWS AD_REQUESTS AD_REQUESTS_COVERAGE
|
173
|
-
CLICKS AD_REQUESTS_CTR COST_PER_CLICK
|
174
|
-
AD_REQUESTS_RPM EARNINGS),
|
175
|
-
dimension: %w(DATE),
|
176
|
-
sort: %w(+DATE))
|
177
|
-
```
|
178
|
-
|
179
|
-
Below is the full sample we've been looking at.
|
180
|
-
|
181
|
-
```rb
|
182
|
-
# AdSense Management API command-line sample.
|
183
|
-
require 'google/apis/adsense_v1_4'
|
184
|
-
require 'google/api_client/client_secrets'
|
185
|
-
require 'google/api_client/auth/installed_app'
|
186
|
-
require 'google/api_client/auth/storage'
|
187
|
-
require 'google/api_client/auth/storages/file_store'
|
188
|
-
require 'logger'
|
189
|
-
require 'json'
|
190
|
-
|
191
|
-
CREDENTIAL_STORE_FILE = "#{$0}-oauth2.json"
|
192
|
-
|
193
|
-
# Handles authentication and loading of the API.
|
194
|
-
def setup
|
195
|
-
log_file = File.open('adsense.log', 'a+')
|
196
|
-
log_file.sync = true
|
197
|
-
logger = Logger.new(log_file)
|
198
|
-
logger.level = Logger::DEBUG
|
199
|
-
|
200
|
-
adsense = Google::Apis::AdsenseV1_4::AdSenseService.new
|
201
|
-
|
202
|
-
# Stores auth credentials in a file, so they survive multiple runs
|
203
|
-
# of the application. This avoids prompting the user for authorization every
|
204
|
-
# time the access token expires, by remembering the refresh token.
|
205
|
-
# Note: FileStorage is not suitable for multi-user applications.
|
206
|
-
storage = Google::APIClient::Storage.new(
|
207
|
-
Google::APIClient::FileStore.new(CREDENTIAL_STORE_FILE))
|
208
|
-
adsense.authorization = storage.authorize
|
209
|
-
if storage.authorization.nil?
|
210
|
-
client_secrets = Google::APIClient::ClientSecrets.load
|
211
|
-
# The InstalledAppFlow is a helper class to handle the OAuth 2.0 installed
|
212
|
-
# application flow, which ties in with Stroage to store credentials
|
213
|
-
# between runs.
|
214
|
-
flow = Google::APIClient::InstalledAppFlow.new(
|
215
|
-
:client_id => client_secrets.client_id,
|
216
|
-
:client_secret => client_secrets.client_secret,
|
217
|
-
:scope => ['https://www.googleapis.com/auth/adsense.readonly']
|
218
|
-
)
|
219
|
-
adsense.authorization = flow.authorize(storage)
|
220
|
-
end
|
221
|
-
return adsense
|
222
|
-
end
|
223
|
-
|
224
|
-
# Generates a report for the default account.
|
225
|
-
def generate_report(adsense)
|
226
|
-
report = adsense.generate_report(start_date: '2011-01-01', end_date: '2011-08-31',
|
227
|
-
metric: %w(PAGE_VIEWS AD_REQUESTS AD_REQUESTS_COVERAGE
|
228
|
-
CLICKS AD_REQUESTS_CTR COST_PER_CLICK
|
229
|
-
AD_REQUESTS_RPM EARNINGS),
|
230
|
-
dimension: %w(DATE),
|
231
|
-
sort: %w(+DATE))
|
232
|
-
|
233
|
-
# Display headers.
|
234
|
-
report.headers.each do |header|
|
235
|
-
print '%25s' % header.name
|
236
|
-
end
|
237
|
-
puts
|
238
|
-
|
239
|
-
# Display results.
|
240
|
-
report.rows.each do |row|
|
241
|
-
row.each do |column|
|
242
|
-
print '%25s' % column
|
243
|
-
end
|
244
|
-
puts
|
245
|
-
end
|
246
|
-
end
|
247
|
-
|
248
|
-
|
249
|
-
if __FILE__ == $0
|
250
|
-
adsense = setup()
|
251
|
-
generate_report(adsense)
|
252
|
-
end
|
253
|
-
```
|
254
|
-
|
255
|
-
## Service accounts
|
256
|
-
|
257
|
-
For server-to-server interactions, like those between a web application and Google Cloud Storage, Prediction, or BigQuery APIs, you can use service accounts.
|
258
|
-
|
259
|
-
```rb
|
260
|
-
require 'googleauth'
|
261
|
-
require 'google/apis/compute_v1'
|
262
|
-
|
263
|
-
compute = Google::Apis::ComputeV1::ComputeService.new
|
264
|
-
|
265
|
-
# Get the environment configured authorization
|
266
|
-
scopes = ['https://www.googleapis.com/auth/cloud-platform', 'https://www.googleapis.com/auth/compute']
|
267
|
-
compute.authorization = Google::Auth.get_application_default(scopes)
|
268
|
-
```
|
data/docs/pagination.md
DELETED
@@ -1,29 +0,0 @@
|
|
1
|
-
# Pagination
|
2
|
-
|
3
|
-
Some API methods may return very large lists of data. To reduce the response size, many of these API methods support pagination. With paginated results, your application can iteratively request and process large lists one page at a time. When using API methods that support pagination, responses will come back with a next_page property, which builds a request for the next page for you.
|
4
|
-
|
5
|
-
To process the first page of results, construct a request as you normally would. There's usually an API-level parameter you can provide to specify the maximum size of each page, so be sure to check the API's documentation.
|
6
|
-
|
7
|
-
`stamps = service.list_stamps(cents: 5, max_results: 20)`
|
8
|
-
|
9
|
-
For further pages, repeat the request including the next page token from the previous result.
|
10
|
-
|
11
|
-
`stamps = service.list_stamps(cents:5, max_results: 20, page_token: stamps.next_page_token)`
|
12
|
-
|
13
|
-
Here is a full example which loops through the paginated results of a user's public Google Plus activities feed:
|
14
|
-
|
15
|
-
```rb
|
16
|
-
require 'google/apis/plus_v1'
|
17
|
-
|
18
|
-
plus = Google::Apis::PlusV1::PlusService.new
|
19
|
-
plus.key = '...' # API Key from the Google Developers Console
|
20
|
-
next_page = nil
|
21
|
-
begin
|
22
|
-
puts "Fetching page of activities"
|
23
|
-
activities = plus.list_activities('103354693083460731603', 'public', page_token: next_page)
|
24
|
-
activities.items.each do |activity|
|
25
|
-
puts "#{activity.published} #{activity.title}"
|
26
|
-
end
|
27
|
-
next_page = activities.next_page_token
|
28
|
-
end while next_page
|
29
|
-
```
|
data/docs/performance.md
DELETED
@@ -1,25 +0,0 @@
|
|
1
|
-
# Performance Tips
|
2
|
-
|
3
|
-
This document covers techniques you can use to improve the performance of your application. The documentation for the specific API you are using should have a similar page with more detail on some of these topics. For example, see the Performance Tips page for the Google Drive API.
|
4
|
-
|
5
|
-
## Partial response (fields parameter)
|
6
|
-
|
7
|
-
By default, the server sends back the full representation of a resource after processing requests. For better performance, you can ask the server to send only the fields you really need and get a partial response instead.
|
8
|
-
|
9
|
-
To request a partial response, add the standard fields parameter to any API method. The value of this parameter specifies the fields you want returned. You can use this parameter with any request that returns response data.
|
10
|
-
|
11
|
-
In the following code snippet, the list_stamps method of a fictitious Stamps API is called. The cents parameter is defined by the API to only return stamps with the given value. The value of the fields parameter is set to 'count,items/name'code>. The response will only contain stamps whose value is 5 cents, and the data returned will only include the number of stamps found along with the stamp names:
|
12
|
-
|
13
|
-
`response = service.list_stamps(cents: 5, fields: 'count,items/name')`
|
14
|
-
|
15
|
-
Note how commas are used to delimit the desired fields, and slashes are used to indicate fields that are contained in parent fields. There are other formatting options for the fields parameter, and you should see the "Performance Tips" page in the documentation for the API you are using.
|
16
|
-
|
17
|
-
## Partial update (patch)
|
18
|
-
|
19
|
-
If the API you are calling supports patch, you can avoid sending unnecessary data when modifying resources. For these APIs, you can call the patch() method and supply the arguments you wish to modify for the resource. If supported, the API's reference will have documentation for the patch() method.
|
20
|
-
|
21
|
-
For more information about patch semantics, see the "Performance Tips" page in the documentation for the API you are using.
|
22
|
-
|
23
|
-
## Batch
|
24
|
-
|
25
|
-
If you are sending many small requests you may benefit from batching, which allows those requests to be bundled into a single HTTP request.
|