Class: Lutaml::Hal::EndpointConfiguration
- Inherits:
-
Object
- Object
- Lutaml::Hal::EndpointConfiguration
- Defined in:
- lib/lutaml/hal/endpoint_configuration.rb
Overview
Configuration object for endpoint registration with EndpointParameter support
Instance Attribute Summary collapse
-
#endpoint_path ⇒ Object
readonly
Returns the value of attribute endpoint_path.
-
#parameters ⇒ Object
Returns the value of attribute parameters.
Instance Method Summary collapse
-
#add_parameter(parameter) ⇒ Object
Add a parameter to this endpoint.
-
#cookie_parameter(name, **options) ⇒ Object
DSL method to add cookie parameter.
-
#header_parameter(name, **options) ⇒ Object
DSL method to add header parameter.
-
#initialize ⇒ EndpointConfiguration
constructor
A new instance of EndpointConfiguration.
-
#path(path_string) ⇒ Object
Set the endpoint path.
-
#path_parameter(name, **options) ⇒ Object
DSL method to add path parameter.
-
#query_parameter(name, **options) ⇒ Object
DSL method to add query parameter.
Constructor Details
#initialize ⇒ EndpointConfiguration
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_path ⇒ Object (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 |
#parameters ⇒ Object
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 |
#cookie_parameter(name, **options) ⇒ Object
DSL method to add cookie parameter
45 46 47 |
# File 'lib/lutaml/hal/endpoint_configuration.rb', line 45 def (name, **) add_parameter(EndpointParameter.(name, **)) 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, **) add_parameter(EndpointParameter.header(name, **)) 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, **) add_parameter(EndpointParameter.path(name, **)) 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, **) add_parameter(EndpointParameter.query(name, **)) end |