Conversation
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.
Here's a summary of the changes we've made to implement a Ruby object model for the Pylon API client:
- Implemented Models::Base class with attribute access through method_missing
- Added specific model classes for all API resources (User, Issue, Account, etc.)
- Created a Collection class that implements Enumerable for lists of resources
- Modified all API methods to return model objects instead of raw hashes
- Added model_class and collection parameters to HTTP request methods
- Updated handler_response to properly wrap responses in model objects
- Maintained backward compatibility with the previous hash-based approach
- Updated the README with examples using the new object model
- Created a migration guide to help users transition to the object model
- Added API validation script to verify model compatibility with the actual API
- Modified all tests to work with the new object model
- Added tests for the model classes themselves
- All tests are passing with 84.69% line coverage
- Bumped version to 1.1.0 (as a compatible feature addition)
- Updated CHANGELOG.md with detailed information about the new object model
The new object model provides a much more intuitive Ruby interface while maintaining backwards
compatibility. Users can now use methods like issue.title instead of hash access issue["title"], and
collections are directly enumerable with methods like each, map, etc.
To validate against the current API documentation, you can use the api_validation.rb script we created,
which will compare our model structures with the actual API responses.