Class: ApiSampler::RequestTag

Inherits:
Struct
  • Object
show all
Defined in:
lib/api_sampler/request_tag.rb

Overview

A Plain Old Ruby Object to hold a tag with the corresponding request matcher.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(tag, matcher) ⇒ RequestTag

Parameters:

  • tag (#to_s)

    a non-blank tag.

  • matcher (RequestMatcher)

    the corresponding request matcher.

Raises:

  • (ArgumentError)

    if arguments are invalid.


21
22
23
24
25
26
27
28
29
# File 'lib/api_sampler/request_tag.rb', line 21

RequestTag = Struct.new('RequestTag', :name, :matcher) do
  def initialize(tag, matcher)
    raise ArgumentError, 'tag cannot be blank' if tag.blank?
    raise ArgumentError, 'matcher must be a ApiSampler::RequestMatcher' unless
      matcher.is_a?(RequestMatcher)

    super(tag.to_s, matcher)
  end
end

Instance Attribute Details

#matcherRequestMatcher

Returns the corresponding request matcher

Returns:


21
22
23
24
25
26
27
28
29
# File 'lib/api_sampler/request_tag.rb', line 21

RequestTag = Struct.new('RequestTag', :name, :matcher) do
  def initialize(tag, matcher)
    raise ArgumentError, 'tag cannot be blank' if tag.blank?
    raise ArgumentError, 'matcher must be a ApiSampler::RequestMatcher' unless
      matcher.is_a?(RequestMatcher)

    super(tag.to_s, matcher)
  end
end

#name#to_s

Returns tag name

Returns:

  • (#to_s)

    tag name


21
22
23
24
25
26
27
28
29
# File 'lib/api_sampler/request_tag.rb', line 21

RequestTag = Struct.new('RequestTag', :name, :matcher) do
  def initialize(tag, matcher)
    raise ArgumentError, 'tag cannot be blank' if tag.blank?
    raise ArgumentError, 'matcher must be a ApiSampler::RequestMatcher' unless
      matcher.is_a?(RequestMatcher)

    super(tag.to_s, matcher)
  end
end