Class: SendGrid::Content

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

Instance Method Summary collapse

Constructor Details

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



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

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

Instance Method Details

#to_jsonObject



26
27
28
29
30
31
# File 'lib/sendgrid/helpers/mail/content.rb', line 26

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

#typeObject



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

def type
  @type
end

#type=(type) ⇒ Object



10
11
12
# File 'lib/sendgrid/helpers/mail/content.rb', line 10

def type=(type)
  @type = type
end

#valueObject



22
23
24
# File 'lib/sendgrid/helpers/mail/content.rb', line 22

def value
  @value
end

#value=(value) ⇒ Object



18
19
20
# File 'lib/sendgrid/helpers/mail/content.rb', line 18

def value=(value)
  @value = value
end