Class: Inferno::Entities::Header

Inherits:
Entity
  • Object
show all
Includes:
Attributes
Defined in:
lib/inferno/entities/header.rb

Overview

A Header represents an HTTP request/response header

Constant Summary collapse

ATTRIBUTES =
[:id, :request_id, :name, :type, :value].freeze

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Attributes

included

Constructor Details

#initialize(params) ⇒ Header



20
21
22
# File 'lib/inferno/entities/header.rb', line 20

def initialize(params)
  super(params, ATTRIBUTES)
end

Instance Attribute Details

#idString



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/inferno/entities/header.rb', line 15

class Header < Entity
  ATTRIBUTES = [:id, :request_id, :name, :type, :value].freeze

  include Inferno::Entities::Attributes

  def initialize(params)
    super(params, ATTRIBUTES)
  end

  def request?
    type == 'request'
  end

  def response?
    type == 'response'
  end

  def to_hash
    {
      id:,
      request_id:,
      type:,
      name:,
      value:
    }.compact
  end
end

#nameString



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/inferno/entities/header.rb', line 15

class Header < Entity
  ATTRIBUTES = [:id, :request_id, :name, :type, :value].freeze

  include Inferno::Entities::Attributes

  def initialize(params)
    super(params, ATTRIBUTES)
  end

  def request?
    type == 'request'
  end

  def response?
    type == 'response'
  end

  def to_hash
    {
      id:,
      request_id:,
      type:,
      name:,
      value:
    }.compact
  end
end

#request_idString



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/inferno/entities/header.rb', line 15

class Header < Entity
  ATTRIBUTES = [:id, :request_id, :name, :type, :value].freeze

  include Inferno::Entities::Attributes

  def initialize(params)
    super(params, ATTRIBUTES)
  end

  def request?
    type == 'request'
  end

  def response?
    type == 'response'
  end

  def to_hash
    {
      id:,
      request_id:,
      type:,
      name:,
      value:
    }.compact
  end
end

#typeString



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/inferno/entities/header.rb', line 15

class Header < Entity
  ATTRIBUTES = [:id, :request_id, :name, :type, :value].freeze

  include Inferno::Entities::Attributes

  def initialize(params)
    super(params, ATTRIBUTES)
  end

  def request?
    type == 'request'
  end

  def response?
    type == 'response'
  end

  def to_hash
    {
      id:,
      request_id:,
      type:,
      name:,
      value:
    }.compact
  end
end

#valueString



15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/inferno/entities/header.rb', line 15

class Header < Entity
  ATTRIBUTES = [:id, :request_id, :name, :type, :value].freeze

  include Inferno::Entities::Attributes

  def initialize(params)
    super(params, ATTRIBUTES)
  end

  def request?
    type == 'request'
  end

  def response?
    type == 'response'
  end

  def to_hash
    {
      id:,
      request_id:,
      type:,
      name:,
      value:
    }.compact
  end
end

Instance Method Details

#request?Boolean



24
25
26
# File 'lib/inferno/entities/header.rb', line 24

def request?
  type == 'request'
end

#response?Boolean



28
29
30
# File 'lib/inferno/entities/header.rb', line 28

def response?
  type == 'response'
end

#to_hashObject



32
33
34
35
36
37
38
39
40
# File 'lib/inferno/entities/header.rb', line 32

def to_hash
  {
    id:,
    request_id:,
    type:,
    name:,
    value:
  }.compact
end