Class: SendGrid::Section
- Inherits:
-
Object
- Object
- SendGrid::Section
- Defined in:
- lib/sendgrid/helpers/mail/mail.rb
Instance Method Summary collapse
-
#initialize(key: nil, value: nil) ⇒ Section
constructor
A new instance of Section.
- #section ⇒ Object
- #section=(section) ⇒ Object
- #to_json ⇒ Object
Constructor Details
#initialize(key: nil, value: nil) ⇒ Section
Returns a new instance of Section.
498 499 500 501 |
# File 'lib/sendgrid/helpers/mail/mail.rb', line 498 def initialize(key: nil, value: nil) @section = {} (key.nil? || value.nil?) ? @section = nil : @section[key] = value end |
Instance Method Details
#section ⇒ Object
507 508 509 |
# File 'lib/sendgrid/helpers/mail/mail.rb', line 507 def section @section end |
#section=(section) ⇒ Object
503 504 505 |
# File 'lib/sendgrid/helpers/mail/mail.rb', line 503 def section=(section) @section = section end |
#to_json ⇒ Object
511 512 513 514 515 |
# File 'lib/sendgrid/helpers/mail/mail.rb', line 511 def to_json(*) { 'section' => self.section }.delete_if { |_, value| value.to_s.strip == '' } end |