module RESTful::Matchers::Parsers::JSONLinkParser

Public Class Methods

parse(content) click to toggle source
# File lib/restful/matchers/parsers/json_link_parser.rb, line 5
def self.parse(content)
  json =  content.is_a?(Hash) ? content : JSON.parse(content)
  links = nil
  if json["links"]
    links = {}
    json["links"].each { |link| links[link["rel"]] = link["href"] }
  end
  return links
end