Class: SendGrid::CustomArg

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

Instance Method Summary collapse

Constructor Details

#initialize(key: nil, value: nil) ⇒ CustomArg

Returns a new instance of CustomArg.


621
622
623
624
# File 'lib/sendgrid/helpers/mail/mail.rb', line 621

def initialize(key: nil, value: nil)
  @custom_arg = {}
  (key.nil? || value.nil?) ? @custom_arg = nil : @custom_arg[key] = value
end

Instance Method Details

#custom_argObject


630
631
632
# File 'lib/sendgrid/helpers/mail/mail.rb', line 630

def custom_arg
  @custom_arg
end

#custom_arg=(custom_arg) ⇒ Object


626
627
628
# File 'lib/sendgrid/helpers/mail/mail.rb', line 626

def custom_arg=(custom_arg)
  @custom_arg = custom_arg
end

#to_jsonObject


634
635
636
637
638
# File 'lib/sendgrid/helpers/mail/mail.rb', line 634

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