Class: SendGrid::Personalization

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

Instance Method Summary collapse

Instance Method Details

#bcc=(bcc) ⇒ Object



701
702
703
704
# File 'lib/sendgrid/helpers/mail/mail.rb', line 701

def bcc=(bcc)
  @bccs = @bccs.nil? ? [] : @bccs
  @bccs = @bccs.push(bcc.to_json)
end

#bccsObject



706
707
708
# File 'lib/sendgrid/helpers/mail/mail.rb', line 706

def bccs
  @bccs
end

#cc=(cc) ⇒ Object



692
693
694
695
# File 'lib/sendgrid/helpers/mail/mail.rb', line 692

def cc=(cc)
  @ccs = @ccs.nil? ? [] : @ccs
  @ccs = @ccs.push(cc.to_json)
end

#ccsObject



697
698
699
# File 'lib/sendgrid/helpers/mail/mail.rb', line 697

def ccs
  @ccs
end

#custom_argsObject



744
745
746
# File 'lib/sendgrid/helpers/mail/mail.rb', line 744

def custom_args
  @custom_args
end

#custom_args=(custom_args) ⇒ Object



738
739
740
741
742
# File 'lib/sendgrid/helpers/mail/mail.rb', line 738

def custom_args=(custom_args)
  @custom_args = @custom_args.nil? ? {} : @custom_args
  custom_args = custom_args.to_json
  @custom_args = @custom_args.merge(custom_args['custom_arg'])
end

#headersObject



724
725
726
# File 'lib/sendgrid/helpers/mail/mail.rb', line 724

def headers
  @headers
end

#headers=(headers) ⇒ Object



718
719
720
721
722
# File 'lib/sendgrid/helpers/mail/mail.rb', line 718

def headers=(headers)
  @headers = @headers.nil? ? {} : @headers
  headers = headers.to_json
  @headers = @headers.merge(headers['header'])
end

#initilizeObject



672
673
674
675
676
677
678
679
680
681
# File 'lib/sendgrid/helpers/mail/mail.rb', line 672

def initilize
  @tos = nil
  @ccs = nil
  @bccs = nil
  @subject = nil
  @headers = nil
  @substitutions = nil
  @custom_args = nil
  @send_at = nil
end

#send_atObject



752
753
754
# File 'lib/sendgrid/helpers/mail/mail.rb', line 752

def send_at
  @send_at
end

#send_at=(send_at) ⇒ Object



748
749
750
# File 'lib/sendgrid/helpers/mail/mail.rb', line 748

def send_at=(send_at)
  @send_at = send_at
end

#subjectObject



714
715
716
# File 'lib/sendgrid/helpers/mail/mail.rb', line 714

def subject
  @subject
end

#subject=(subject) ⇒ Object



710
711
712
# File 'lib/sendgrid/helpers/mail/mail.rb', line 710

def subject=(subject)
  @subject = subject
end

#substitutionsObject



734
735
736
# File 'lib/sendgrid/helpers/mail/mail.rb', line 734

def substitutions
  @substitutions
end

#substitutions=(substitutions) ⇒ Object



728
729
730
731
732
# File 'lib/sendgrid/helpers/mail/mail.rb', line 728

def substitutions=(substitutions)
  @substitutions = @substitutions.nil? ? {} : @substitutions
  substitutions = substitutions.to_json
  @substitutions = @substitutions.merge(substitutions['substitution'])
end

#to=(to) ⇒ Object



683
684
685
686
# File 'lib/sendgrid/helpers/mail/mail.rb', line 683

def to=(to)
  @tos = @tos.nil? ? [] : @tos
  @tos = @tos.push(to.to_json)
end

#to_jsonObject



756
757
758
759
760
761
762
763
764
765
766
767
# File 'lib/sendgrid/helpers/mail/mail.rb', line 756

def to_json(*)
  {
    'to' => self.tos,
    'cc' => self.ccs,
    'bcc' => self.bccs,
    'subject' => self.subject,
    'headers' => self.headers,
    'substitutions' => self.substitutions,
    'custom_args' => self.custom_args,
    'send_at' => self.send_at
  }.delete_if { |_, value| value.to_s.strip == '' }
end

#tosObject



688
689
690
# File 'lib/sendgrid/helpers/mail/mail.rb', line 688

def tos
  @tos
end