Merged
Conversation
Extract low-level HTTP request logic into shared HttpRequest module that both OAuth and HttpClient can use. This provides consistent logging and error handling for all HTTP operations including OAuth token exchanges. Changes: - Created lib/nationbuilder_api/http_request.rb with post_form method - Updated OAuth.exchange_code_for_token to accept logger parameter - Updated OAuth.refresh_access_token to accept logger parameter - Replaced direct Net::HTTP calls in OAuth with HttpRequest.post_form - Updated Client and HttpClient to pass logger to OAuth methods Benefits: - OAuth token requests/responses now logged consistently with API calls - Centralized error handling for network errors across all HTTP operations - Easier to add future HTTP-level features (retries, metrics, etc.) All 159 tests passing with 92.51% coverage. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Implements the People resource wrapper with four key methods: - people.show(id) - Fetch person details via V1 API - people.taggings(id) - Get person's tags/subscriptions via V1 API - people.rsvps(id) - Get event RSVPs via V2 API with JSON:API format - people.activities(id) - Get recent activities via V1 API Implementation details: - Created base resource class for common HTTP method delegation - Added resources module with autoloading - Client class now exposes people accessor method - Comprehensive test coverage (17 specs, all passing) - Updated README with People API examples - Bumped version to 0.2.0 This addresses the need for cleaner API interactions in consuming applications by providing a resource-based interface instead of raw HTTP calls. Related: citizen-agv 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Apply safe navigation operator (&.) instead of if-check for logger. This addresses the Style/SafeNavigation cop warning. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
Update People resource to use V2 API endpoints with JSON:API format: - people.show() now uses /api/v2/people/:id (was /api/v1) - people.taggings() now uses V2 with sideloading (was /api/v1) - people.rsvps() already using V2 ✓ - people.activities() still uses V1 (V2 not yet available) Changes: - Added include_taggings parameter to show() for sideloading - Updated taggings() to use V2 sideloading on person endpoint - Updated all specs to match V2 JSON:API format (18 specs passing) - Updated README with V2 examples and format clarification - Added TODO comment for activities V2 migration V1 People API is deprecated per NationBuilder documentation. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements Phase 2 of the gem roadmap by adding the People API resource wrapper using V2 API endpoints with JSON:API format. This provides a clean, resource-based interface for working with NationBuilder people data instead of requiring raw HTTP calls.
New Methods:
client.people.show(id, include_taggings: false)- Fetch person details (V2 API)client.people.taggings(id)- Get person's tags/subscriptions (V2 API with sideloading)client.people.rsvps(id, include_event: true)- Get event RSVPs (V2 API, JSON:API format)client.people.activities(id)- Get recent activities (V1 API - V2 not yet available)V2 API Migration
Updated to use V2 endpoints per NationBuilder documentation stating that V1 People API is deprecated:
show()/api/v1/people/:id/api/v2/people/:idtaggings()/api/v1/people/:id/taggings/api/v2/people/:id?include=taggingsrsvps()/api/v2/event_rsvpsactivities()/api/v1/people/:id/activitiesResponse Format
V2 JSON:API Format:
Implementation Details
Resources::Baseclass for HTTP method delegationResources::Peoplewith V2 endpointsclient.peopleaccessor methodinclude_taggingsparameterTest Plan
Breaking Changes
Response format changed from V1 to V2 (JSON:API):
show(): Returns{ data: { type: "person", id: "123", attributes: {...} } }instead of{ person: {...} }taggings(): Returns JSON:API format withincludedarray instead of{ results: [...] }Related Issues
Documentation
🤖 Generated with Claude Code