Class: W3cApi::Hal

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/w3c_api/hal.rb

Constant Summary collapse

API_URL =
'https://api.w3.org/'

Instance Method Summary collapse

Constructor Details

#initializeHal

Returns a new instance of Hal.



43
44
45
# File 'lib/w3c_api/hal.rb', line 43

def initialize
  # Don't call setup here - it will be called when register is first accessed
end

Instance Method Details

#clientObject



47
48
49
# File 'lib/w3c_api/hal.rb', line 47

def client
  @client ||= Lutaml::Hal::Client.new(api_url: API_URL)
end

#registerObject



51
52
53
54
55
56
57
58
59
60
61
# File 'lib/w3c_api/hal.rb', line 51

def register
  return @register if @register

  @register = Lutaml::Hal::ModelRegister.new(name: :w3c_api, client: client)
  Lutaml::Hal::GlobalRegister.instance.register(:w3c_api, @register)

  # Re-run setup to register all endpoints with the new register
  setup

  @register
end

#reset_registerObject



63
64
65
# File 'lib/w3c_api/hal.rb', line 63

def reset_register
  @register = nil
end