Introduce service account and project token authentication, migrate README to markdown#135
Introduce service account and project token authentication, migrate README to markdown#135santigracia wants to merge 7 commits intomasterfrom
Conversation
Introduce service account and project token authentication for the /import endpoint (breaking change for import using already deprecated api_key). Tracker#import now accepts a credentials Hash instead of an api_key string; Events and Tracker docs and signatures were updated accordingly. Consumer now supports HTTP Basic Auth (including project token as username with empty password) and appends project_id as a query param for service-account imports. Request method accepts basic_auth, and tests updated to cover both auth flows. Added demo examples for both auth methods, updated README (3.1.0 notes)
The .rdoc format is outdated for GitHub READMEs. As the standard is Markdown, the cleanest fix is to convert the README to .md
There was a problem hiding this comment.
Pull request overview
This PR updates the Mixpanel Ruby SDK’s /import flow to use supported authentication methods (service accounts or project token via HTTP Basic Auth), deprecating the old api_key import pattern, and migrates the repository README from RDoc to Markdown for better GitHub rendering.
Changes:
- Change
Tracker#import/Events#importto accept a credentials Hash and emitcredentialsin import payloads (instead ofapi_key). - Add HTTP Basic Auth handling in
Consumerfor/import(includingproject_idquery param for service-account imports) and expand specs to cover both auth modes + invalid credentials. - Add demo scripts for both import auth flows and replace
Readme.rdocwithREADME.md.
Reviewed changes
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| lib/mixpanel-ruby/tracker.rb | Updates Tracker#import signature and inline docs to reflect credential-based import auth. |
| lib/mixpanel-ruby/events.rb | Builds credentials payload for import calls and raises on invalid credentials. |
| lib/mixpanel-ruby/consumer.rb | Adds Basic Auth support for /import and threads auth into request handling. |
| spec/mixpanel-ruby/events_spec.rb | Adds coverage for service-account and project-token import payloads + invalid credentials error. |
| spec/mixpanel-ruby/consumer_spec.rb | Verifies Basic Auth headers and service-account project_id query param behavior. |
| spec/mixpanel-ruby/tracker_spec.rb | Updates expectations for new import message format (credentials). |
| spec/mixpanel-ruby/error_spec.rb | Updates import error-handling tests for new import signature. |
| demo/import_service_account_example.rb | Adds service-account import example usage. |
| demo/import_project_token_example.rb | Adds project-token import example usage. |
| README.md | Replaces RDoc README and documents the v3.1.0 breaking change + import auth options. |
| Readme.rdoc | Removed legacy RDoc README. |
| .gitignore | Ignores coverage/ and Readme.rdoc. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
- ensure service account payload includes username, password and project_id (error lists missing fields) and require non-blank project_token. - Update consumer to append project_id to existing endpoint query safely and only pass basic_auth to request when present (avoids nil auth). - Clarify README wording about the breaking change. Add/adjust specs to cover the new credential validation and error messages.
Add .github/dependabot.yml to enable weekly updates for bundler and GitHub Actions with a 30-day cooldown. Update .github/workflows/ruby.yml to use actions/checkout@v4
SHA pinning
updating SHA to latest
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## master #135 +/- ##
==========================================
+ Coverage 96.29% 96.42% +0.12%
==========================================
Files 12 12
Lines 567 587 +20
==========================================
+ Hits 546 566 +20
Misses 21 21 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Pull request overview
Copilot reviewed 13 out of 14 changed files in this pull request and generated 4 comments.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
…xes)
Add input validation to Mixpanel::Events#import: raise ArgumentError when credentials is not a Hash and normalize credential keys with transform_keys(&:to_sym) so callers can pass string-keyed hashes. Include specs for accepting string keys and for clear errors when credentials is a String or nil. Also adjust demo scripts to use File.expand_path('../lib', __dir__) when loading the local lib.
Introduce service account and project token authentication for the /import endpoint (breaking change for import using already deprecated api_key).
Tracker#import now accepts a credentials Hash instead of an api_key string; Events and Tracker docs and signatures were updated accordingly.
Consumer now supports HTTP Basic Auth (including project token as username with empty password) and appends project_id as a query param for service-account imports. Request method accepts basic_auth, and tests updated to cover both auth flows. Added demo examples for both auth methods, updated README with 3.1.0 notes.
The .rdoc format is outdated for GitHub READMEs. As the standard is Markdown, converted README to .md