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