Class: Bidi2pdf::Bidi::Commands::AddIntercept
- Inherits:
-
Object
- Object
- Bidi2pdf::Bidi::Commands::AddIntercept
show all
- Includes:
- Base
- Defined in:
- lib/bidi2pdf/bidi/commands/add_intercept.rb
Constant Summary
collapse
- BEFORE_REQUEST =
"beforeRequestSent"
- RESPONSE_STARTED =
"responseStarted"
- AUTH_REQUIRED =
"authRequired"
Instance Method Summary
collapse
Methods included from Base
#==, #as_payload, #eql?, #hash, #inspect
Constructor Details
#initialize(context:, phases:, url_patterns:) ⇒ AddIntercept
Returns a new instance of AddIntercept.
13
14
15
16
17
18
19
|
# File 'lib/bidi2pdf/bidi/commands/add_intercept.rb', line 13
def initialize(context:, phases:, url_patterns:)
@context = context
@phases = phases
@url_patterns = url_patterns
validate_phases!
end
|
Instance Method Details
#method_name ⇒ Object
21
22
23
|
# File 'lib/bidi2pdf/bidi/commands/add_intercept.rb', line 21
def method_name
"network.addIntercept"
end
|
#params ⇒ Object
25
26
27
28
29
30
31
|
# File 'lib/bidi2pdf/bidi/commands/add_intercept.rb', line 25
def params
{
context: @context,
phases: @phases,
urlPatterns: @url_patterns
}.compact
end
|
#validate_phases! ⇒ Object
33
34
35
36
37
|
# File 'lib/bidi2pdf/bidi/commands/add_intercept.rb', line 33
def validate_phases!
valid_phases = [BEFORE_REQUEST, RESPONSE_STARTED, AUTH_REQUIRED]
raise ArgumentError, "Unsupported phase(s): #{@phases}" unless @phases.all? { |phase| valid_phases.include?(phase) }
end
|