<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=ISO-8859-1">
</head>
<body bgcolor="#FFFFFF" text="#000000">
The logic used to access Foreman server is spread over several
classes: a bunch of automatically-generated proxy-type classes that
reside in foreman_api gem, ForemanModel (resides in
lib/resources/foreman_model.rb), that is a base-class for Foreman
resource classes that reside in app/models/foreman.<br>
<br>
Good things first:<br>
- app/models/foreman classes are minimal, and clearly show what
attributes are being used.<br>
- app/models/foreman classes allow for local validation via
standard ActiveModel validators.<br>
- app/models/foreman classes allow for easy customization of json
generation.<br>
<br>
<br>
Things I don't like:<br>
- I can't shake the feeling that the approach represented in the
branch is a huge duplication of effort. We are replicating
ActiveResource on every step of the way, and: <br>
- ActiveResource's error handling is better/consistent (ours is
minimal and current approach would require us to recreate all of
RestClient's exceptions)<br>
- ActiveResource's error parsing is much better (we'll have to
duplicate AR's code to be able to parse remote errors).<br>
- Pretty much all of ForemanModel is what we'd get with
ActiveResource for free. Keep in mind that custom methods are simple
with ActiveResource.<br>
- Foreman uses rabl [1] for json-generation, we implemented a
custom approach. I think rabl is at least worth a look.<br>
- Apipie in it's current shape promotes code duplication. See
foreman_api classes, domain- and architectures-controllers in
katello.<br>
<br>
<br>
I propose:<br>
- It's been close to a couple of years since we looked at
ActiveResource last. I'd like to see where it is now, how hard it is
to use with oauth and non-rails types of resource urls these days.<br>
- I'd like to evaluate rabl for use in Katello<br>
- I'd like to fix code duplication issues in Apipie, possibly
switch it to use ActiveResource instead of RestClient<br>
<br>
<br>
-d<br>
<br>
<br>
<meta http-equiv="content-type" content="text/html;
charset=ISO-8859-1">
<a href="https://github.com/nesquena/rabl">[1]
https://github.com/nesquena/rabl</a><br>
<br>
<br>
</body>
</html>