class SocketLabs::InjectionApi::Message::CustomHeader

Represents a custom header as a name-value pair. Example:

header1 = CustomHeader.new
header1.name = "name1"
header1.value = "value1"

header2 = CustomHeader.new("name2", "value2")

Attributes

name[RW]

the name of the custom header

value[RW]

the value of the custom header

Public Class Methods

new( name = nil, value = nil ) click to toggle source

Initializes a new instance of the CustomHeader class @param [String] name @param [String] value

# File lib/socketlabs/injectionapi/message/custom_header.rb, line 26
def initialize(
    name = nil,
    value = nil
)
  @name = name
  @value = value
end

Public Instance Methods

is_valid() click to toggle source

Determines if the CustomHeader is valid. @return [Boolean]

# File lib/socketlabs/injectionapi/message/custom_header.rb, line 36
def is_valid
  valid_name = !(@name.nil? || @name.empty?)
  valid_value = !(@value.nil? || @value.empty?)

  valid_name && valid_value
end
to_s() click to toggle source

Represents the CustomHeader name-value pair as a String @return [String]

# File lib/socketlabs/injectionapi/message/custom_header.rb, line 45
def to_s
    "#{@name}, #{@value}"
end