Rubyhorn is a ruby library for accessing Matterhorn via its REST API.

https://github.com/variations-on-video/rubyhorn

 

Usage

Under rails you can setup an initializer (conf/initializers/rubyhorn.rb) based on the default in Hydrant:

require 'rubyhorn'

config = {:uri=>"http://localhost:8080/",
 :user=>'matterhorn_system_account',
 :password=>'CHANGE_ME' }

Rubyhorn.connect(config)

Then in your code calls are made using the Rubyhorn client:

Rubyhorn.client.me
Rubyhorn.client.addMediaPackage(file, {"title" => params[:container_id], "flavor" => "video/source", "workflow" => "fedora-test", "filename" => file.original_filename})

 

Adding New Methods

Each REST method is accessible directly from the client object.  Adding support for methods is as simple as creating a new module under lib/rubyhorn/rest_client, adding the methods there, and including the new module in lib/rubyhorn/matterhorn_client.rb.  Make sure to add unit tests in spec/lib whenever you do add support for new methods.