Sha256: aced7a8371ba2a95e0b141ef3ea060796e8c978447eab40e303c22a175cdfb64

Contents?: true

Size: 470 Bytes

Versions: 8

Compression:

Stored size: 470 Bytes

Contents

require 'json'

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

8 entries across 8 versions & 1 rubygems

Version Path
sendgrid-ruby-6.1.1 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.1.0 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.0.4 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.0.3 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.0.2 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.0.1 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-6.0.0 lib/sendgrid/helpers/mail/custom_arg.rb
sendgrid-ruby-5.3.0 lib/sendgrid/helpers/mail/custom_arg.rb