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.
542 543 544 545 |
# File 'lib/vcr/structs.rb', line 542 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.
566 567 568 569 570 |
# File 'lib/vcr/structs.rb', line 566 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.
551 552 553 |
# File 'lib/vcr/structs.rb', line 551 def ignore! @ignored = true end |
#ignored? ⇒ Boolean
Returns whether or not this HTTP interaction should be ignored.
557 558 559 |
# File 'lib/vcr/structs.rb', line 557 def ignored? !!@ignored end |