Class: SiteHub::ForwardProxy
- Inherits:
-
Object
- Object
- SiteHub::ForwardProxy
- Defined in:
- lib/sitehub/forward_proxy.rb
Instance Attribute Summary collapse
-
#downstream_client ⇒ Object
readonly
Returns the value of attribute downstream_client.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#mapped_path ⇒ Object
readonly
Returns the value of attribute mapped_path.
-
#mapped_url ⇒ Object
readonly
Returns the value of attribute mapped_url.
-
#sitehub_cookie_name ⇒ Object
readonly
Returns the value of attribute sitehub_cookie_name.
-
#sitehub_cookie_path ⇒ Object
readonly
Returns the value of attribute sitehub_cookie_path.
Instance Method Summary collapse
- #call(env) ⇒ Object
-
#initialize(sitehub_cookie_path: nil, sitehub_cookie_name:, id:, rule: nil, mapped_path:, mapped_url:) ⇒ ForwardProxy
constructor
A new instance of ForwardProxy.
- #resolve_sitehub_cookie_path(request) ⇒ Object
Methods included from Rules
Methods included from Resolver
Methods included from Equality
Constructor Details
#initialize(sitehub_cookie_path: nil, sitehub_cookie_name:, id:, rule: nil, mapped_path:, mapped_url:) ⇒ ForwardProxy
Returns a new instance of ForwardProxy.
10 11 12 13 14 15 16 17 18 |
# File 'lib/sitehub/forward_proxy.rb', line 10 def initialize(sitehub_cookie_path: nil, sitehub_cookie_name:, id:, rule: nil, mapped_path:, mapped_url:) @downstream_client = DownstreamClient.new @sitehub_cookie_path = @sitehub_cookie_name = @id = id @rule = rule @mapped_path = mapped_path @mapped_url = mapped_url end |
Instance Attribute Details
#downstream_client ⇒ Object (readonly)
Returns the value of attribute downstream_client.
6 7 8 |
# File 'lib/sitehub/forward_proxy.rb', line 6 def downstream_client @downstream_client end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
6 7 8 |
# File 'lib/sitehub/forward_proxy.rb', line 6 def id @id end |
#mapped_path ⇒ Object (readonly)
Returns the value of attribute mapped_path.
6 7 8 |
# File 'lib/sitehub/forward_proxy.rb', line 6 def mapped_path @mapped_path end |
#mapped_url ⇒ Object (readonly)
Returns the value of attribute mapped_url.
6 7 8 |
# File 'lib/sitehub/forward_proxy.rb', line 6 def mapped_url @mapped_url end |
#sitehub_cookie_name ⇒ Object (readonly)
Returns the value of attribute sitehub_cookie_name.
6 7 8 |
# File 'lib/sitehub/forward_proxy.rb', line 6 def @sitehub_cookie_name end |
#sitehub_cookie_path ⇒ Object (readonly)
Returns the value of attribute sitehub_cookie_path.
6 7 8 |
# File 'lib/sitehub/forward_proxy.rb', line 6 def @sitehub_cookie_path end |
Instance Method Details
#call(env) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/sitehub/forward_proxy.rb', line 20 def call(env) request = env[REQUEST] request.map(mapped_path, mapped_url) downstream_client.call(request).tap do |response| response.(, path: (request), value: id) end end |
#resolve_sitehub_cookie_path(request) ⇒ Object
31 32 33 |
# File 'lib/sitehub/forward_proxy.rb', line 31 def (request) || request.path end |