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 writing integration tests

Constant Summary collapse

TRANSIENT_PARAMS =

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

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

This constant is part of a private API. You should avoid using this constant if possible, as it may be removed or be changed in the future.

%w[
  AWSAccessKeyId SellerId
].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(*requests) ⇒ VCRMatcher

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of VCRMatcher.



40
41
42
# File 'lib/peddler/vcr_matcher.rb', line 40

def initialize(*requests)
  @requests = requests
end

Instance Attribute Details

#requestsObject (readonly)

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



37
38
39
# File 'lib/peddler/vcr_matcher.rb', line 37

def requests
  @requests
end

Class Method Details

.call(*requests) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

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

.ignore_seller!void

This method returns an undefined value.

Ignore seller specific attributes when recording



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

def ignore_seller!
  ignored_params.concat(SELLER_PARAMS)
  ignored_params.uniq!
end

.ignored_paramsObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



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

def ignored_params
  @ignored_params ||= TRANSIENT_PARAMS.dup
end

Instance Method Details

#compareObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



45
46
47
# File 'lib/peddler/vcr_matcher.rb', line 45

def compare
  compare_uris && compare_bodies
end