Sha256: 34c421bc0257c29099085f16d5c3e2147a432300df5aae38e1c753e60d573477
Contents?: true
Size: 1.93 KB
Versions: 7
Compression:
Stored size: 1.93 KB
Contents
module SocketLabs module InjectionApi # The response of an SocketLabsClient send request. class SendResponse # The result [SendResult] of the SocketLabsClient send request. attr_accessor :result # The unique key generated by the Injection API if an unexpected error occurs during the SocketLabsClient # send request. This unique key can be used by SocketLabs support to troubleshoot the issue. attr_accessor :transaction_receipt # A Array of AddressResult objects that contain the status of each address that failed. # If no messages failed this array is empty. attr_accessor :address_results def initialize ( result = nil, transaction_receipt= nil, address_results= nil, response_message= nil ) @result = result @transaction_receipt = transaction_receipt @address_results = [] unless address_results.nil? @address_results = address_results end end # A message detailing why the SocketLabsClient send request failed. def response_message unless @result.nil? @result[:message] end end def response_name unless @result.nil? @result[:name] end end # Represents the SendResponse as a str. def to_s "#{response_name}: #{response_message}" end # build json hash for SendResponse def to_json(*) json = { :result => @result.to_json, :transactionReceipt => @transaction_receipt, :responseMessage => response_message } if @address_results.length > 0 e = Array.new @address_results.each do |value| e.push(value.to_json) end json[:messageResults] = e end json.to_json end end end end
Version data entries
7 entries across 7 versions & 1 rubygems