Class: RestRoute

Inherits:
Object
  • Object
show all
Defined in:
lib/hyperion/types/rest_route.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(method, uri, response_descriptor = nil, payload_descriptor = nil) ⇒ RestRoute

Returns a new instance of RestRoute.

Parameters:



10
11
12
13
14
15
# File 'lib/hyperion/types/rest_route.rb', line 10

def initialize(method, uri, response_descriptor=nil, payload_descriptor=nil)
  @method = method
  @uri = HyperionUri.new(uri)
  @response_descriptor = response_descriptor
  @payload_descriptor = payload_descriptor
end

Instance Attribute Details

#methodObject (readonly)

Returns the value of attribute method.



4
5
6
# File 'lib/hyperion/types/rest_route.rb', line 4

def method
  @method
end

#payload_descriptorObject (readonly)

Returns the value of attribute payload_descriptor.



4
5
6
# File 'lib/hyperion/types/rest_route.rb', line 4

def payload_descriptor
  @payload_descriptor
end

#response_descriptorObject (readonly)

Returns the value of attribute response_descriptor.



4
5
6
# File 'lib/hyperion/types/rest_route.rb', line 4

def response_descriptor
  @response_descriptor
end

#uriObject (readonly)

Returns the value of attribute uri.



4
5
6
# File 'lib/hyperion/types/rest_route.rb', line 4

def uri
  @uri
end

Instance Method Details

#as_json(*_args) ⇒ Object



17
18
19
20
21
22
23
24
# File 'lib/hyperion/types/rest_route.rb', line 17

def as_json(*_args)
  {
      'method' => method.to_s,
      'uri' => uri.to_s,
      'response_descriptor' => response_descriptor.as_json(*_args),
      'payload_descriptor' => payload_descriptor.as_json(*_args),
  }
end

#to_sObject



26
27
28
# File 'lib/hyperion/types/rest_route.rb', line 26

def to_s
  "#{method.to_s.upcase} #{uri}"
end