Class: SendGrid::CustomArg
- Inherits:
-
Object
- Object
- SendGrid::CustomArg
- Defined in:
- lib/sendgrid/helpers/mail/custom_arg.rb
Instance Method Summary collapse
- #custom_arg ⇒ Object
- #custom_arg=(custom_arg) ⇒ Object
-
#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.
5 6 7 8 |
# File 'lib/sendgrid/helpers/mail/custom_arg.rb', line 5 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 Method Details
#custom_arg ⇒ Object
14 15 16 |
# File 'lib/sendgrid/helpers/mail/custom_arg.rb', line 14 def custom_arg @custom_arg end |
#custom_arg=(custom_arg) ⇒ Object
10 11 12 |
# File 'lib/sendgrid/helpers/mail/custom_arg.rb', line 10 def custom_arg=(custom_arg) @custom_arg = custom_arg end |
#to_json ⇒ Object
18 19 20 21 22 |
# File 'lib/sendgrid/helpers/mail/custom_arg.rb', line 18 def to_json(*) { 'custom_arg' => self.custom_arg }.delete_if { |_, value| value.to_s.strip == '' } end |