Class: Peddler::VCRMatcher

Inherits:
Object
  • Object
show all
Defined in:
lib/peddler/vcr_matcher.rb

Overview

A custom matcher that can be used to record MWS interactions when integration-testing

Constant Summary collapse

TRANSIENT_PARAMS =
%w[
  Signature Timestamp StartDate CreatedAfter QueryStartDateTime
].freeze
SELLER_PARAMS =
%w[
  AWSAccessKeyId SellerId
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*requests) ⇒ VCRMatcher

Returns a new instance of VCRMatcher.



31
32
33
# File 'lib/peddler/vcr_matcher.rb', line 31

def initialize(*requests)
  @requests = requests
end

Instance Attribute Details

#requestsObject (readonly)

Returns the value of attribute requests.



29
30
31
# File 'lib/peddler/vcr_matcher.rb', line 29

def requests
  @requests
end

Class Method Details

.call(*requests) ⇒ Object



16
17
18
# File 'lib/peddler/vcr_matcher.rb', line 16

def call(*requests)
  new(*requests).compare
end

.ignore_seller!Object



24
25
26
# File 'lib/peddler/vcr_matcher.rb', line 24

def ignore_seller!
  ignored_params.concat(SELLER_PARAMS)
end

.ignored_paramsObject



20
21
22
# File 'lib/peddler/vcr_matcher.rb', line 20

def ignored_params
  @ignored_params ||= TRANSIENT_PARAMS.dup
end

Instance Method Details

#compareObject



35
36
37
# File 'lib/peddler/vcr_matcher.rb', line 35

def compare
  compare_uris && compare_bodies
end