Skip to content

Add Phase 4 file upload functionality#4

Merged
robzolkos merged 1 commit intomasterfrom
phase-4-file-uploads
Dec 10, 2025
Merged

Add Phase 4 file upload functionality#4
robzolkos merged 1 commit intomasterfrom
phase-4-file-uploads

Conversation

@robzolkos
Copy link
Copy Markdown
Collaborator

Summary

  • Add multipart/form-data HTTP support to Client with post_multipart and put_multipart methods
  • Add --image option to card create and card update commands for header image uploads
  • Add --avatar option to user update command for avatar uploads
  • Add upload file command for Active Storage direct uploads (for rich text attachments)
  • Add base64 gem for Ruby 3.4 compatibility

Test plan

  • Tested card create with --image against real Fizzy CLI board
  • Tested card update with --image against real Fizzy CLI board
  • Tested user update with --avatar against real Fizzy CLI board
  • All 103 tests pass
  • Test direct upload command when API supports token auth for that endpoint

Multipart HTTP support:
- Add post_multipart and put_multipart methods to Client
- Add set_multipart_body helper for building multipart/form-data requests
- Add detect_content_type for MIME type detection (images, PDFs, text)
- Build multipart boundaries with random SecureRandom hex values

Card image uploads:
- Add --image option to card create command
- Add --image option to card update command
- Automatically use multipart request when image path provided
- Skip missing files gracefully in multipart requests

User avatar uploads:
- Add --avatar option to user update command
- Use multipart request when avatar path provided

Direct upload for rich text (Active Storage):
- Add upload subcommand with file action
- Implement 3-step direct upload flow:
  1. Create direct upload record via API
  2. Upload file to storage service
  3. Return signed_id for use in rich text fields
- Calculate MD5 checksum with Base64 encoding
- Add base64 gem to Gemfile for Ruby 3.4 compatibility

Test coverage:
- Add client_multipart_test.rb with tests for POST/PUT multipart
- Add upload_test.rb with tests for direct upload command
- Add test fixture image (test_image.png)
- All 103 tests passing
@robzolkos
Copy link
Copy Markdown
Collaborator Author

basecamp/fizzy#2054

@robzolkos robzolkos merged commit 029372a into master Dec 10, 2025
1 check passed
@robzolkos robzolkos deleted the phase-4-file-uploads branch December 10, 2025 17:22
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