Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Ruby

Could you give me feedback on an open source DSL I've written in Ruby, named "Hendrix"?

I've been developing various kinds of software and web apps using Ruby for the past couple of years. I've contributed to various small and large open source projects and made a few of my own. One of my own includes the freshly made app I named Hendrix. It is written in pure Ruby (non-Rails).

I like to describe Hendrix as a "foxy DSL for building flat API wrappers". With a very competent DSL, any developer can create a flat API wrapper that follows Ruby conventions and requires very little knowledge of REST. It was inspired by Octokit.rb and of course Sinatra (as you can probably guess from the name and DSL syntax used).

Here's a snippet from the README of how Hendrix can be used:

require 'hendrix'

Hendrix.build 'Jimi' do
  base 'https://api.github.com'

  client :issues do
    action :issue, '/repos/:owner/:repo/issues/:number'
  end
end

Jimi.issue('rafalchmiel', 'hendrix', 1)
  # => {"url"=>"https://api.github.com/repos/rafalchmiel/hendrix/issues/1",
  #  "labels_url"=> ...
Jimi.issue('rafalchmiel', 'hendrix', 1).title
  # => "Implement parameters in actions"

Of course, Hendrix is in its early stages but I'm working very hard to make version 1.0.0. Currently (at the time of writing) it is at version 0.0.2 and 0.1.0.pre is under development. The DSL is fairly stable but, as all pre-1.0 software, contains some bugs. This is where you come in.

I would be delighted to hear some constructive criticism (be as harsh as you want to be) about the idea of Hendrix and its internal design. I want to hear about things that are poorly made and things that need improvement. You can find out more about the project in its README. Keep in mind that I have some neat ideas lined up for version 0.1.0.pre and above - these are noted in the issue tracker and some already implemented in the 0.1.0.pre branch.

I would be extremely grateful if you could have a look and let me know what you think, and "star" the project those of you with GitHub accounts!

Thanks so much!

1 Answer

James Barnett
James Barnett
39,199 Points

I've consumed APIs before and I have a general understanding of what a DSL is however I've never written an API so maybe I'm not the right audience for ...

But I can't figure out what it does exactly.

As you may know, there are a ton of API wrappers out there. Just searching GitHub for "wrapper" will give you a lot of results. Hendrix allows us to create a wrapper for any API. Theoretically, we would be able to reproduce major parts of the Octokit.rb wrapper (a very popular wrapper for GitHub) using Hendrix in just a few lines.