class SocketLabs::InjectionApi::Core::Serialization::InjectionResponseDto

Represents an individual email address for a message. To be serialized into JSON string before sending to the Injection Api.

Attributes

error_code[RW]

the response ErrorCode of the Injection Api send request

transaction_receipt[RW]

the transaction receipt of the Injection Api send request

Public Class Methods

new( error_code = nil, transaction_receipt = nil, message_results = nil ) click to toggle source

Initializes a new instance of the AddressJson class @param [String] error_code @param [String] transaction_receipt @param [Array] message_results

# File lib/socketlabs/injectionapi/core/serialization/injection_response_dto.rb, line 19
def initialize(            
  error_code = nil, 
  transaction_receipt = nil, 
  message_results = nil
)

  @error_code = error_code
  @transaction_receipt = transaction_receipt
  @message_results = message_results

end

Public Instance Methods

message_results() click to toggle source

Get the array of MessageResultDto objects that contain the status of each message sent. @return [Array]

# File lib/socketlabs/injectionapi/core/serialization/injection_response_dto.rb, line 33
def message_results
  @message_results
end
message_results=(value) click to toggle source

Set the array of MessageResultDto objects that contain the status of each message sent. @param [Array] value

# File lib/socketlabs/injectionapi/core/serialization/injection_response_dto.rb, line 39
def message_results=(value)
  @message_results = Array.new

  unless value.nil? || value.empty?
    value.each do |v1|
      if v1.instance_of? MessageResultDto
        @message_results.push(v1)
      end
    end

  end
end
to_hash() click to toggle source

build json hash for InjectionResponseDto @return [hash]

# File lib/socketlabs/injectionapi/core/serialization/injection_response_dto.rb, line 54
def to_hash

  json = {
    :errorCode => @server_id,
    :transactionReceipt => @api_key
  }

  if @message_results.length > 0
    e = Array.new
    @message_results.each do |value|
      e.push(value.to_hash)
    end
    json[:messageResult] = e
  end
  
  json
end