def deserialize_links(builder, media)
      links = media[LINKS_KEY] || {}
      
      links.each do |link_rel,link_values|
        raise(DeserializationError, 'CURIE support not implemented for HAL') if link_rel.eql?(CURIE_KEY)
        if link_values.is_a?(Array)
          if link_values.any? { |link| link[HREF].nil? }
            raise DeserializationError, 'All links must contain the href attribute'
          end
          builder = builder.add_transition_array(link_rel, link_values)
        else
          href = link_values[HREF]
          raise DeserializationError, 'All links must contain the href attribute' unless href
          builder = builder.add_transition(link_rel, href, link_values )
        end
      end
      
      builder
    end
def deserialize_links(builder, media)
      links = media[LINKS_KEY] || {}
      
      links.each do |link_rel,link_values|
        raise(DeserializationError, 'CURIE support not implemented for HAL') if link_rel.eql?(CURIE_KEY)
        if link_values.is_a?(Array)
          if link_values.any? { |link| link[HREF].nil? }
            raise DeserializationError, 'All links must contain the href attribute'
          end
          builder = builder.add_transition_array(link_rel, link_values)
        else
          href = link_values[HREF]
          raise DeserializationError, 'All links must contain the href attribute' unless href
          builder = builder.add_transition(link_rel, href, link_values )
        end
      end
      
      builder
    end
links are under '_links' in the original document. Links always have a key (its name) but
 the value can be a hash with its properties or an array with several links.
 TODO: Figure out error handling for malformed documents