Class: SendGrid::Content

Inherits:
Object
  • Object
show all
Defined in:
lib/sendgrid/helpers/mail/content.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(type: nil, value: nil) ⇒ Content

Returns a new instance of Content.


7
8
9
10
# File 'lib/sendgrid/helpers/mail/content.rb', line 7

def initialize(type: nil, value: nil)
  @type = type
  @value = value
end

Instance Attribute Details

#typeObject

Returns the value of attribute type


5
6
7
# File 'lib/sendgrid/helpers/mail/content.rb', line 5

def type
  @type
end

#valueObject

Returns the value of attribute value


5
6
7
# File 'lib/sendgrid/helpers/mail/content.rb', line 5

def value
  @value
end

Instance Method Details

#to_jsonObject


12
13
14
15
16
17
# File 'lib/sendgrid/helpers/mail/content.rb', line 12

def to_json(*)
  {
    'type' => type,
    'value' => value
  }.delete_if { |_, value| value.to_s.strip == '' }
end