Add builder methods to Metadata classes

The Metadata building wasn't very DRY and it is more appropriate for
each Metadata class to know how to build a representation of itself.
This way we get timestamp and expires generation for free.