Class: SocketLabs::InjectionApi::Core::Serialization::MessageResultDto

Inherits:
Object
  • Object
show all
Includes:
SocketLabs::InjectionApi
Defined in:
lib/socketlabs/injectionapi/core/serialization/message_result_dto.rb

Constant Summary

Constants included from SocketLabs::InjectionApi

VERSION

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeMessageResultDto

Returns a new instance of MessageResultDto.



14
15
16
17
18
# File 'lib/socketlabs/injectionapi/core/serialization/message_result_dto.rb', line 14

def initialize
  @index = nil
  @error_code = nil
  @address_results = Array.new
end

Instance Attribute Details

#error_codeObject

Returns the value of attribute error_code.



12
13
14
# File 'lib/socketlabs/injectionapi/core/serialization/message_result_dto.rb', line 12

def error_code
  @error_code
end

#indexObject

Returns the value of attribute index.



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

def index
  @index
end

Instance Method Details

#address_resultsArray

Get the List of AddressResult objects

Returns:

  • (Array)


23
24
25
# File 'lib/socketlabs/injectionapi/core/serialization/message_result_dto.rb', line 23

def address_results 
  @address_results
end

#address_results=(value) ⇒ Object

Set the List of AddressResult objects

Parameters:

  • value (Array)


29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/socketlabs/injectionapi/core/serialization/message_result_dto.rb', line 29

def address_results=(value) 
  @address_results = Array.new

  unless value.nil?

    if value.instance_of? Array
      value.each do |v1|                  
        if v1.instance_of? AddressResult
          @address_results.push(v1)
        end
      end
    end

  end
end

#to_hashObject



46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
# File 'lib/socketlabs/injectionapi/core/serialization/message_result_dto.rb', line 46

def to_hash
  json = {
      :ErrorCode => @error_code,
      :Index => @index
  }
  if @address_results.length > 0
    e = Array.new
    @address_results.each do |value|
      e.push(value.to_hash)
    end

    json[:AddressResult] = e
  end
  json
end