Class: SendGrid::CustomArg
- Inherits:
-
Object
- Object
- SendGrid::CustomArg
- Defined in:
- lib/sendgrid/helpers/mail/custom_arg.rb
Instance Attribute Summary collapse
-
#custom_arg ⇒ Object
Returns the value of attribute custom_arg.
Instance Method Summary collapse
-
#initialize(key: nil, value: nil) ⇒ CustomArg
constructor
A new instance of CustomArg.
- #to_json ⇒ Object
Constructor Details
#initialize(key: nil, value: nil) ⇒ CustomArg
Returns a new instance of CustomArg.
7 8 9 10 |
# 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 |
Instance Attribute Details
#custom_arg ⇒ Object
Returns the value of attribute custom_arg.
5 6 7 |
# File 'lib/sendgrid/helpers/mail/custom_arg.rb', line 5 def custom_arg @custom_arg end |
Instance Method Details
#to_json ⇒ Object
12 13 14 15 16 |
# 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 |