Class: Ingenico::Direct::SDK::RequestParam

Inherits:
Object
  • Object
show all
Defined in:
lib/ingenico/direct/sdk/request_param.rb

Overview

Represents a URL request parameter. Each parameter is immutable and has a #name and #value attribute.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name, value) ⇒ RequestParam

Returns a new instance of RequestParam.

Raises:

  • (ArgumentError)


10
11
12
13
14
# File 'lib/ingenico/direct/sdk/request_param.rb', line 10

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

Instance Attribute Details

#nameString (readonly)

Parameter name

Returns:

  • (String)

    the current value of name



8
9
10
# File 'lib/ingenico/direct/sdk/request_param.rb', line 8

def name
  @name
end

#valueString (readonly)

Parameter value

Returns:

  • (String)

    the current value of value



8
9
10
# File 'lib/ingenico/direct/sdk/request_param.rb', line 8

def value
  @value
end

Instance Method Details

#to_sObject



19
20
21
# File 'lib/ingenico/direct/sdk/request_param.rb', line 19

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