feat: add GraphQL endpoint support#124
Conversation
There was a problem hiding this comment.
Pull request overview
Adds first-class GraphQL support to the Crowdin Ruby API client by introducing a Crowdin::Client#graphql helper that POSTs to /api/graphql, with coverage for default, Enterprise, and custom endpoint URL behaviors.
Changes:
- Added
Crowdin::Client#graphqlto send GraphQL POST requests to/api/graphql(or a custom URL). - Added unit specs covering default, Enterprise, and custom GraphQL endpoint URL behavior.
- Documented basic GraphQL usage in the README.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| lib/crowdin-api/client/client.rb | Adds the #graphql method that performs a JSON POST to the GraphQL endpoint. |
| spec/unit/client_spec.rb | Adds unit tests verifying URL selection (default/Enterprise/custom) and response parsing. |
| README.md | Adds a “GraphQL API” section with example usage and custom endpoint URL support. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
|
Pushed Validation:
Local |
|
Pushed What changed:
Validation I could run locally:
I could not run the full local |
3b31806 to
577ac15
Compare
|
Follow-up after the first The includes are back in separate statements, and the class-length reduction now comes from grouping the existing client readers into one
Full |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #124 +/- ##
==========================================
+ Coverage 98.38% 98.39% +0.02%
==========================================
Files 63 64 +1
Lines 3130 3156 +26
==========================================
+ Hits 3079 3105 +26
Misses 51 51 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
Thanks, this was a good catch. I pushed Validated with:
|
Summary
Crowdin::Client#graphqlfor GraphQL POST requests to/api/graphql.Fixes #100.
Validation
ruby -c lib/crowdin-api/client/client.rb->Syntax OKruby -c spec/unit/client_spec.rb->Syntax OKgit diff --check-> passedgit diff --cached --check-> passedgit diff origin/main..HEAD --check-> passedgit diff | gitleaks stdin --no-banner --redact --timeout 30-> no leaks foundgit show --format= --patch HEAD | gitleaks stdin --no-banner --redact --timeout 30-> no leaks foundRestClient::Request.executestub verified default, Enterprise, custom URL, payload, and parsed response behavior ->standalone graphql smoke passedNot run:
bundle exec rspec spec/unit/client_spec.rbcould not complete in this local macOS 12 environment. System Ruby bundle install fails buildingunf_extbecause the CLT SDK hasuniversal-darwin22Ruby headers while Ruby 2.6 Makefiles expectuniversal-darwin21; Homebrew portable Ruby 4.0.4 installs the bundle but hangs loading the bundled nativejsonextension;brew install rubyandbrew install ruby@3.4both attempted long LLVM/Rust source builds and were aborted.