Class: SendGrid::Substitution
- Inherits:
-
Object
- Object
- SendGrid::Substitution
- Defined in:
- lib/sendgrid/helpers/mail/substitution.rb
Instance Attribute Summary collapse
-
#substitution ⇒ Object
Returns the value of attribute substitution.
Instance Method Summary collapse
-
#initialize(key: nil, value: nil) ⇒ Substitution
constructor
A new instance of Substitution.
- #to_json ⇒ Object
Constructor Details
#initialize(key: nil, value: nil) ⇒ Substitution
Returns a new instance of Substitution.
7 8 9 10 |
# File 'lib/sendgrid/helpers/mail/substitution.rb', line 7 def initialize(key: nil, value: nil) @substitution = {} key.nil? || value.nil? ? @substitution = nil : @substitution[key] = value end |
Instance Attribute Details
#substitution ⇒ Object
Returns the value of attribute substitution.
5 6 7 |
# File 'lib/sendgrid/helpers/mail/substitution.rb', line 5 def substitution @substitution end |
Instance Method Details
#to_json ⇒ Object
12 13 14 15 16 |
# File 'lib/sendgrid/helpers/mail/substitution.rb', line 12 def to_json(*) { 'substitution' => substitution }.delete_if { |_, value| value.to_s.strip == '' } end |