Class: SocketLabs::InjectionApi::Core::Serialization::CustomHeaderJson

Inherits:
Object
  • Object
show all
Defined in:
lib/socketlabs/injectionapi/core/serialization/custom_header_json.rb

Overview

Represents a custom header as a name and value pair. To be serialized into JSON string before sending to the Injection Api.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(name = nil, value = nil) ⇒ CustomHeaderJson

Initializes a new instance of the CustomHeaderJson class

Parameters:

  • name (String) (defaults to: nil)
  • value (String) (defaults to: nil)


18
19
20
21
22
23
24
# File 'lib/socketlabs/injectionapi/core/serialization/custom_header_json.rb', line 18

def initialize(
  name = nil,
  value = nil
)
  @name = name
  @value = value
end

Instance Attribute Details

#nameObject

name of the custom header.



11
12
13
# File 'lib/socketlabs/injectionapi/core/serialization/custom_header_json.rb', line 11

def name
  @name
end

#valueObject

value of the custom header.



13
14
15
# File 'lib/socketlabs/injectionapi/core/serialization/custom_header_json.rb', line 13

def value
  @value
end

Instance Method Details

#to_hashhash

build json hash for CustomHeaderJson

Returns:

  • (hash)


28
29
30
31
32
33
# File 'lib/socketlabs/injectionapi/core/serialization/custom_header_json.rb', line 28

def to_hash
  {
    :name => @name,
    :value => @value
  }
end