Class: SocketLabs::InjectionApi::Core::Serialization::InjectionResponseDto
- Inherits:
-
Object
- Object
- SocketLabs::InjectionApi::Core::Serialization::InjectionResponseDto
- Defined in:
- lib/socketlabs/injectionapi/core/serialization/injection_response_dto.rb
Overview
Represents an individual email address for a message. To be serialized into JSON string before sending to the Injection Api.
Instance Attribute Summary collapse
-
#error_code ⇒ Object
the response ErrorCode of the Injection Api send request.
-
#transaction_receipt ⇒ Object
the transaction receipt of the Injection Api send request.
Instance Method Summary collapse
-
#initialize(error_code = nil, transaction_receipt = nil, message_results = nil) ⇒ InjectionResponseDto
constructor
Initializes a new instance of the AddressJson class.
-
#message_results ⇒ Array
Get the array of MessageResultDto objects that contain the status of each message sent.
-
#message_results=(value) ⇒ Object
Set the array of MessageResultDto objects that contain the status of each message sent.
-
#to_hash ⇒ hash
build json hash for InjectionResponseDto.
Constructor Details
#initialize(error_code = nil, transaction_receipt = nil, message_results = nil) ⇒ InjectionResponseDto
Initializes a new instance of the AddressJson class
19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/socketlabs/injectionapi/core/serialization/injection_response_dto.rb', line 19 def initialize( error_code = nil, transaction_receipt = nil, = nil ) @error_code = error_code @transaction_receipt = transaction_receipt @message_results = end |
Instance Attribute Details
#error_code ⇒ Object
the response ErrorCode of the Injection Api send request
11 12 13 |
# File 'lib/socketlabs/injectionapi/core/serialization/injection_response_dto.rb', line 11 def error_code @error_code end |
#transaction_receipt ⇒ Object
the transaction receipt of the Injection Api send request
13 14 15 |
# File 'lib/socketlabs/injectionapi/core/serialization/injection_response_dto.rb', line 13 def transaction_receipt @transaction_receipt end |
Instance Method Details
#message_results ⇒ Array
Get the array of MessageResultDto objects that contain the status of each message sent.
33 34 35 |
# File 'lib/socketlabs/injectionapi/core/serialization/injection_response_dto.rb', line 33 def @message_results end |
#message_results=(value) ⇒ Object
Set the array of MessageResultDto objects that contain the status of each message sent.
39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/socketlabs/injectionapi/core/serialization/injection_response_dto.rb', line 39 def (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 ⇒ hash
build json hash for InjectionResponseDto
54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# 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 |