I am creating an open source workflow that will tie an OS X application Devonthink to Zotero in the following manner:
- An AppleScript called inside the OS X app devonthink will run a Ruby script via the shell
- This Ruby script (which I find much faster, better for these sorts of things than old applescript) will make an API call and download response data in Atom format
Example Data - The ruby script will then parse the Atom file and extract a subset of this data and output it
- The Applescript will capture the output of the Ruby script and interact with devonthink in various ways, synching data.
What I would like to get help for here is the parse the Atom file portion of this workflow.
I know there are some great libraries out there for parsing Atom in Ruby, such as Feedzirra etc. but they require the installation of a Gem. I will be distributing the applescript+ruby combo to users who will likely have little or even absolutely no familiarity with the command line or installing gems etc. I would like to make this as easy as possible for the end user to simply drop my script into their applescript folder and the ruby script along with it without any further action on their part.
Given this: what are your recommendations for the best solution to parse the Atom file in ruby without the need to install any gems or other tasks for the end user of the script (is there parsing code that can be simple included within the body of the script itself for example?).
Some possible solutions I imagine that answers might suggest:
a) use native ruby abilities to parse xml
b) use some methods out there that can be copy/pasted directly into my ruby script
My thanks in advance.
I’m not much of a ruby guy, but you should be able to take the source files of a library, put them in your .rb file and perhaps with some small changes, use the library from the rest of your source. The clue is finding a library that is small and without too many dependencies.
Perhaps Simple-RSS will work?