Class: Kumonos::Routes::Route
- Inherits:
-
Struct
- Object
- Struct
- Kumonos::Routes::Route
- Defined in:
- lib/kumonos/routes.rb
Instance Attribute Summary collapse
-
#cluster ⇒ Object
Returns the value of attribute cluster.
-
#prefix ⇒ Object
Returns the value of attribute prefix.
-
#retry_policy ⇒ Object
Returns the value of attribute retry_policy.
-
#timeout_ms ⇒ Object
Returns the value of attribute timeout_ms.
Class Method Summary collapse
Instance Method Summary collapse
Instance Attribute Details
#cluster ⇒ Object
Returns the value of attribute cluster
29 30 31 |
# File 'lib/kumonos/routes.rb', line 29 def cluster @cluster end |
#prefix ⇒ Object
Returns the value of attribute prefix
29 30 31 |
# File 'lib/kumonos/routes.rb', line 29 def prefix @prefix end |
#retry_policy ⇒ Object
Returns the value of attribute retry_policy
29 30 31 |
# File 'lib/kumonos/routes.rb', line 29 def retry_policy @retry_policy end |
#timeout_ms ⇒ Object
Returns the value of attribute timeout_ms
29 30 31 |
# File 'lib/kumonos/routes.rb', line 29 def timeout_ms @timeout_ms end |
Class Method Details
.build(h, cluster) ⇒ Object
31 32 33 |
# File 'lib/kumonos/routes.rb', line 31 def build(h, cluster) new(h.fetch('prefix'), cluster, h.fetch('timeout_ms'), RetryPolicy.build(h.fetch('retry_policy'))) end |
Instance Method Details
#to_h ⇒ Object
36 37 38 39 40 41 |
# File 'lib/kumonos/routes.rb', line 36 def to_h h = super h.delete(:retry_policy) h[:auto_host_rewrite] = true h end |
#to_h_with_retry ⇒ Object
43 44 45 46 47 48 |
# File 'lib/kumonos/routes.rb', line 43 def to_h_with_retry h = to_h h[:retry_policy] = retry_policy.to_h h[:headers] = [{ name: ':method', value: '(GET|HEAD)', regex: true }] h end |