class EmailObject
Contains all parameters that defines an email
Attributes
bcc[RW]
cc[RW]
content[RW]
from[RW]
subject[RW]
to[RW]
Public Class Methods
new(*params)
click to toggle source
# File lib/email_api/email/data/email_object.rb, line 10 def initialize(*params) @from = params[0] @to = params[1] @cc = params[2] @bcc = params[3] @subject = params[4] @content = params[5] end
Public Instance Methods
==(other)
click to toggle source
# File lib/email_api/email/data/email_object.rb, line 19 def ==(other) return false unless other.respond_to?(:to_hash) to_hash == other.to_hash end
to_hash()
click to toggle source
# File lib/email_api/email/data/email_object.rb, line 24 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) # Array doesn't implicitly convert to hash automatically if val_hash.nil? && value.is_a?(Array) val_hash = [] value.each do |val| val_hash.push val.to_hash if val.respond_to?(:to_hash) end end hash[name] = val_hash.nil? ? value : val_hash end hash end