class ClientResponse
Defines response returned by EmailClient
and is used in the API's output
Attributes
email[R]
status[R]
Public Class Methods
new(email = EmailObject.new, status = 'UNDEFINED')
click to toggle source
# File lib/email_api/email/data/client_response.rb, line 8 def initialize(email = EmailObject.new, status = 'UNDEFINED') @email = email @status = status end
Public Instance Methods
==(other)
click to toggle source
# File lib/email_api/email/data/client_response.rb, line 25 def ==(other) return false unless other.respond_to?(:to_hash) to_hash == other.to_hash end
set_bad_req()
click to toggle source
# File lib/email_api/email/data/client_response.rb, line 17 def set_bad_req @status = '400: BAD REQUEST' end
set_internal_err()
click to toggle source
# File lib/email_api/email/data/client_response.rb, line 21 def set_internal_err @status = '500: INTERNAL SERVER ERROR' end
set_ok()
click to toggle source
# File lib/email_api/email/data/client_response.rb, line 13 def set_ok @status = '200: OK' end
to_hash()
click to toggle source
# File lib/email_api/email/data/client_response.rb, line 30 def to_hash hash = {} instance_variables.each do |var| name = var.to_s.delete('@') value = instance_variable_get(var) val_hash = value.to_hash if value.respond_to?(:to_hash) hash[name] = val_hash.nil? ? value : val_hash end hash end