Class: Halva::Curie

Inherits:
Object
  • Object
show all
Defined in:
lib/halva/curie.rb

Overview

Compact URI Link Object See [HAL Draft](datatracker.ietf.org/doc/html/draft-kelly-json-hal#section-8.2)

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(href, name) ⇒ Curie

Returns a new instance of Curie.

Parameters:

  • href (String)
  • name (String)


11
12
13
14
15
# File 'lib/halva/curie.rb', line 11

def initialize(href, name)
  @href = href
  @relation = :curies
  @link = Halva::Link.new(@href, @relation, { templated: true, name: name })
end

Instance Attribute Details

#hrefObject (readonly)

Returns the value of attribute href.



7
8
9
# File 'lib/halva/curie.rb', line 7

def href
  @href
end

#relationObject (readonly)

Returns the value of attribute relation.



7
8
9
# File 'lib/halva/curie.rb', line 7

def relation
  @relation
end

Instance Method Details

#to_hObject



17
18
19
# File 'lib/halva/curie.rb', line 17

def to_h
  @link.to_h
end