Sha256: 8ed8d1ca5d0b2b394a8ccf23839a20374d23fe9621d89b2ca92a5fb6bf9ea689

Contents?: true

Size: 454 Bytes

Versions: 9

Compression:

Stored size: 454 Bytes

Contents

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

    def custom_arg=(custom_arg)
      @custom_arg = custom_arg
    end

    def custom_arg
      @custom_arg
    end

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

Version data entries

9 entries across 9 versions & 1 rubygems

Version Path
sendgrid-ruby-6.3.4 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.3.3 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.3.2 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.3.1 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.2.1 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.2.0 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.1.4 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.1.3 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.1.2 lib/sendgrid/helpers/mail/custom_arg.rb