Class: Util::LinkUtils

Inherits:
Object
  • Object
show all
Defined in:
lib/vas/util/link_utils.rb

Class Method Summary collapse

Class Method Details



33
34
35
36
37
38
39
40
# File 'lib/vas/util/link_utils.rb', line 33

def LinkUtils.get_link_href(json, rel)
  hrefs = get_link_hrefs(json, rel)
  if (hrefs.length > 0)
    hrefs[0]
  else
    nil
  end
end


23
24
25
26
27
# File 'lib/vas/util/link_utils.rb', line 23

def LinkUtils.get_link_hrefs(json, rel)
  hrefs = []
  json["links"].select { |link| link["rel"] == rel }.each { |item| hrefs << item["href"] }
  hrefs
end


29
30
31
# File 'lib/vas/util/link_utils.rb', line 29

def LinkUtils.get_self_link_href(json)
  LinkUtils.get_link_hrefs(json, "self")[0]
end