Class: SocketLabs::InjectionApi::Message::MergeData
- Inherits:
-
Object
- Object
- SocketLabs::InjectionApi::Message::MergeData
- Defined in:
- lib/socketlabs/injectionapi/message/merge_data.rb
Overview
Represents MergeData as a key and value pair. Example:
data1 = MergeData.new("key1", "value1")
Instance Attribute Summary collapse
-
#key ⇒ Object
the MergeData key.
-
#value ⇒ Object
the value of the custom header.
Instance Method Summary collapse
-
#initialize(key = nil, value = nil) ⇒ MergeData
constructor
Initializes a new instance of the CustomHeader class.
-
#is_valid ⇒ Boolean
A quick check to ensure that the MergeData is valid.
-
#to_s ⇒ String
Represents the CustomHeader name-value pair as a String.
Constructor Details
#initialize(key = nil, value = nil) ⇒ MergeData
Initializes a new instance of the CustomHeader class
21 22 23 24 25 26 27 |
# File 'lib/socketlabs/injectionapi/message/merge_data.rb', line 21 def initialize( key = nil, value = nil ) @key = key @value = value end |
Instance Attribute Details
#key ⇒ Object
the MergeData key
14 15 16 |
# File 'lib/socketlabs/injectionapi/message/merge_data.rb', line 14 def key @key end |
#value ⇒ Object
the value of the custom header
16 17 18 |
# File 'lib/socketlabs/injectionapi/message/merge_data.rb', line 16 def value @value end |
Instance Method Details
#is_valid ⇒ Boolean
A quick check to ensure that the MergeData is valid.
31 32 33 34 35 36 37 38 |
# File 'lib/socketlabs/injectionapi/message/merge_data.rb', line 31 def is_valid valid_key = StringExtension.is_nil_or_white_space(@key) valid_value = StringExtension.is_nil_or_white_space(@value) if valid_key && valid_value true end false end |
#to_s ⇒ String
Represents the CustomHeader name-value pair as a String
42 43 44 |
# File 'lib/socketlabs/injectionapi/message/merge_data.rb', line 42 def to_s "#{@name}, #{@value}" end |