Class: RestRoute
- Inherits:
-
Object
- Object
- RestRoute
- Defined in:
- lib/hyperion/types/rest_route.rb
Instance Attribute Summary collapse
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#payload_descriptor ⇒ Object
readonly
Returns the value of attribute payload_descriptor.
-
#response_descriptor ⇒ Object
readonly
Returns the value of attribute response_descriptor.
-
#uri ⇒ Object
readonly
Returns the value of attribute uri.
Instance Method Summary collapse
- #as_json(*_args) ⇒ Object
-
#initialize(method, uri, response_descriptor = nil, payload_descriptor = nil) ⇒ RestRoute
constructor
A new instance of RestRoute.
- #to_s ⇒ Object
Constructor Details
#initialize(method, uri, response_descriptor = nil, payload_descriptor = nil) ⇒ RestRoute
Returns a new instance of RestRoute.
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
#method ⇒ Object (readonly)
Returns the value of attribute method.
4 5 6 |
# File 'lib/hyperion/types/rest_route.rb', line 4 def method @method end |
#payload_descriptor ⇒ Object (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_descriptor ⇒ Object (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 |
#uri ⇒ Object (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_s ⇒ Object
26 27 28 |
# File 'lib/hyperion/types/rest_route.rb', line 26 def to_s "#{method.to_s.upcase} #{uri}" end |