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.



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

def initialize(*requests)
  @requests = requests
end

Instance Attribute Details

#requestsObject (readonly)

Returns the value of attribute requests.



27
28
29
# File 'lib/peddler/vcr_matcher.rb', line 27

def requests
  @requests
end

Class Method Details

.call(*requests) ⇒ Object



14
15
16
# File 'lib/peddler/vcr_matcher.rb', line 14

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

.ignore_seller!Object



22
23
24
# File 'lib/peddler/vcr_matcher.rb', line 22

def ignore_seller!
  ignored_params.concat(SELLER_PARAMS)
end

.ignored_paramsObject



18
19
20
# File 'lib/peddler/vcr_matcher.rb', line 18

def ignored_params
  @ignored_params ||= TRANSIENT_PARAMS.dup
end

Instance Method Details

#compareObject



33
34
35
# File 'lib/peddler/vcr_matcher.rb', line 33

def compare
  compare_uris && compare_bodies
end