Class: Ingenico::Connect::SDK::ResponseHeader

Inherits:
Object
  • Object
show all
Defined in:
lib/ingenico/connect/sdk/response_header.rb

Overview

Represents HTTP response headers Each header is immutable has a #name and #value attribute

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ ResponseHeader

Create a new header using the name and value given as parameters.

Raises:

  • (ArgumentError)


8
9
10
11
12
# File 'lib/ingenico/connect/sdk/response_header.rb', line 8

def initialize(name, value)
  raise ArgumentError.new('name is required') if name.nil? or name.strip.empty?
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject (readonly)

HTTP header name



15
16
17
# File 'lib/ingenico/connect/sdk/response_header.rb', line 15

def name
  @name
end

#valueObject (readonly)

HTTP header value



17
18
19
# File 'lib/ingenico/connect/sdk/response_header.rb', line 17

def value
  @value
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/ingenico/connect/sdk/response_header.rb', line 19

def to_s
  "#{name}:#{value}"
end