Gem to create a dry-struct based API around your pack

Hey modularity friends,

We followed the advice of some around here, and wrapped some of packs with an API, that is mapped to our pack data structures (models). In so doing, we had to solve a few problems, that might be shared:

  • mapping each attribute of a public type (value object) to a active record model
  • creating a value object from an active record model instance
  • ensuring that arguments passed to API methods in terms of API attributes are converted to their mapped model attributes
  • advertising filters that are supported by an API query method
  • enabling pagination for the results returned by API query methods
  • being able to construct an ActiveRecord query from pagination, sort, and filter arguments

If you’re experienced in this area, we’d love to hear from you… and get some feedback.

If you’re not, and want to wrap your pack in an API, perhaps this tool is of use to you.

I really like what this gem can do! Thank you for publishing it. I hope to find some time over the holidays to apply it to my sample app (my website). I have similar protections going on, but obv not as generically and I am hopeful that this would work for me!!