class SocketLabs::InjectionApi::SendResponse
The response of an SocketLabsClient
send request.
Attributes
address_results[RW]
A Array of AddressResult
objects that contain the status of each address that failed. If no messages failed this array is empty.
result[RW]
The result [SendResult] of the SocketLabsClient
send request.
transaction_receipt[RW]
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.
Public Class Methods
new( result = nil, transaction_receipt= nil, address_results= nil, response_message= nil )
click to toggle source
# File lib/socketlabs/injectionapi/send_response.rb, line 15 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
Public Instance Methods
response_message()
click to toggle source
A message detailing why the SocketLabsClient
send request failed.
# File lib/socketlabs/injectionapi/send_response.rb, line 32 def response_message unless @result.nil? @result[:message] end end
response_name()
click to toggle source
# File lib/socketlabs/injectionapi/send_response.rb, line 38 def response_name unless @result.nil? @result[:name] end end
to_json(*)
click to toggle source
build json hash for SendResponse
# File lib/socketlabs/injectionapi/send_response.rb, line 50 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
to_s()
click to toggle source
Represents the SendResponse
as a str.
# File lib/socketlabs/injectionapi/send_response.rb, line 45 def to_s "#{response_name}: #{response_message}" end