Skip to content

Add People update method and SSL verification option#10

Merged
ebrett merged 3 commits intomainfrom
feature/ssl-verification-option
Jan 21, 2026
Merged

Add People update method and SSL verification option#10
ebrett merged 3 commits intomainfrom
feature/ssl-verification-option

Conversation

@ebrett
Copy link
Owner

@ebrett ebrett commented Jan 21, 2026

Summary

Adds new functionality to the NationBuilder API client gem to support profile updates and configurable SSL verification.

Key features:

  • ✅ People update method for modifying person records
  • ✅ Configurable SSL verification (can be disabled for dev/test)
  • ✅ Optional ENV vars for multi-tenant usage
  • ✅ Fixed resource type in People endpoint

Changes

People Update Method

  • Added client.people.update(id, attributes:) method
  • Supports partial updates to person records
  • Uses correct /api/v2/signups/{id} endpoint with type: "signups"
  • Handles JSON:API format correctly
  • Added comprehensive RSpec tests
  • Documented read-only fields and permission requirements

Usage:

client.people.update(123, attributes: {
  first_name: "John",
  last_name: "Doe",
  phone_number: "+1234567890",
  primary_address: {
    address1: "123 Main St",
    city: "Portland",
    state: "OR",
    zip: "97201"
  }
})

SSL Verification Option

  • Added ssl_verify configuration option (default: true)
  • Can be disabled for development/testing environments
  • Useful when working from regions with SSL certificate issues

Usage:

client = NationbuilderApi::Client.new(
  base_url: "https://nation.nationbuilder.com",
  client_id: "...",
  client_secret: "...",
  redirect_uri: "...",
  ssl_verify: Rails.env.production?  # Disable in dev/test
)

Multi-tenant Support

  • Made ENV vars optional in configuration
  • Allows passing credentials directly to client initialization
  • Better support for applications managing multiple NationBuilder instances

Bug Fixes

  • Fixed resource type in People endpoint (was using wrong type)

Files Changed

  • lib/nationbuilder_api/resources/people.rb - Added update method
  • lib/nationbuilder_api/configuration.rb - Added ssl_verify option
  • lib/nationbuilder_api/http_client.rb - Implemented SSL verification toggle
  • lib/nationbuilder_api/client.rb - Updated documentation
  • spec/nationbuilder_api/resources/people_spec.rb - Added comprehensive tests
  • README.md - Updated documentation with new features
  • agent-os/specs/SPEC_ADD_PEOPLE_UPDATE.md - Added specification document

Testing

Added RSpec tests covering:

  • Successful updates with various attribute combinations
  • Validation error handling
  • Authentication error handling
  • Not found error handling
  • Proper JSON:API formatting

Related Work

This enables the profile editing feature in the Citizen app (ebrett/citizen#48).

🤖 Generated with Claude Code

Adds configurable SSL verification to allow bypassing certificate verification
in development/test environments while keeping it enabled by default.

- Add ssl_verify attribute to Configuration (default: true)
- Update HttpClient to use config.ssl_verify
- Update Client documentation with new option
- SSL verification can be disabled with: ssl_verify: false

This is useful for development in regions with certificate chain issues.
Updated tests to verify that:
- ssl_verify: true (default) sets verify_mode to VERIFY_PEER
- ssl_verify: false sets verify_mode to VERIFY_NONE

The old tests expected verify_mode NOT to be set, but now we explicitly
configure it based on the ssl_verify option.
@ebrett
Copy link
Owner Author

ebrett commented Jan 21, 2026

@claude please review this PR

@ebrett ebrett merged commit e63eece into main Jan 21, 2026
3 checks passed
@ebrett ebrett deleted the feature/ssl-verification-option branch January 29, 2026 04:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant