Class: VCR::HTTPInteraction::HookAware
- Inherits:
-
VCR::HTTPInteraction
- Object
- Struct
- VCR::HTTPInteraction
- VCR::HTTPInteraction::HookAware
- Defined in:
- lib/vcr/structs.rb
Overview
Decorates an VCR::HTTPInteraction with additional methods useful
for a before_record
or before_playback
hook.
Instance Attribute Summary
Attributes inherited from VCR::HTTPInteraction
#recorded_at, #request, #response
Instance Method Summary collapse
-
#filter!(text, replacement_text) ⇒ Object
Replaces a string in any part of the HTTP interaction (headers, request body, response body, etc) with the given replacement text.
-
#ignore! ⇒ Object
Flags the HTTP interaction so that VCR ignores it.
-
#ignored? ⇒ Boolean
Whether or not this HTTP interaction should be ignored.
-
#initialize(http_interaction) ⇒ HookAware
constructor
A new instance of HookAware.
Methods inherited from VCR::HTTPInteraction
from_hash, #hook_aware, #to_hash
Constructor Details
#initialize(http_interaction) ⇒ HookAware
Returns a new instance of HookAware.
539 540 541 542 |
# File 'lib/vcr/structs.rb', line 539 def initialize(http_interaction) @ignored = false super end |
Instance Method Details
#filter!(text, replacement_text) ⇒ Object
Replaces a string in any part of the HTTP interaction (headers, request body, response body, etc) with the given replacement text.
563 564 565 566 567 |
# File 'lib/vcr/structs.rb', line 563 def filter!(text, replacement_text) text, replacement_text = text.to_s, replacement_text.to_s return self if [text, replacement_text].any? { |t| t.empty? } filter_object!(self, text, replacement_text) end |
#ignore! ⇒ Object
Flags the HTTP interaction so that VCR ignores it. This is useful in a Configuration#before_record or Configuration#before_playback hook so that VCR does not record or play it back.
548 549 550 |
# File 'lib/vcr/structs.rb', line 548 def ignore! @ignored = true end |
#ignored? ⇒ Boolean
Returns whether or not this HTTP interaction should be ignored.
554 555 556 |
# File 'lib/vcr/structs.rb', line 554 def ignored? !!@ignored end |