google-api-client 0.34.1 → 0.35.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (312) hide show
  1. checksums.yaml +4 -4
  2. data/.yardopts +16 -3
  3. data/CHANGELOG.md +114 -0
  4. data/OVERVIEW.md +36 -0
  5. data/README.md +49 -1
  6. data/Rakefile +1 -1
  7. data/docs/api-keys.md +20 -0
  8. data/docs/auth.md +53 -0
  9. data/docs/client-secrets.md +69 -0
  10. data/docs/getting-started.md +340 -0
  11. data/docs/installation.md +0 -0
  12. data/docs/logging.md +34 -0
  13. data/docs/media-upload.md +25 -0
  14. data/docs/oauth-installed.md +191 -0
  15. data/docs/oauth-server.md +135 -0
  16. data/docs/oauth-web.md +280 -0
  17. data/docs/oauth.md +268 -0
  18. data/docs/pagination.md +29 -0
  19. data/docs/performance.md +25 -0
  20. data/generated/google/apis/adexchangebuyer2_v2beta1.rb +1 -1
  21. data/generated/google/apis/adexchangebuyer_v1_3.rb +1 -1
  22. data/generated/google/apis/adexchangebuyer_v1_3/classes.rb +9 -0
  23. data/generated/google/apis/adexchangebuyer_v1_3/representations.rb +1 -0
  24. data/generated/google/apis/adexchangebuyer_v1_4.rb +1 -1
  25. data/generated/google/apis/adexchangebuyer_v1_4/classes.rb +9 -0
  26. data/generated/google/apis/adexchangebuyer_v1_4/representations.rb +1 -0
  27. data/generated/google/apis/androidmanagement_v1.rb +1 -1
  28. data/generated/google/apis/androidpublisher_v3.rb +1 -1
  29. data/generated/google/apis/androidpublisher_v3/classes.rb +93 -0
  30. data/generated/google/apis/androidpublisher_v3/representations.rb +49 -0
  31. data/generated/google/apis/appengine_v1.rb +1 -1
  32. data/generated/google/apis/appengine_v1beta.rb +1 -1
  33. data/generated/google/apis/appsmarket_v2.rb +1 -1
  34. data/generated/google/apis/bigquery_v2.rb +1 -1
  35. data/generated/google/apis/bigquery_v2/classes.rb +46 -4
  36. data/generated/google/apis/bigquery_v2/representations.rb +17 -0
  37. data/generated/google/apis/bigquery_v2/service.rb +1 -5
  38. data/generated/google/apis/bigqueryconnection_v1beta1.rb +1 -1
  39. data/generated/google/apis/bigqueryconnection_v1beta1/classes.rb +6 -5
  40. data/generated/google/apis/bigquerydatatransfer_v1.rb +1 -1
  41. data/generated/google/apis/bigquerydatatransfer_v1/service.rb +30 -4
  42. data/generated/google/apis/bigqueryreservation_v1.rb +1 -1
  43. data/generated/google/apis/bigqueryreservation_v1/classes.rb +0 -21
  44. data/generated/google/apis/bigqueryreservation_v1/representations.rb +0 -13
  45. data/generated/google/apis/bigqueryreservation_v1alpha2.rb +1 -1
  46. data/generated/google/apis/bigqueryreservation_v1alpha2/classes.rb +116 -1
  47. data/generated/google/apis/bigqueryreservation_v1alpha2/representations.rb +35 -0
  48. data/generated/google/apis/bigqueryreservation_v1alpha2/service.rb +71 -0
  49. data/generated/google/apis/bigqueryreservation_v1beta1.rb +1 -1
  50. data/generated/google/apis/bigqueryreservation_v1beta1/classes.rb +61 -77
  51. data/generated/google/apis/bigqueryreservation_v1beta1/representations.rb +16 -17
  52. data/generated/google/apis/bigqueryreservation_v1beta1/service.rb +112 -78
  53. data/generated/google/apis/bigtableadmin_v1.rb +1 -1
  54. data/generated/google/apis/bigtableadmin_v1/classes.rb +1 -1
  55. data/generated/google/apis/bigtableadmin_v2.rb +1 -1
  56. data/generated/google/apis/bigtableadmin_v2/classes.rb +1 -1
  57. data/generated/google/apis/bigtableadmin_v2/service.rb +1 -1
  58. data/generated/google/apis/{sqladmin_v1beta4.rb → billingbudgets_v1beta1.rb} +10 -13
  59. data/generated/google/apis/billingbudgets_v1beta1/classes.rb +392 -0
  60. data/generated/google/apis/billingbudgets_v1beta1/representations.rb +191 -0
  61. data/generated/google/apis/billingbudgets_v1beta1/service.rb +233 -0
  62. data/generated/google/apis/binaryauthorization_v1.rb +1 -1
  63. data/generated/google/apis/binaryauthorization_v1/classes.rb +6 -5
  64. data/generated/google/apis/binaryauthorization_v1beta1.rb +1 -1
  65. data/generated/google/apis/binaryauthorization_v1beta1/classes.rb +6 -5
  66. data/generated/google/apis/books_v1.rb +1 -1
  67. data/generated/google/apis/books_v1/classes.rb +20 -0
  68. data/generated/google/apis/books_v1/representations.rb +3 -0
  69. data/generated/google/apis/calendar_v3.rb +1 -1
  70. data/generated/google/apis/calendar_v3/classes.rb +1 -1
  71. data/generated/google/apis/calendar_v3/service.rb +18 -30
  72. data/generated/google/apis/civicinfo_v2.rb +1 -1
  73. data/generated/google/apis/civicinfo_v2/classes.rb +0 -156
  74. data/generated/google/apis/civicinfo_v2/representations.rb +0 -58
  75. data/generated/google/apis/cloudasset_v1.rb +1 -1
  76. data/generated/google/apis/cloudasset_v1/classes.rb +6 -5
  77. data/generated/google/apis/cloudasset_v1beta1.rb +1 -1
  78. data/generated/google/apis/cloudasset_v1beta1/classes.rb +6 -5
  79. data/generated/google/apis/cloudbilling_v1.rb +1 -1
  80. data/generated/google/apis/cloudbilling_v1/classes.rb +17 -0
  81. data/generated/google/apis/cloudbuild_v1.rb +1 -1
  82. data/generated/google/apis/cloudbuild_v1/classes.rb +8 -2
  83. data/generated/google/apis/cloudbuild_v1/representations.rb +1 -0
  84. data/generated/google/apis/cloudbuild_v1/service.rb +18 -18
  85. data/generated/google/apis/cloudbuild_v1alpha1.rb +1 -1
  86. data/generated/google/apis/cloudbuild_v1alpha1/classes.rb +8 -2
  87. data/generated/google/apis/cloudbuild_v1alpha1/representations.rb +1 -0
  88. data/generated/google/apis/cloudbuild_v1alpha1/service.rb +4 -1
  89. data/generated/google/apis/cloudfunctions_v1.rb +1 -1
  90. data/generated/google/apis/cloudfunctions_v1/classes.rb +13 -5
  91. data/generated/google/apis/cloudfunctions_v1/representations.rb +1 -0
  92. data/generated/google/apis/cloudfunctions_v1/service.rb +3 -1
  93. data/generated/google/apis/cloudiot_v1.rb +1 -1
  94. data/generated/google/apis/cloudiot_v1/classes.rb +6 -5
  95. data/generated/google/apis/cloudkms_v1.rb +1 -1
  96. data/generated/google/apis/cloudkms_v1/classes.rb +6 -5
  97. data/generated/google/apis/cloudprivatecatalogproducer_v1beta1.rb +1 -1
  98. data/generated/google/apis/cloudprivatecatalogproducer_v1beta1/classes.rb +6 -5
  99. data/generated/google/apis/cloudresourcemanager_v1.rb +1 -1
  100. data/generated/google/apis/cloudresourcemanager_v1/classes.rb +6 -5
  101. data/generated/google/apis/cloudresourcemanager_v1beta1.rb +1 -1
  102. data/generated/google/apis/cloudresourcemanager_v1beta1/classes.rb +6 -5
  103. data/generated/google/apis/cloudresourcemanager_v2.rb +1 -1
  104. data/generated/google/apis/cloudresourcemanager_v2/classes.rb +6 -5
  105. data/generated/google/apis/cloudresourcemanager_v2beta1.rb +1 -1
  106. data/generated/google/apis/cloudresourcemanager_v2beta1/classes.rb +6 -5
  107. data/generated/google/apis/cloudscheduler_v1.rb +1 -1
  108. data/generated/google/apis/cloudscheduler_v1/classes.rb +2 -1
  109. data/generated/google/apis/cloudscheduler_v1beta1.rb +1 -1
  110. data/generated/google/apis/cloudscheduler_v1beta1/classes.rb +2 -1
  111. data/generated/google/apis/cloudsearch_v1.rb +8 -8
  112. data/generated/google/apis/cloudsearch_v1/classes.rb +5 -130
  113. data/generated/google/apis/cloudsearch_v1/representations.rb +0 -75
  114. data/generated/google/apis/cloudsearch_v1/service.rb +42 -7
  115. data/generated/google/apis/cloudtasks_v2.rb +1 -1
  116. data/generated/google/apis/cloudtasks_v2/classes.rb +212 -5
  117. data/generated/google/apis/cloudtasks_v2/representations.rb +50 -0
  118. data/generated/google/apis/cloudtasks_v2beta2.rb +1 -1
  119. data/generated/google/apis/cloudtasks_v2beta2/classes.rb +6 -5
  120. data/generated/google/apis/cloudtasks_v2beta3.rb +1 -1
  121. data/generated/google/apis/cloudtasks_v2beta3/classes.rb +6 -5
  122. data/generated/google/apis/commentanalyzer_v1alpha1.rb +1 -1
  123. data/generated/google/apis/commentanalyzer_v1alpha1/classes.rb +14 -19
  124. data/generated/google/apis/compute_alpha.rb +1 -1
  125. data/generated/google/apis/compute_alpha/classes.rb +75 -12
  126. data/generated/google/apis/compute_alpha/representations.rb +2 -0
  127. data/generated/google/apis/compute_beta.rb +1 -1
  128. data/generated/google/apis/compute_beta/classes.rb +54 -10
  129. data/generated/google/apis/compute_v1.rb +1 -1
  130. data/generated/google/apis/compute_v1/classes.rb +54 -10
  131. data/generated/google/apis/containeranalysis_v1alpha1.rb +1 -1
  132. data/generated/google/apis/containeranalysis_v1alpha1/classes.rb +6 -5
  133. data/generated/google/apis/containeranalysis_v1beta1.rb +1 -1
  134. data/generated/google/apis/containeranalysis_v1beta1/classes.rb +6 -5
  135. data/generated/google/apis/content_v2.rb +1 -1
  136. data/generated/google/apis/content_v2/classes.rb +13 -4
  137. data/generated/google/apis/content_v2_1.rb +1 -1
  138. data/generated/google/apis/content_v2_1/classes.rb +13 -4
  139. data/generated/google/apis/datacatalog_v1beta1.rb +35 -0
  140. data/generated/google/apis/datacatalog_v1beta1/classes.rb +1646 -0
  141. data/generated/google/apis/datacatalog_v1beta1/representations.rb +700 -0
  142. data/generated/google/apis/datacatalog_v1beta1/service.rb +1982 -0
  143. data/generated/google/apis/dataproc_v1.rb +1 -1
  144. data/generated/google/apis/dataproc_v1/classes.rb +75 -4
  145. data/generated/google/apis/dataproc_v1/representations.rb +22 -0
  146. data/generated/google/apis/dataproc_v1/service.rb +14 -7
  147. data/generated/google/apis/dataproc_v1beta2.rb +1 -1
  148. data/generated/google/apis/dataproc_v1beta2/classes.rb +2 -4
  149. data/generated/google/apis/dataproc_v1beta2/service.rb +14 -7
  150. data/generated/google/apis/dfareporting_v3_3.rb +1 -1
  151. data/generated/google/apis/dfareporting_v3_3/classes.rb +21 -1
  152. data/generated/google/apis/dfareporting_v3_3/service.rb +6 -6
  153. data/generated/google/apis/dfareporting_v3_4.rb +40 -0
  154. data/generated/google/apis/dfareporting_v3_4/classes.rb +12717 -0
  155. data/generated/google/apis/dfareporting_v3_4/representations.rb +4595 -0
  156. data/generated/google/apis/dfareporting_v3_4/service.rb +8685 -0
  157. data/generated/google/apis/dialogflow_v2.rb +1 -1
  158. data/generated/google/apis/dialogflow_v2/classes.rb +484 -1
  159. data/generated/google/apis/dialogflow_v2/representations.rb +220 -0
  160. data/generated/google/apis/dialogflow_v2beta1.rb +1 -1
  161. data/generated/google/apis/dialogflow_v2beta1/classes.rb +497 -1
  162. data/generated/google/apis/dialogflow_v2beta1/representations.rb +221 -0
  163. data/generated/google/apis/dlp_v2.rb +1 -1
  164. data/generated/google/apis/dlp_v2/classes.rb +68 -25
  165. data/generated/google/apis/dlp_v2/representations.rb +9 -4
  166. data/generated/google/apis/dlp_v2/service.rb +1925 -193
  167. data/generated/google/apis/dns_v1beta2.rb +1 -1
  168. data/generated/google/apis/dns_v1beta2/classes.rb +47 -0
  169. data/generated/google/apis/dns_v1beta2/representations.rb +17 -0
  170. data/generated/google/apis/docs_v1.rb +1 -1
  171. data/generated/google/apis/docs_v1/classes.rb +4 -8
  172. data/generated/google/apis/doubleclickbidmanager_v1.rb +1 -1
  173. data/generated/google/apis/doubleclickbidmanager_v1_1.rb +34 -0
  174. data/generated/google/apis/doubleclickbidmanager_v1_1/classes.rb +826 -0
  175. data/generated/google/apis/doubleclickbidmanager_v1_1/representations.rb +372 -0
  176. data/generated/google/apis/doubleclickbidmanager_v1_1/service.rb +371 -0
  177. data/generated/google/apis/drive_v3.rb +1 -1
  178. data/generated/google/apis/drive_v3/classes.rb +12 -3
  179. data/generated/google/apis/fcm_v1.rb +1 -1
  180. data/generated/google/apis/fcm_v1/classes.rb +15 -0
  181. data/generated/google/apis/fcm_v1/representations.rb +2 -0
  182. data/generated/google/apis/firebase_v1beta1.rb +1 -1
  183. data/generated/google/apis/firebase_v1beta1/classes.rb +3 -4
  184. data/generated/google/apis/firebase_v1beta1/service.rb +6 -6
  185. data/generated/google/apis/firebasehosting_v1beta1.rb +1 -1
  186. data/generated/google/apis/firebasehosting_v1beta1/classes.rb +25 -0
  187. data/generated/google/apis/firebasehosting_v1beta1/representations.rb +15 -0
  188. data/generated/google/apis/firebasehosting_v1beta1/service.rb +47 -0
  189. data/generated/google/apis/firebaserules_v1.rb +1 -1
  190. data/generated/google/apis/firebaserules_v1/classes.rb +26 -0
  191. data/generated/google/apis/firebaserules_v1/representations.rb +15 -0
  192. data/generated/google/apis/genomics_v2alpha1.rb +1 -1
  193. data/generated/google/apis/genomics_v2alpha1/classes.rb +32 -0
  194. data/generated/google/apis/genomics_v2alpha1/representations.rb +16 -0
  195. data/generated/google/apis/healthcare_v1beta1.rb +1 -1
  196. data/generated/google/apis/healthcare_v1beta1/classes.rb +8 -7
  197. data/generated/google/apis/homegraph_v1.rb +1 -1
  198. data/generated/google/apis/homegraph_v1/classes.rb +15 -1
  199. data/generated/google/apis/homegraph_v1/representations.rb +2 -1
  200. data/generated/google/apis/iam_v1.rb +1 -1
  201. data/generated/google/apis/iam_v1/classes.rb +6 -5
  202. data/generated/google/apis/logging_v2.rb +1 -1
  203. data/generated/google/apis/logging_v2/classes.rb +18 -2
  204. data/generated/google/apis/logging_v2/representations.rb +2 -0
  205. data/generated/google/apis/ml_v1.rb +1 -1
  206. data/generated/google/apis/ml_v1/classes.rb +173 -97
  207. data/generated/google/apis/ml_v1/representations.rb +58 -0
  208. data/generated/google/apis/ml_v1/service.rb +37 -0
  209. data/generated/google/apis/monitoring_v3.rb +1 -1
  210. data/generated/google/apis/monitoring_v3/classes.rb +780 -6
  211. data/generated/google/apis/monitoring_v3/representations.rb +347 -0
  212. data/generated/google/apis/monitoring_v3/service.rb +382 -0
  213. data/generated/google/apis/pagespeedonline_v5.rb +1 -1
  214. data/generated/google/apis/pagespeedonline_v5/classes.rb +8 -0
  215. data/generated/google/apis/pagespeedonline_v5/representations.rb +1 -0
  216. data/generated/google/apis/policytroubleshooter_v1beta.rb +1 -1
  217. data/generated/google/apis/policytroubleshooter_v1beta/classes.rb +6 -5
  218. data/generated/google/apis/pubsub_v1.rb +1 -1
  219. data/generated/google/apis/pubsub_v1/classes.rb +8 -6
  220. data/generated/google/apis/pubsub_v1/service.rb +6 -7
  221. data/generated/google/apis/pubsub_v1beta2.rb +1 -1
  222. data/generated/google/apis/pubsub_v1beta2/classes.rb +6 -5
  223. data/generated/google/apis/recommender_v1beta1.rb +1 -1
  224. data/generated/google/apis/recommender_v1beta1/classes.rb +1 -1
  225. data/generated/google/apis/recommender_v1beta1/service.rb +10 -8
  226. data/generated/google/apis/remotebuildexecution_v1.rb +1 -1
  227. data/generated/google/apis/remotebuildexecution_v1/classes.rb +33 -0
  228. data/generated/google/apis/remotebuildexecution_v1/representations.rb +15 -0
  229. data/generated/google/apis/remotebuildexecution_v1alpha.rb +1 -1
  230. data/generated/google/apis/remotebuildexecution_v1alpha/classes.rb +33 -0
  231. data/generated/google/apis/remotebuildexecution_v1alpha/representations.rb +15 -0
  232. data/generated/google/apis/remotebuildexecution_v2.rb +1 -1
  233. data/generated/google/apis/remotebuildexecution_v2/classes.rb +33 -0
  234. data/generated/google/apis/remotebuildexecution_v2/representations.rb +15 -0
  235. data/generated/google/apis/run_v1.rb +1 -1
  236. data/generated/google/apis/run_v1/classes.rb +8 -169
  237. data/generated/google/apis/run_v1/representations.rb +0 -71
  238. data/generated/google/apis/run_v1/service.rb +229 -1207
  239. data/generated/google/apis/run_v1alpha1.rb +1 -1
  240. data/generated/google/apis/run_v1alpha1/classes.rb +9 -9
  241. data/generated/google/apis/runtimeconfig_v1beta1.rb +1 -1
  242. data/generated/google/apis/runtimeconfig_v1beta1/classes.rb +6 -5
  243. data/generated/google/apis/securitycenter_v1.rb +1 -1
  244. data/generated/google/apis/securitycenter_v1/classes.rb +66 -11
  245. data/generated/google/apis/securitycenter_v1/representations.rb +19 -0
  246. data/generated/google/apis/securitycenter_v1beta1.rb +1 -1
  247. data/generated/google/apis/securitycenter_v1beta1/classes.rb +16 -13
  248. data/generated/google/apis/servicebroker_v1.rb +1 -1
  249. data/generated/google/apis/servicebroker_v1/classes.rb +6 -5
  250. data/generated/google/apis/servicebroker_v1alpha1.rb +1 -1
  251. data/generated/google/apis/servicebroker_v1alpha1/classes.rb +6 -5
  252. data/generated/google/apis/servicebroker_v1beta1.rb +1 -1
  253. data/generated/google/apis/servicebroker_v1beta1/classes.rb +6 -5
  254. data/generated/google/apis/serviceconsumermanagement_v1.rb +1 -1
  255. data/generated/google/apis/serviceconsumermanagement_v1/classes.rb +3 -2
  256. data/generated/google/apis/servicecontrol_v1.rb +1 -1
  257. data/generated/google/apis/servicecontrol_v1/classes.rb +8 -1
  258. data/generated/google/apis/servicecontrol_v1/representations.rb +1 -0
  259. data/generated/google/apis/servicemanagement_v1.rb +1 -1
  260. data/generated/google/apis/servicemanagement_v1/classes.rb +12 -9
  261. data/generated/google/apis/servicemanagement_v1/service.rb +1 -9
  262. data/generated/google/apis/servicenetworking_v1.rb +1 -1
  263. data/generated/google/apis/servicenetworking_v1/classes.rb +130 -13
  264. data/generated/google/apis/servicenetworking_v1/representations.rb +58 -0
  265. data/generated/google/apis/servicenetworking_v1/service.rb +42 -3
  266. data/generated/google/apis/servicenetworking_v1beta.rb +1 -1
  267. data/generated/google/apis/servicenetworking_v1beta/classes.rb +3 -2
  268. data/generated/google/apis/serviceusage_v1.rb +1 -1
  269. data/generated/google/apis/serviceusage_v1/classes.rb +3 -2
  270. data/generated/google/apis/serviceusage_v1beta1.rb +1 -1
  271. data/generated/google/apis/serviceusage_v1beta1/classes.rb +3 -2
  272. data/generated/google/apis/sheets_v4.rb +1 -1
  273. data/generated/google/apis/spanner_v1.rb +1 -1
  274. data/generated/google/apis/spanner_v1/classes.rb +70 -30
  275. data/generated/google/apis/spanner_v1/service.rb +270 -0
  276. data/generated/google/apis/speech_v1.rb +1 -1
  277. data/generated/google/apis/speech_v1/classes.rb +6 -0
  278. data/generated/google/apis/speech_v1/representations.rb +1 -0
  279. data/generated/google/apis/speech_v1p1beta1.rb +1 -1
  280. data/generated/google/apis/speech_v1p1beta1/classes.rb +6 -0
  281. data/generated/google/apis/speech_v1p1beta1/representations.rb +1 -0
  282. data/generated/google/apis/sql_v1beta4.rb +1 -1
  283. data/generated/google/apis/sql_v1beta4/service.rb +59 -10
  284. data/generated/google/apis/storagetransfer_v1.rb +1 -1
  285. data/generated/google/apis/videointelligence_v1.rb +1 -1
  286. data/generated/google/apis/videointelligence_v1/classes.rb +112 -0
  287. data/generated/google/apis/videointelligence_v1/representations.rb +62 -0
  288. data/generated/google/apis/videointelligence_v1beta2.rb +1 -1
  289. data/generated/google/apis/videointelligence_v1beta2/classes.rb +112 -0
  290. data/generated/google/apis/videointelligence_v1beta2/representations.rb +62 -0
  291. data/generated/google/apis/videointelligence_v1p1beta1.rb +1 -1
  292. data/generated/google/apis/videointelligence_v1p1beta1/classes.rb +112 -0
  293. data/generated/google/apis/videointelligence_v1p1beta1/representations.rb +62 -0
  294. data/generated/google/apis/videointelligence_v1p2beta1.rb +1 -1
  295. data/generated/google/apis/videointelligence_v1p2beta1/classes.rb +112 -0
  296. data/generated/google/apis/videointelligence_v1p2beta1/representations.rb +62 -0
  297. data/generated/google/apis/videointelligence_v1p3beta1.rb +1 -1
  298. data/generated/google/apis/videointelligence_v1p3beta1/classes.rb +112 -0
  299. data/generated/google/apis/videointelligence_v1p3beta1/representations.rb +62 -0
  300. data/generated/google/apis/youtube_partner_v1.rb +1 -1
  301. data/lib/google/apis/core/api_command.rb +3 -0
  302. data/lib/google/apis/core/http_command.rb +10 -8
  303. data/lib/google/apis/version.rb +1 -1
  304. data/rakelib/devsite/devsite_builder.rb +1 -1
  305. metadata +33 -11
  306. data/generated/google/apis/sqladmin_v1beta4/classes.rb +0 -2633
  307. data/generated/google/apis/sqladmin_v1beta4/representations.rb +0 -1110
  308. data/generated/google/apis/sqladmin_v1beta4/service.rb +0 -1793
  309. data/generated/google/apis/storage_v1beta1.rb +0 -40
  310. data/generated/google/apis/storage_v1beta1/classes.rb +0 -616
  311. data/generated/google/apis/storage_v1beta1/representations.rb +0 -249
  312. data/generated/google/apis/storage_v1beta1/service.rb +0 -1032
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1f5c6f57b6e73f8ff32192717e8bfc29c428aa183bc1d46752432491df33aa72
4
- data.tar.gz: 68a8b34179552ed160b0f9841671c9cae1a4eb1815ff11252b2195297a542785
3
+ metadata.gz: fcc784d3215a12ce376ba8c9915d579ad935a7c673ae86837f967fa2424d0647
4
+ data.tar.gz: 449e4a3c5c79905f96b9d0fcf7912089291f6e307c2849e8148dc9d2efc4883f
5
5
  SHA512:
6
- metadata.gz: 2e4a8df1d22c47dfdedb69ea883a668653c40218a4c07b290f451f7b1284cdfc005ec833240ef76568e1f5f37ca8f390acb506b2c3fed1aefb2aafb8ae74918e
7
- data.tar.gz: 95b19f198084c1fdcbf13a845bb4416c67bbedf983cee7b1bfd539aab0edaac9165fa1125194bd01ce5ec9c5e07980ca520f31defdd29642b6c193c99680bd7c
6
+ metadata.gz: fc08d3a30a1336ab5b2aa685a3e56794c65d914c4a74dbbf0e6dbbc105e61818a10931cb069018676fd1c9fcc854b28d52f1ac4e804d577042823902b3bc011c
7
+ data.tar.gz: a3f08c15420319a04a9e82f601012d6f393958f83015c885253c7df306a26ab3bef97ca964b61e38b84ef0df94d70a11d517c71b24988a69cf8ba9ae1c65c1b7
data/.yardopts CHANGED
@@ -3,10 +3,23 @@
3
3
  --verbose
4
4
  --markup-provider=redcarpet
5
5
  --markup=markdown
6
+ --main OVERVIEW.md
7
+
6
8
  lib/**/*.rb
7
- generated/**/*.rb
8
9
  -
9
- README.md
10
+ OVERVIEW.md
11
+ docs/getting-started.md
12
+ docs/installation.md
13
+ docs/auth.md
14
+ docs/api-keys.md
15
+ docs/oauth.md
16
+ docs/oauth-web.md
17
+ docs/oauth-installed.md
18
+ docs/oauth-server.md
19
+ docs/client-secrets.md
20
+ docs/logging.md
21
+ docs/media-upload.md
22
+ docs/pagination.md
23
+ docs/performance.md
10
24
  MIGRATING.md
11
- CONTRIBUTING.md
12
25
  LICENSE
data/CHANGELOG.md CHANGED
@@ -1,3 +1,115 @@
1
+ # 0.35.0
2
+ * Breaking changes:
3
+ * Deleted `storage_v1beta1`
4
+ * Backwards compatible changes:
5
+ * Added `datacatalog_v1beta1`
6
+ * Added `dfareporting_v3_4`
7
+ * Added `doubleclickbidmanager_v1_1`
8
+ * Updated `adexchangebuyer2_v2beta1`
9
+ * Updated `adexchangebuyer_v1_3`
10
+ * Updated `adexchangebuyer_v1_4`
11
+ * Updated `androidmanagement_v1`
12
+ * Updated `androidpublisher_v3`
13
+ * Updated `appengine_v1`
14
+ * Updated `appengine_v1beta`
15
+ * Updated `appsmarket_v2`
16
+ * Updated `bigquery_v2`
17
+ * Updated `bigqueryconnection_v1beta1`
18
+ * Updated `bigquerydatatransfer_v1`
19
+ * Updated `bigqueryreservation_v1`
20
+ * Updated `bigqueryreservation_v1alpha2`
21
+ * Updated `bigqueryreservation_v1beta1`
22
+ * Updated `bigtableadmin_v1`
23
+ * Updated `bigtableadmin_v2`
24
+ * Updated `binaryauthorization_v1`
25
+ * Updated `binaryauthorization_v1beta1`
26
+ * Updated `books_v1`
27
+ * Updated `calendar_v3`
28
+ * Updated `civicinfo_v2`
29
+ * Updated `cloudasset_v1`
30
+ * Updated `cloudasset_v1beta1`
31
+ * Updated `cloudbilling_v1`
32
+ * Updated `cloudbuild_v1`
33
+ * Updated `cloudbuild_v1alpha1`
34
+ * Updated `cloudfunctions_v1`
35
+ * Updated `cloudiot_v1`
36
+ * Updated `cloudkms_v1`
37
+ * Updated `cloudprivatecatalogproducer_v1beta1`
38
+ * Updated `cloudresourcemanager_v1`
39
+ * Updated `cloudresourcemanager_v1beta1`
40
+ * Updated `cloudresourcemanager_v2`
41
+ * Updated `cloudresourcemanager_v2beta1`
42
+ * Updated `cloudscheduler_v1`
43
+ * Updated `cloudscheduler_v1beta1`
44
+ * Updated `cloudsearch_v1`
45
+ * Updated `cloudtasks_v2`
46
+ * Updated `cloudtasks_v2beta2`
47
+ * Updated `cloudtasks_v2beta3`
48
+ * Updated `commentanalyzer_v1alpha1`
49
+ * Updated `compute_alpha`
50
+ * Updated `compute_beta`
51
+ * Updated `compute_v1`
52
+ * Updated `containeranalysis_v1alpha1`
53
+ * Updated `containeranalysis_v1beta1`
54
+ * Updated `content_v2`
55
+ * Updated `content_v2_1`
56
+ * Updated `dataproc_v1`
57
+ * Updated `dataproc_v1beta2`
58
+ * Updated `dfareporting_v3_3`
59
+ * Updated `dialogflow_v2`
60
+ * Updated `dialogflow_v2beta1`
61
+ * Updated `dlp_v2`
62
+ * Updated `dns_v1beta2`
63
+ * Updated `docs_v1`
64
+ * Updated `doubleclickbidmanager_v1`
65
+ * Updated `drive_v3`
66
+ * Updated `fcm_v1`
67
+ * Updated `firebase_v1beta1`
68
+ * Updated `firebasehosting_v1beta1`
69
+ * Updated `firebaserules_v1`
70
+ * Updated `genomics_v2alpha1`
71
+ * Updated `healthcare_v1beta1`
72
+ * Updated `homegraph_v1`
73
+ * Updated `iam_v1`
74
+ * Updated `logging_v2`
75
+ * Updated `ml_v1`
76
+ * Updated `monitoring_v3`
77
+ * Updated `pagespeedonline_v5`
78
+ * Updated `policytroubleshooter_v1beta`
79
+ * Updated `pubsub_v1`
80
+ * Updated `pubsub_v1beta2`
81
+ * Updated `recommender_v1beta1`
82
+ * Updated `remotebuildexecution_v1`
83
+ * Updated `remotebuildexecution_v1alpha`
84
+ * Updated `remotebuildexecution_v2`
85
+ * Updated `run_v1`
86
+ * Updated `run_v1alpha1`
87
+ * Updated `runtimeconfig_v1beta1`
88
+ * Updated `securitycenter_v1`
89
+ * Updated `securitycenter_v1beta1`
90
+ * Updated `servicebroker_v1`
91
+ * Updated `servicebroker_v1alpha1`
92
+ * Updated `servicebroker_v1beta1`
93
+ * Updated `serviceconsumermanagement_v1`
94
+ * Updated `servicecontrol_v1`
95
+ * Updated `servicemanagement_v1`
96
+ * Updated `servicenetworking_v1`
97
+ * Updated `servicenetworking_v1beta`
98
+ * Updated `serviceusage_v1`
99
+ * Updated `serviceusage_v1beta1`
100
+ * Updated `sheets_v4`
101
+ * Updated `spanner_v1`
102
+ * Updated `speech_v1`
103
+ * Updated `speech_v1p1beta1`
104
+ * Updated `sql_v1beta4`
105
+ * Updated `storagetransfer_v1`
106
+ * Updated `videointelligence_v1`
107
+ * Updated `videointelligence_v1beta2`
108
+ * Updated `videointelligence_v1p1beta1`
109
+ * Updated `videointelligence_v1p2beta1`
110
+ * Updated `videointelligence_v1p3beta1`
111
+ * Updated `youtube_partner_v1`
112
+
1
113
  # 0.34.1
2
114
  * Backwards compatible changes:
3
115
  * Updated `bigquery_v2`
@@ -174,6 +286,8 @@
174
286
  * Updated `serviceusage_v1`
175
287
  * Updated `serviceusage_v1beta1`
176
288
  * Updated `sheets_v4`
289
+ * Other changes:
290
+ * Dropped support for Ruby versions older than 2.4
177
291
 
178
292
  # 0.32.1
179
293
  * Backwards compatible changes:
data/OVERVIEW.md ADDED
@@ -0,0 +1,36 @@
1
+ # Google API Client Library for Ruby Docs
2
+
3
+ The Google API Client Library for Ruby is designed for Ruby
4
+ client-application developers. It offers simple, flexible
5
+ access to many Google APIs.
6
+
7
+ ## Features
8
+
9
+ - Call Google APIs simply
10
+ - Handle Auth with fewer lines of code
11
+ - Use standard tooling for installation
12
+
13
+ ## Documentation
14
+
15
+ Learn how to use the Google API Client Library for Ruby with these guides:
16
+
17
+ ### Usage Guides
18
+
19
+ - {file:docs/getting-started.md Getting Started}
20
+ - {file:docs/installation.md Installation}
21
+ - {file:docs/auth.md Auth}
22
+ - {file:docs/api-keys.md API Keys}
23
+ - {file:docs/oauth.md OAuth 2.0}
24
+ - {file:docs/oauth-web.md OAuth 2.0 for Web Server Applications}
25
+ - {file:docs/oauth-installed.md OAuth 2.0 for Installed Applications}
26
+ - {file:docs/oauth-server.md OAuth 2.0 for Server to Server Applications}
27
+ - {file:docs/client-secrets.md Client Secrets}
28
+ - How to...
29
+ - {file:docs/logging.md Use Logging}
30
+ - {file:docs/media-upload.md Upload Media}
31
+ - {file:docs/pagination.md Use Pagination}
32
+ - {file:docs/performance.md Improve Performance}
33
+
34
+ ### Reference Documentation
35
+
36
+ - Reference documentation for [google-api-client](https://googleapis.dev/ruby/google-api-client/latest/index.html).
data/README.md CHANGED
@@ -10,12 +10,37 @@ For Google Cloud Platform APIs such as Datastore, Cloud Storage or Pub/Sub, we r
10
10
 
11
11
  See [MIGRATING](MIGRATING.md) for additional details on how to migrate to the latest version.
12
12
 
13
+ ## Documentation
14
+
15
+ Learn how to use the Google API Client Library for Ruby with these guides:
16
+
17
+ ### Usage Guides
18
+
19
+ - [Getting Started](docs/getting-started.md)
20
+ - [Installation](docs/installation.md)
21
+ - [Auth](docs/auth.md)
22
+ - [API Keys](docs/api-keys.md)
23
+ - [OAuth 2.0](docs/oauth.md)
24
+ - [OAuth 2.0 for Web Server Applications](docs/oauth-web.md)
25
+ - [OAuth 2.0 for Installed Applications](docs/oauth-installed.md)
26
+ - [OAuth 2.0 for Server to Server Applications](docs/oauth-server.md)
27
+ - [Client Secrets](docs/client-secrets.md)
28
+ - How to...
29
+ - [Use Logging](docs/logging.md)
30
+ - [Upload Media](docs/media-upload.md)
31
+ - [Use Pagination](docs/pagination.md)
32
+ - [Improve Performance](docs/performance.md)
33
+
34
+ ### Reference Documentation
35
+
36
+ - Reference documentation for [google-api-client](https://googleapis.dev/ruby/google-api-client/latest/index.html).
37
+
13
38
  ## Installation
14
39
 
15
40
  Add this line to your application's Gemfile:
16
41
 
17
42
  ```ruby
18
- gem 'google-api-client', '~> 0.11'
43
+ gem 'google-api-client', '~> 0.34'
19
44
 
20
45
  ```
21
46
 
@@ -53,6 +78,29 @@ metadata = drive.insert_file(metadata, upload_source: 'test.txt', content_type:
53
78
  # Download a file
54
79
  drive.get_file(metadata.id, download_dest: '/tmp/myfile.txt')
55
80
  ```
81
+
82
+ An example to use the Content API (Google Merchant Center)
83
+
84
+ ```ruby
85
+ require 'google/apis/content_v2'
86
+ require 'googleauth' # https://github.com/googleapis/google-auth-library-ruby
87
+
88
+ Content = Google::Apis::ContentV2 # Alias the module
89
+ content = Content::ShoppingContentService.new
90
+
91
+ scope = 'https://www.googleapis.com/auth/content'
92
+ merchant_id = # Merchant ID found on dashboard
93
+
94
+ content.authorization = Google::Auth::ServiceAccountCredentials.make_creds(
95
+ json_key_io: File.open('./content-api-key.json'),
96
+ scope: scope)
97
+
98
+ content.authorization.fetch_access_token!
99
+ # Service methods: https://googleapis.dev/ruby/google-api-client/latest/Google/Apis/ContentV2/ShoppingContentService.html
100
+ content.list_datafeeds(merchant_id) # Returns Google::Apis::ContentV2::ListDatafeedsResponse
101
+
102
+ ```
103
+
56
104
  ### Naming conventions vs JSON representation
57
105
 
58
106
  Object properties in the ruby client use the standard ruby convention for naming -- snake_case. This differs from the underlying JSON representation which typically uses camelCase for properties. There are a few notable exceptions to this rule:
data/Rakefile CHANGED
@@ -71,7 +71,7 @@ namespace :kokoro do
71
71
  end
72
72
 
73
73
  task :post do
74
- require_relative "rakelib/link_checker.rb"
74
+ require_relative "rakelib/devsite/link_checker.rb"
75
75
 
76
76
  link_checker = LinkChecker.new
77
77
  link_checker.run
data/docs/api-keys.md ADDED
@@ -0,0 +1,20 @@
1
+ # API Keys
2
+
3
+ When calling APIs that do not access private user data, you can use simple API keys. These keys are used to authenticate your application for accounting purposes. The Google Developers Console documentation also describes [API keys](https://developers.google.com/console/help/using-keys).
4
+
5
+ > Note: If you do need to access private user data, you must use OAuth 2.0. See [Using OAuth 2.0 for Installed Applications](oauth-installed.md), [Using OAuth 2.0 for Server to Server Applications](oauth-server.md), and [Using OAuth 2.0 for Web Server Applications](oauth-web.md) for more information.
6
+
7
+ ## Using API Keys
8
+
9
+ To use API keys, set the `key` attribute on service objects. For example:
10
+
11
+ ```ruby
12
+ require 'google/apis/translate_v2'
13
+
14
+ translate = Google::Apis::TranslateV2::TranslateService.new
15
+ translate.key = 'YOUR_API_KEY_HERE'
16
+ result = translate.list_translations('Hello world!', 'es', source: 'en')
17
+ puts result.translations.first.translated_text
18
+ ```
19
+
20
+ All calls made using that service object will include your API key.
data/docs/auth.md ADDED
@@ -0,0 +1,53 @@
1
+ # Authentication Overview
2
+
3
+ This document is an overview of how authentication, authorization, and accounting are accomplished. For all API calls, your application needs to be authenticated. When an API accesses a user's private data, your application must also be authorized by the user to access the data. For example, accessing a public Google+ post would not require user authorization, but accessing a user's private calendar would. Also, for quota and billing purposes, all API calls involve accounting. This document summarizes the protocols used by Google APIs and provides links to more information.
4
+
5
+ ## Access types
6
+
7
+ It is important to understand the basics of how API authentication and authorization are handled. All API calls must use either simple or authorized access (defined below). Many API methods require authorized access, but some can use either. Some API methods that can use either behave differently, depending on whether you use simple or authorized access. See the API's method documentation to determine the appropriate access type.
8
+
9
+ ### 1. Simple API access (API keys)
10
+
11
+ These API calls do not access any private user data. Your application must authenticate itself as an application belonging to your Google API Console project. This is needed to measure project usage for accounting purposes.
12
+
13
+ **API key:** To authenticate your application, use an [API key](api-keys.md) for your API Console project. Every simple access call your application makes must include this key.
14
+
15
+ > **Warning:** Keep your API key private. If someone obtains your key, they could use it to consume your quota or incur charges against your API Console project.
16
+
17
+ ### 2. Authorized API access (OAuth 2.0)
18
+
19
+ These API calls access private user data. Before you can call them, the user that has access to the private data must grant your application access. Therefore, your application must be authenticated, the user must grant access for your application, and the user must be authenticated in order to grant that access. All of this is accomplished with OAuth 2.0 and libraries written for it.
20
+
21
+ **Scope:** Each API defines one or more scopes that declare a set of operations permitted. For example, an API might have read-only and read-write scopes. When your application requests access to user data, the request must include one or more scopes. The user needs to approve the scope of access your application is requesting.
22
+
23
+ **Refresh and access tokens:** When a user grants your application access, the OAuth 2.0 authorization server provides your application with refresh and access tokens. These tokens are only valid for the scope requested. Your application uses access tokens to authorize API calls. Access tokens expire, but refresh tokens do not. Your application can use a refresh token to acquire a new access token.
24
+
25
+ > **Warning:** Keep refresh and access tokens private. If someone obtains your tokens, they could use them to access private user data.
26
+
27
+ **Client ID and client secret:** These strings uniquely identify your application and are used to acquire tokens. They are created for your project on the [API Console](https://console.developers.google.com/). There are three types of client IDs, so be sure to get the correct type for your application:
28
+
29
+ - [Web application](https://developers.google.com/accounts/docs/OAuth2WebServer) client IDs
30
+ - [Installed application](https://developers.google.com/accounts/docs/OAuth2InstalledApp) client IDs
31
+ - [Service Account](https://developers.google.com/accounts/docs/OAuth2ServiceAccount) client IDs
32
+
33
+ > **Warning:** Keep your client secret private. If someone obtains your client secret, they could use it to consume your quota, incur charges against your Console project, and request access to user data.
34
+
35
+ ## Using API keys
36
+
37
+ More information and examples for API keys are provided on the [API Keys](api-keys.md) page.
38
+
39
+ ## Using OAuth 2.0
40
+
41
+ More information and examples for OAuth 2.0 are provided on the [OAuth 2.0](oauth.md) page.
42
+
43
+ ## Using environment variables
44
+
45
+ The [GoogleAuth Library for Ruby](https://github.com/google/google-auth-library-ruby) also supports authorization via
46
+ environment variables if you do not want to check in developer credentials
47
+ or private keys. Simply set the following variables for your application:
48
+
49
+ ```sh
50
+ GOOGLE_ACCOUNT_TYPE="YOUR ACCOUNT TYPE" # ie. 'service'
51
+ GOOGLE_CLIENT_EMAIL="YOUR GOOGLE DEVELOPER EMAIL"
52
+ GOOGLE_PRIVATE_KEY="YOUR GOOGLE DEVELOPER API KEY"
53
+ ```
@@ -0,0 +1,69 @@
1
+ # Client Secrets
2
+
3
+ The Google APIs Client Library for Ruby uses the `client_secrets.json` file format for storing the `client_id`, `client_secret`, and other OAuth 2.0 parameters.
4
+
5
+ See [Creating authorization credentials](https://developers.google.com/identity/protocols/OAuth2WebServer#creatingcred) for how to obtain a `client_secrets.json` file.
6
+
7
+ The `client_secrets.json` file format is a [JSON](http://www.json.org/) formatted file containing the client ID, client secret, and other OAuth 2.0 parameters. Here is an example client_secrets.json file for a web application:
8
+
9
+ ```json
10
+ {
11
+ "web": {
12
+ "client_id": "asdfjasdljfasdkjf",
13
+ "client_secret": "1912308409123890",
14
+ "redirect_uris": ["https://www.example.com/oauth2callback"],
15
+ "auth_uri": "https://accounts.google.com/o/oauth2/auth",
16
+ "token_uri": "https://accounts.google.com/o/oauth2/token"
17
+ }
18
+ }
19
+ ```
20
+
21
+ Here is an example client_secrets.json file for an installed application:
22
+
23
+ ```json
24
+ {
25
+ "installed": {
26
+ "client_id": "837647042410-75ifg...usercontent.com",
27
+ "client_secret":"asdlkfjaskd",
28
+ "redirect_uris": ["http://localhost", "urn:ietf:wg:oauth:2.0:oob"],
29
+ "auth_uri": "https://accounts.google.com/o/oauth2/auth",
30
+ "token_uri": "https://accounts.google.com/o/oauth2/token"
31
+ }
32
+ }
33
+ ```
34
+
35
+ The format defines one of two client ID types:
36
+
37
+ - `web`: Web application.
38
+ - `installed`: Installed application.
39
+
40
+ The `web` and `installed` sub-objects have the following mandatory members:
41
+
42
+ - `client_id` (string): The client ID.
43
+ - `client_secret` (string): The client secret.
44
+ - `redirect_uris` (list of strings): A list of valid redirection endpoint URIs. This list should match the list entered for the client ID on the [API Access pane](https://code.google.com/apis/console#:access) of the Google APIs Console.
45
+ - `auth_uri` (string): The authorization server endpoint URI.
46
+ - `token_uri` (string): The token server endpoint URI.
47
+
48
+ All of the above members are mandatory. The following optional parameters may appear:
49
+
50
+ - `client_email` (string) The service account email associated with the client.
51
+ - `auth_provider_x509_cert_url` (string) The URL of the public x509 certificate, used to verify the signature on JWTs, such as ID tokens, signed by the authentication provider.
52
+ - `client_x509_cert_url` (string) The URL of the public x509 certificate, used to verify JWTs signed by the client.
53
+
54
+ The following shows how you can use a client_secrets.json file and the Google::APIClient::ClientSecrets class to create a new authorization object:
55
+
56
+ ```rb
57
+ require 'google/api_client/client_secrets'
58
+
59
+ CLIENT_SECRETS = Google::APIClient::ClientSecrets.load
60
+ authorization = CLIENT_SECRETS.to_authorization
61
+
62
+ # You can then use this with an API client, e.g.:
63
+ client.authorization = authorization
64
+ ```
65
+
66
+ ## Motivation
67
+
68
+ Traditionally providers of OAuth endpoints have relied upon cut-and-paste as the way users of their service move the client id and secret from a registration page into working code. That can be error prone, along with it being an incomplete picture of all the information that is needed to get OAuth 2.0 working, which requires knowing all the endpoints and configuring a Redirect Endpoint. If service providers start providing a downloadable client_secrets.json file for client information and client libraries start consuming client_secrets.json then a large amount of friction in implementing OAuth 2.0 can be reduced.
69
+
@@ -0,0 +1,340 @@
1
+ # Getting Started
2
+
3
+ This document provides all the basic information you need to start using the library. It covers important library concepts, shows examples for various use cases, and gives links to more information.
4
+
5
+ ## Setup
6
+
7
+ There are a few setup steps you need to complete before you can use this library:
8
+
9
+ 1. If you don't already have a Google account, [sign up](https://www.google.com/accounts).
10
+ 2. If you have never created a Google APIs Console project, read the [Managing Projects page](http://developers.google.com/console/help/managing-projects) and create a project in the [Google API Console](https://console.developers.google.com/).
11
+
12
+ ## Authentication and authorization
13
+
14
+ It is important to understand the basics of how API authentication and authorization are handled. All API calls must use either simple or authorized access (defined below). Many API methods require authorized access, but some can use either. Some API methods that can use either behave differently, depending on whether you use simple or authorized access. See the API's method documentation to determine the appropriate access type.
15
+
16
+ ### 1. Simple API access (API keys)
17
+
18
+ These API calls do not access any private user data. Your application must authenticate itself as an application belonging to your Google Cloud project. This is needed to measure project usage for accounting purposes.
19
+
20
+ **API key**: To authenticate your application, use an [API key](https://cloud.google.com/docs/authentication/api-keys) for your Google Cloud Console project. Every simple access call your application makes must include this key.
21
+
22
+ > **Warning**: Keep your API key private. If someone obtains your key, they could use it to consume your quota or incur charges against your Google Cloud project.
23
+
24
+ ### 2. Authorized API access (OAuth 2.0)
25
+
26
+ These API calls access private user data. Before you can call them, the user that has access to the private data must grant your application access. Therefore, your application must be authenticated, the user must grant access for your application, and the user must be authenticated in order to grant that access. All of this is accomplished with [OAuth 2.0](https://developers.google.com/identity/protocols/OAuth2) and libraries written for it.
27
+
28
+ * **Scope**: Each API defines one or more scopes that declare a set of operations permitted. For example, an API might have read-only and read-write scopes. When your application requests access to user data, the request must include one or more scopes. The user needs to approve the scope of access your application is requesting.
29
+ * **Refresh and access tokens**: When a user grants your application access, the OAuth 2.0 authorization server provides your application with refresh and access tokens. These tokens are only valid for the scope requested. Your application uses access tokens to authorize API calls. Access tokens expire, but refresh tokens do not. Your application can use a refresh token to acquire a new access token.
30
+
31
+ > **Warning**: Keep refresh and access tokens private. If someone obtains your tokens, they could use them to access private user data.
32
+
33
+ * **Client ID and client secret**: These strings uniquely identify your application and are used to acquire tokens. They are created for your Google Cloud project on the [API Access pane](https://console.developers.google.com/apis/credentials) of the Google Cloud. There are several types of client IDs, so be sure to get the correct type for your application:
34
+
35
+ * Web application client IDs
36
+ * Installed application client IDs
37
+ * [Service Account](https://developers.google.com/identity/protocols/OAuth2ServiceAccount) client IDs
38
+
39
+ > **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 Cloud project, and request access to user data.
40
+
41
+ ## Installation
42
+
43
+ Add this line to your application's Gemfile:
44
+
45
+ ```ruby
46
+ gem 'google-api-client', '~> 0.34'
47
+
48
+ ```
49
+
50
+ And then execute:
51
+
52
+ $ bundle
53
+
54
+ Or install it yourself as:
55
+
56
+ $ gem install google-api-client
57
+
58
+ ## Usage
59
+
60
+ ### Basic usage
61
+
62
+ To use an API, include the corresponding generated file and instantiate the service. For example to use the Drive API:
63
+
64
+ ```ruby
65
+ require 'google/apis/drive_v2'
66
+
67
+ Drive = Google::Apis::DriveV2 # Alias the module
68
+ drive = Drive::DriveService.new
69
+ drive.authorization = ... # See Googleauth or Signet libraries
70
+
71
+ # Search for files in Drive (first page only)
72
+ files = drive.list_files(q: "title contains 'finances'")
73
+ files.items.each do |file|
74
+ puts file.title
75
+ end
76
+
77
+ # Upload a file
78
+ metadata = Drive::File.new(title: 'My document')
79
+ metadata = drive.insert_file(metadata, upload_source: 'test.txt', content_type: 'text/plain')
80
+
81
+ # Download a file
82
+ drive.get_file(metadata.id, download_dest: '/tmp/myfile.txt')
83
+ ```
84
+ ### Naming conventions vs JSON representation
85
+
86
+ Object properties in the ruby client use the standard ruby convention for naming -- snake_case. This differs from the underlying JSON representation which typically uses camelCase for properties. There are a few notable exceptions to this rule:
87
+
88
+ * For properties that are defined as hashes with user-defined keys, no translation is performed on the key.
89
+ * For embedded field masks in requests (for example, the Sheets API), specify the camelCase form when referencing fields.
90
+
91
+ Outside those exceptions, if a property is specified using camelCase in a request, it will be ignored during serialization and omitted from the request.
92
+
93
+ ### Media
94
+
95
+ Methods that allow media operations have additional parameters to specify the upload source or download destination.
96
+
97
+ For uploads, the `upload_source` parameter can be specified with either a path to a file, an `IO` stream, or `StringIO`
98
+ instance.
99
+
100
+ For downloads, the `download_dest` parameter can also be either a path to a file, an `IO` stream, or `StringIO` instance.
101
+
102
+ Both uploads & downloads are resumable. If an error occurs during transmission the request will be automatically
103
+ retried from the last received byte.
104
+
105
+ ### Errors & Retries
106
+
107
+ Retries are disabled by default, but enabling retries is strongly encouraged. The number of retries can be configured
108
+ via `Google::Apis::RequestOptions`. Any number greater than 0 will enable retries.
109
+
110
+ To enable retries for all services:
111
+
112
+ ```ruby
113
+ Google::Apis::RequestOptions.default.retries = 5
114
+ ```
115
+
116
+ With retries enabled globally, retries can be disabled for specific calls by including a retry value of 0 in the
117
+ request options:
118
+
119
+ ```ruby
120
+ drive.insert_file(metadata, upload_source: 'test.txt', content_type: 'text/plain', options: { retries: 0 })
121
+ ```
122
+
123
+ When retries are enabled, if a server or rate limit error occurs during a request it is automatically retried with
124
+ an exponentially increasing delay on subsequent retries. If a request can not be retried or if the maximum number
125
+ of retries is exceeded, an exception is thrown.
126
+
127
+ ### Callbacks
128
+
129
+ A block can be specified when making calls. If present, the block will be called with the result or error, rather than
130
+ returning the result from the call or raising the error. Example:
131
+
132
+ ```ruby
133
+ # Search for files in Drive (first page only)
134
+ drive.list_files(q: "title contains 'finances'") do |res, err|
135
+ if err
136
+ # Handle error
137
+ else
138
+ # Handle response
139
+ end
140
+ end
141
+ ```
142
+
143
+ This calling style is required when making batch requests as responses are not available until the entire batch
144
+ is complete.
145
+
146
+ ### Paging
147
+
148
+ To fetch multiple pages of data, use the `fetch_all` method to wrap the paged query. This returns an
149
+ `Enumerable` that automatically fetches additional pages as needed.
150
+
151
+ ```ruby
152
+ # List all calendar events
153
+ now = Time.now.iso8601
154
+ items = calendar.fetch_all do |token|
155
+ calendar.list_events('primary',
156
+ single_events: true,
157
+ order_by: 'startTime',
158
+ time_min: now,
159
+ page_token: token)
160
+ end
161
+ items.each { |event| puts event.summary }
162
+ ```
163
+
164
+ For APIs that use a field other than `items` to contain the results, an alternate field name can be supplied.
165
+
166
+ ```ruby
167
+ # List all files in Drive
168
+ items = drive.fetch_all(items: :files) { |token| drive.list_files(page_token: token) }
169
+ items.each { |file| puts file.name }
170
+ ```
171
+
172
+ ### Batches
173
+
174
+ Multiple requests can be batched together into a single HTTP request to reduce overhead. Batched calls are executed
175
+ in parallel and the responses processed once all results are available
176
+
177
+
178
+ ```ruby
179
+ # Fetch a bunch of files by ID
180
+ ids = ['file_id_1', 'file_id_2', 'file_id_3', 'file_id_4']
181
+ drive.batch do |drive|
182
+ ids.each do |id|
183
+ drive.get_file(id) do |res, err|
184
+ # Handle response
185
+ end
186
+ end
187
+ end
188
+ ```
189
+
190
+ Media operations -- uploads & downloads -- can not be included in batch with other requests.
191
+
192
+ However, some APIs support batch uploads. To upload multiple files in a batch, use the `batch_upload` method instead.
193
+ Batch uploads should only be used when uploading multiple small files. For large files, upload files individually to
194
+ take advantage of the libraries built-in resumable upload support.
195
+
196
+ ### Hashes
197
+
198
+ While the API will always return instances of schema classes, plain hashes are accepted in method calls for
199
+ convenience. Hash keys must be symbols matching the attribute names on the corresponding object the hash is meant
200
+ to replace. For example:
201
+
202
+ ```ruby
203
+ file = {id: '123', title: 'My document', labels: { starred: true }}
204
+ file = drive.create_file(file, {}) # Returns a Drive::File instance
205
+ ```
206
+
207
+ is equivalent to:
208
+
209
+ ```ruby
210
+ file = Drive::File.new(id: '123', title: 'My document')
211
+ file.labels = Drive::File::Labels.new(starred: true)
212
+ file = drive.update_file(file) # Returns a Drive::File instance
213
+ ```
214
+
215
+ IMPORTANT: Be careful when supplying hashes for request objects. If it is the last argument to a method, ruby will interpret the hash as keyword arguments. To prevent this, appending an empty hash as an extra parameter will avoid misinterpretation.
216
+
217
+ ```ruby
218
+ file = {id: '123', title: 'My document', labels: { starred: true }}
219
+ file = drive.create_file(file) # Raises ArgumentError: unknown keywords: id, title, labels
220
+ file = drive.create_file(file, {}) # Returns a Drive::File instance
221
+ ```
222
+
223
+ ### Using raw JSON
224
+
225
+ To handle JSON serialization or deserialization in the application, set `skip_serialization` or
226
+ or `skip_deserializaton` options respectively. When setting `skip_serialization` in a request,
227
+ the body object must be a string representing the serialized JSON.
228
+
229
+ When setting `skip_deserialization` to true, the response from the API will likewise
230
+ be a string containing the raw JSON from the server.
231
+
232
+ ## Authorization
233
+
234
+ [OAuth 2](https://developers.google.com/accounts/docs/OAuth2) is used to authorize applications. This library uses
235
+ both [Signet](https://github.com/google/signet) and
236
+ [Google Auth Library for Ruby](https://github.com/google/google-auth-library-ruby) for OAuth 2 support.
237
+
238
+ The [Google Auth Library for Ruby](https://github.com/google/google-auth-library-ruby) provides an implementation of
239
+ [application default credentials] for Ruby. It offers a simple way to get authorization credentials for use in
240
+ calling Google APIs, best suited for cases when the call needs to have the same identity
241
+ and authorization level for the application independent of the user. This is
242
+ the recommended approach to authorize calls to Cloud APIs, particularly when
243
+ you're building an application that uses Google Compute Engine.
244
+
245
+ For per-user authorization, use [Signet](https://github.com/google/signet) to obtain user authorization.
246
+
247
+ ### Passing authorization to requests
248
+
249
+ Authorization can be specified for the entire client, for an individual service instance, or on a per-request basis.
250
+
251
+ Set authorization for all service:
252
+
253
+ ```ruby
254
+ Google::Apis::RequestOptions.default.authorization = authorization
255
+ # Services instantiated after this will inherit the authorization
256
+ ```
257
+
258
+ On a per-service level:
259
+
260
+ ```ruby
261
+ drive = Google::Apis::DriveV2::DriveService.new
262
+ drive.authorization = authorization
263
+
264
+ # All requests made with this service will use the same authorization
265
+ ```
266
+
267
+ Per-request:
268
+
269
+ ```ruby
270
+ drive.get_file('123', options: { authorization: authorization })
271
+ ```
272
+
273
+ ### Authorization using API keys
274
+
275
+ Some APIs allow using an API key instead of OAuth2 tokens. For these APIs, set
276
+ the `key` attribute of the service instance. For example:
277
+
278
+ ```ruby
279
+ require 'google/apis/translate_v2'
280
+
281
+ translate = Google::Apis::TranslateV2::TranslateService.new
282
+ translate.key = 'YOUR_API_KEY_HERE'
283
+ result = translate.list_translations('Hello world!', 'es', source: 'en')
284
+ puts result.translations.first.translated_text
285
+ ```
286
+
287
+ ## Customizing endpoints
288
+
289
+ By default, client objects will connect to the default Google endpoints for =
290
+ their respective APIs. If you need to connect to a regional endpoint, a test
291
+ endpoint, or other custom endpoint, modify the `root_url` attribute of the
292
+ client object. For example:
293
+
294
+ ```ruby
295
+ require "google/apis/docs_v1"
296
+ docs_service = Google::Apis::DocsV1::DocsService.new
297
+
298
+ docs_service.root_url = "https://my-custom-docs-endpoint.example.com/"
299
+
300
+ document = docs_service.get_document("my-document-id")
301
+ ```
302
+
303
+ ## Samples
304
+
305
+ See the [samples](https://github.com/google/google-api-ruby-client/tree/master/samples) for examples on how to use the client library for various
306
+ services.
307
+
308
+ ## Generating APIs
309
+
310
+ For [Cloud Endpoints](https://cloud.google.com/endpoints/) or other APIs not included in the gem, ruby code can be
311
+ generated from the discovery document.
312
+
313
+ To generate from a local discovery file:
314
+
315
+ $ generate-api gen <outdir> --file=<path>
316
+
317
+ A URL can also be specified:
318
+
319
+ $ generate-api gen <outdir> --url=<url>
320
+
321
+ ## Supported Ruby Versions
322
+
323
+ This library is currently supported on Ruby 1.9+.
324
+ However, Ruby 2.4 or later is strongly recommended, as earlier releases have
325
+ reached or are nearing end-of-life. After March 31, 2019, Google will provide
326
+ official support only for Ruby versions that are considered current and
327
+ supported by Ruby Core (that is, Ruby versions that are either in normal
328
+ maintenance or in security maintenance).
329
+ See https://www.ruby-lang.org/en/downloads/branches/ for further details.
330
+
331
+ ## License
332
+
333
+ This library is licensed under Apache 2.0. Full license text is
334
+ available in [LICENSE](LICENSE).
335
+
336
+ ## Support
337
+
338
+ Please [report bugs at the project on Github](https://github.com/google/google-api-ruby-client/issues). Don't
339
+ hesitate to [ask questions](http://stackoverflow.com/questions/tagged/google-api-ruby-client) about the client or APIs
340
+ on [StackOverflow](http://stackoverflow.com).