Class: Lutaml::Hal::EndpointConfiguration

Inherits:
Object
  • Object
show all
Defined in:
lib/lutaml/hal/endpoint_configuration.rb

Overview

Configuration object for endpoint registration with EndpointParameter support

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeEndpointConfiguration

Returns a new instance of EndpointConfiguration.



9
10
11
12
# File 'lib/lutaml/hal/endpoint_configuration.rb', line 9

def initialize
  @endpoint_path = nil
  @parameters = []
end

Instance Attribute Details

#endpoint_pathObject (readonly)

Returns the value of attribute endpoint_path.



7
8
9
# File 'lib/lutaml/hal/endpoint_configuration.rb', line 7

def endpoint_path
  @endpoint_path
end

#parametersObject

Returns the value of attribute parameters.



7
8
9
# File 'lib/lutaml/hal/endpoint_configuration.rb', line 7

def parameters
  @parameters
end

Instance Method Details

#add_parameter(parameter) ⇒ Object

Add a parameter to this endpoint



20
21
22
# File 'lib/lutaml/hal/endpoint_configuration.rb', line 20

def add_parameter(parameter)
  @parameters << parameter
end

DSL method to add cookie parameter



45
46
47
# File 'lib/lutaml/hal/endpoint_configuration.rb', line 45

def cookie_parameter(name, **options)
  add_parameter(EndpointParameter.cookie(name, **options))
end

#header_parameter(name, **options) ⇒ Object

DSL method to add header parameter



40
41
42
# File 'lib/lutaml/hal/endpoint_configuration.rb', line 40

def header_parameter(name, **options)
  add_parameter(EndpointParameter.header(name, **options))
end

#path(path_string) ⇒ Object

Set the endpoint path



15
16
17
# File 'lib/lutaml/hal/endpoint_configuration.rb', line 15

def path(path_string)
  @endpoint_path = path_string
end

#path_parameter(name, **options) ⇒ Object

DSL method to add path parameter



30
31
32
# File 'lib/lutaml/hal/endpoint_configuration.rb', line 30

def path_parameter(name, **options)
  add_parameter(EndpointParameter.path(name, **options))
end

#query_parameter(name, **options) ⇒ Object

DSL method to add query parameter



35
36
37
# File 'lib/lutaml/hal/endpoint_configuration.rb', line 35

def query_parameter(name, **options)
  add_parameter(EndpointParameter.query(name, **options))
end