localmed/ruby-macaroons — pull request #5 by ecordell (2014-10-14 16:11:41+00:00)
Title: Adds binary serialization/deserialization

This adds binary serialization/deserialization for macaroons. I verified that the serialized text is the same as for the python library. (A little more work should be done - serializing a macaroon with first and third party caveats and loading them into the python library along with discharge macaroons and vice-versa).

Wouldn't mind suggestions on the creation patterns here. The external interface is good (I think) but the internal passes a lot of nils around (I guess that's fine, though).

Example:

```ruby
m = Macaroon.new('123', '456', 'http://localmed.com')
m.add_first_party_caveat('caveat_1')
m.add_third_party_caveat('caveat_key', 'caveat_id', 'http://localmed')
n = Macaroon.from_binary(m.serialize)
m
=> #, #]>>
n
=> #, #]>>
```

@joeljames @petebrowne