Class: SendGrid::Email

Inherits:
Object
  • Object
show all
Defined in:
lib/sendgrid/helpers/mail/mail.rb

Instance Method Summary collapse

Constructor Details

#initialize(email: nil, name: nil) ⇒ Email

Returns a new instance of Email.


771
772
773
774
# File 'lib/sendgrid/helpers/mail/mail.rb', line 771

def initialize(email: nil, name: nil)
  @email = email
  @name = name
end

Instance Method Details

#emailObject


780
781
782
# File 'lib/sendgrid/helpers/mail/mail.rb', line 780

def email
  @email
end

#email=(email) ⇒ Object


776
777
778
# File 'lib/sendgrid/helpers/mail/mail.rb', line 776

def email=(email)
  @email = email
end

#nameObject


788
789
790
# File 'lib/sendgrid/helpers/mail/mail.rb', line 788

def name
  @name
end

#name=(name) ⇒ Object


784
785
786
# File 'lib/sendgrid/helpers/mail/mail.rb', line 784

def name=(name)
  @name = name
end

#to_jsonObject


792
793
794
795
796
797
# File 'lib/sendgrid/helpers/mail/mail.rb', line 792

def to_json(*)
  {
    'email' => self.email,
    'name' => self.name
  }.delete_if { |_, value| value.to_s.strip == '' }
end