Class: Gruf::Outbound::RequestContext
- Inherits:
-
Object
- Object
- Gruf::Outbound::RequestContext
- Defined in:
- lib/gruf/outbound/request_context.rb
Overview
Encapsulates the context of an outbound client request
Instance Attribute Summary collapse
-
#call ⇒ Object
readonly
Returns the value of attribute call.
-
#metadata ⇒ Object
readonly
Returns the value of attribute metadata.
-
#method ⇒ Object
readonly
Returns the value of attribute method.
-
#requests ⇒ Object
readonly
Returns the value of attribute requests.
-
#type ⇒ Object
readonly
Returns the value of attribute type.
Instance Method Summary collapse
-
#initialize(type:, requests:, call:, method:, metadata:) ⇒ RequestContext
constructor
Initialize the new request context.
-
#method_name ⇒ String
Return the name of the method being called, e.g.
-
#route_key ⇒ String
Return the proper routing key for the request.
Constructor Details
#initialize(type:, requests:, call:, method:, metadata:) ⇒ RequestContext
Initialize the new request context
49 50 51 52 53 54 55 |
# File 'lib/gruf/outbound/request_context.rb', line 49 def initialize(type:, requests:, call:, method:, metadata:) @type = type @requests = requests @call = call @method = method @metadata = end |
Instance Attribute Details
#call ⇒ Object (readonly)
Returns the value of attribute call.
32 33 34 |
# File 'lib/gruf/outbound/request_context.rb', line 32 def call @call end |
#metadata ⇒ Object (readonly)
Returns the value of attribute metadata.
38 39 40 |
# File 'lib/gruf/outbound/request_context.rb', line 38 def @metadata end |
#method ⇒ Object (readonly)
Returns the value of attribute method.
35 36 37 |
# File 'lib/gruf/outbound/request_context.rb', line 35 def method @method end |
#requests ⇒ Object (readonly)
Returns the value of attribute requests.
29 30 31 |
# File 'lib/gruf/outbound/request_context.rb', line 29 def requests @requests end |
#type ⇒ Object (readonly)
Returns the value of attribute type.
26 27 28 |
# File 'lib/gruf/outbound/request_context.rb', line 26 def type @type end |
Instance Method Details
#method_name ⇒ String
Return the name of the method being called, e.g. GetThing
62 63 64 |
# File 'lib/gruf/outbound/request_context.rb', line 62 def method_name @method.to_s.split('/').last.to_s end |
#route_key ⇒ String
Return the proper routing key for the request
71 72 73 |
# File 'lib/gruf/outbound/request_context.rb', line 71 def route_key @method[1..].to_s.underscore.tr('/', '.') end |