Sha256: 4a31244b40fb502480f0065df7f5a0e1ccfacc2319e4e13d326dee64588be16c
Contents?: true
Size: 620 Bytes
Versions: 2
Compression:
Stored size: 620 Bytes
Contents
# frozen_string_literal: true module Excon module HyperMedia # Link # # This HyperMedia::Link object encapsulates a link pointing to a resource. # class Link attr_reader :name def initialize(name:, hash:) @hash = hash @name = name end def valid? link_data.keys.any? end def invalid? !valid? end def uri ::Addressable::URI.parse(href) end def href link_data['href'] end private def link_data @hash.dig('_links', name.to_s) || {} end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
excon-hypermedia-0.3.0 | lib/excon/hypermedia/link.rb |
excon-hypermedia-0.2.0 | lib/excon/hypermedia/link.rb |