class SendGrid::CustomArg

Attributes

custom_arg[RW]

Public Class Methods

new(key: nil, value: nil) click to toggle source
# File lib/sendgrid/helpers/mail/custom_arg.rb, line 7
def initialize(key: nil, value: nil)
  @custom_arg = {}
  key.nil? || value.nil? ? @custom_arg = nil : @custom_arg[key.to_s] = value.to_s
end

Public Instance Methods

to_json(*) click to toggle source
# File lib/sendgrid/helpers/mail/custom_arg.rb, line 12
def to_json(*)
  {
    'custom_arg' => custom_arg
  }.delete_if { |_, value| value.to_s.strip == '' }
end