New versions of API libraries

Released new versions of both the Python and Ruby interfaces to the Numerous APIs. This update allows you to call write() with the “only write it if the value changed” feature and just ignore any exception that comes (when the value hasn’t changed). This is probably a more common usage pattern. So now, for example, you can do this in python:

m.write(newvalue, onlyIf="IGNORE")

where before you would have had to write:

    m.write(newvalue, onlyIf=True)
except NumerousMetricConflictError:

to handle the reported “no change” exception even when you didn’t care about it. Specifying onlyIf as True gives you this older behavior and specifying the string ‘IGNORE’ (must be UPPER CASE) gives the newer behavior.

The ruby library has the same enhancement.

As a reminder of typical installation methods:

% sudo pip install numerous

You may need to do “pip2” or “pip3” instead, depending on your specific environment and which flavor of python you are installing. Also if you are upgrading from an already installed version:

% sudo pip install –upgrade numerous

Similarly you install the ruby gem via “sudo gem install numerousapp” (note slight name difference here).

Github sources:

Documentation for either library can be found on its wiki page (accessible from the github home page links given above).

2 Replies to “New versions of API libraries”

  1. I wanted to drop a note and say thank you for this Ruby library, it proved very useful for me recently. I have been interested in Numerous for a little while now and when I finally got to do some hacking with it your library was great.

    I also wanted to ask if you would be interested in some pull requests that make the library more ruby-ish, for example using some different styles for method naming and splitting the single file up into a set of files per-class, as is common with gems.

  2. Thanks Jimmy.

    I would certainly be open to improvements / pull requests. Honestly this was the first thing I ever wrote in Ruby and I literally did it because my brother taunted me (I’m not making this up) with “you’re such a geezer; all the cool kids use Ruby today”.

    As you may realize it’s a more-or-less “mechanical plus” translation from the Python version (which also has some naming style issues I later have found out).

    I think we need to keep naming compatibility but as long as there’s a mapping layer available (so the old names still work) I’m open to new names plus of course “better” Ruby style. Fire away!

Comments are closed.