{"id":13682645,"url":"https://github.com/googleapis/google-api-ruby-client","last_synced_at":"2025-05-12T03:54:38.614Z","repository":{"id":2317561,"uuid":"3277842","full_name":"googleapis/google-api-ruby-client","owner":"googleapis","description":"REST client for Google APIs","archived":false,"fork":false,"pushed_at":"2025-05-04T12:50:26.000Z","size":2622070,"stargazers_count":2838,"open_issues_count":187,"forks_count":878,"subscribers_count":114,"default_branch":"main","last_synced_at":"2025-05-09T09:45:50.493Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/googleapis.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":".github/CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":".github/CODEOWNERS","security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2012-01-26T21:54:39.000Z","updated_at":"2025-05-06T03:59:40.000Z","dependencies_parsed_at":"2025-04-30T20:51:08.736Z","dependency_job_id":null,"html_url":"https://github.com/googleapis/google-api-ruby-client","commit_stats":{"total_commits":19917,"total_committers":151,"mean_commits":"131.90066225165563","dds":0.4177335944168299,"last_synced_commit":"1b62930b7ac51a661e2c66d22f4f1ef52d922c9d"},"previous_names":["google/google-api-ruby-client"],"tags_count":258,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleapis%2Fgoogle-api-ruby-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleapis%2Fgoogle-api-ruby-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleapis%2Fgoogle-api-ruby-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/googleapis%2Fgoogle-api-ruby-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/googleapis","download_url":"https://codeload.github.com/googleapis/google-api-ruby-client/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253242028,"owners_count":21876893,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-08-02T13:01:50.414Z","updated_at":"2025-05-12T03:54:38.550Z","avatar_url":"https://github.com/googleapis.png","language":"Ruby","readme":"# Simple REST Clients for Google APIs\n\nThis repository contains a set of simple client libraries for various Google APIs. These libraries are generated automatically from [Discovery Documents](https://developers.google.com/discovery), and the code generator is also hosted here in this repository.\n\nEach client provides:\n\n* A client object that connects to the HTTP/JSON REST endpoint for the service.\n* Ruby objects for data structures related to the service.\n* Integration with the googleauth gem for authentication using OAuth, API keys, and service accounts.\n* Control of retry, pagination, and timeouts.\n\nThese client libraries are officially supported by Google, and are updated regularly to track changes to the service. However, many Google services, especially Google Cloud Platform services such as Cloud Storage, Pub/Sub, and BigQuery, may provide a more modern client that is easier to use and more performant. See the section below titled [\"Which client should I use?\"](#which-client-should-i-use) for more information.\n\n## Using the clients\n\nThe client gems are named according to the pattern `google-apis-\u003cservicename\u003e_\u003cserviceversion\u003e`. For example, the client for the Google Drive V3 API is `google-apis-drive_v3`.\n\nInstall the client using `gem install` or by adding it to your `Gemfile`. Then, to use it, require the file and instantiate the service. For example to use the Drive API:\n\n```ruby\nrequire 'google/apis/drive_v3'\n\ndrive = Google::Apis::DriveV3::DriveService.new\ndrive.authorization = ... # See Googleauth or Signet libraries\n\n# Search for files in Drive (first page only)\nfiles = drive.list_files(q: \"title contains 'finances'\")\nfiles.items.each do |file|\n  puts file.title\nend\n\n# Upload a file\nmetadata = Google::Apis::DriveV3::File.new(name: 'test.txt')\nmetadata = drive.create_file(metadata, upload_source: '/tmp/test.txt', content_type: 'text/plain')\n\n# Download a file\ndrive.get_file(metadata.id, download_dest: '/tmp/downloaded-test.txt')\n```\n\nFollowing is another example using the Content API (Google Merchant Center), provided by the `google-apis-content_v2_1` gem:\n\n```ruby\nrequire 'google/apis/content_v2_1'\nrequire 'googleauth' # https://github.com/googleapis/google-auth-library-ruby\n\ncontent = Google::Apis::ContentV2_1::ShoppingContentService.new\n\nscope = 'https://www.googleapis.com/auth/content'\nmerchant_id = # Merchant ID found on dashboard\n\ncontent.authorization = Google::Auth::ServiceAccountCredentials.make_creds(\n  json_key_io: File.open('./content-api-key.json'),\n  scope: scope)\n\ncontent.authorization.fetch_access_token!\n# Service methods: https://rubydoc.info/gems/google-apis-content_v2_1/Google/Apis/ContentV2_1/ShoppingContentService\ncontent.list_datafeeds(merchant_id) # Returns Google::Apis::ContentV2_1::ListDatafeedsResponse\n```\n\nFor more detailed information, see the [Usage Guide](https://github.com/googleapis/google-api-ruby-client/blob/main/docs/usage-guide.md).\n\n## Which client should I use?\n\nGoogle provides two types of Ruby API client libraries: **simple REST clients** and **modern clients**.\n\nThe libraries in this repo are _simple REST clients_. These clients connect to HTTP/JSON REST endpoints and are automatically generated from service discovery documents. They support most API functionality, but their class interfaces are sometimes awkward.\n\nModern clients are produced by a modern code generator, combined with hand-crafted functionality for some services. Most modern clients connect to high-performance gRPC endpoints, although a few are backed by REST services. Modern clients are available for many Google services, especially Cloud Platform services, but do not yet support all the services covered by the simple clients. Most modern clients live in the https://github.com/googleapis/google-cloud-ruby repository.\n\n**For most users, we recommend the modern client, if one is available.** Compared with simple clients, modern clients are generally much easier to use and more Ruby-like, support more advanced features such as streaming and long-running operations, and often provide much better performance. You may consider using a simple client instead, if a modern client is not yet available for the service you want to use, or if you are not able to use gRPC on your infrastructure.\n\nThe documentation for the particular Google service you are working with, may provide guidance regarding the preferred client library to use.\n\n## Tracing\n\nOpenCensus support with gems is now deprecated. Please migrate to using [OpenTelemetry](https://opentelemetry.io/docs/instrumentation/ruby/automatic/) instead. Currently instrumented span data from core gem can be got by enabling Http and HttpClient auto-instrumentation of OpenTelemetry. To enable instrumentation for HTTP and HttpClient, and export it to [Cloud Trace](https://cloud.google.com/trace) configure OpenTelemetry like below,\n\n```ruby\n gem \"opentelemetry-sdk\"\n gem \"opentelemetry-exporter-google_cloud_trace\"\n gem \"opentelemetry-instrumentation-http\"\n gem \"opentelemetry-instrumentation-http_client\"\n \n require \"opentelemetry-sdk\"\n require \"opentelemetry/instrumentation/http_client\"\n require \"opentelemetry/instrumentation/http\"\n require \"opentelemetry/exporter/google_cloud_trace\"\n OpenTelemetry::SDK.configure do |c|\n   c.service_name = \"ServiceName\"\n   c.add_span_processor(\n     OpenTelemetry::SDK::Trace::Export::BatchSpanProcessor.new(\n       OpenTelemetry::Exporter::GoogleCloudTrace::SpanExporter.new\n     )\n   )\n   c.use \"OpenTelemetry::Instrumentation::Http\"\n   c.use \"OpenTelemetry::Instrumentation::HttpClient\"\n end\n```\n\n## Samples\n\nSee the [samples](https://github.com/google/google-api-ruby-client/tree/main/samples) for examples on how to use the client library for various\nservices.\n\n## Supported Ruby versions\n\nThis library is supported on Ruby 2.7+.\n\nGoogle provides official support for Ruby versions that are actively supported by Ruby Core -- that is, Ruby versions that are either in normal maintenance or in security maintenance, and not end of life. Currently, this means Ruby 2.7 and later. Older versions of Ruby _may_ still work, but are unsupported and not recommended. See https://www.ruby-lang.org/en/downloads/branches/ for details about the Ruby support schedule.\n\n## License\n\nThis library is licensed under Apache 2.0. Full license text is available in the [LICENSE](LICENSE).\n\n## Contributing\n\nSee [CONTRIBUTING](.github/CONTRIBUTING.md).\n\n## Support\n\nPlease [report bugs at the project on Github](https://github.com/google/google-api-ruby-client/issues). Don't hesitate to [ask questions](http://stackoverflow.com/questions/tagged/google-api-ruby-client) about the client or APIs on [StackOverflow](http://stackoverflow.com).\n","funding_links":[],"categories":["Ruby","High Level Tasks"],"sub_categories":["Machine Translation"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogleapis%2Fgoogle-api-ruby-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fgoogleapis%2Fgoogle-api-ruby-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fgoogleapis%2Fgoogle-api-ruby-client/lists"}