Class: SendGrid::Attachment

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

Instance Method Summary collapse

Constructor Details

#initializeAttachment

Returns a new instance of Attachment.



5
6
7
8
9
10
11
# File 'lib/sendgrid/helpers/mail/attachment.rb', line 5

def initialize
  @content = nil
  @type = nil
  @filename = nil
  @disposition = nil
  @content_id = nil
end

Instance Method Details

#contentObject



17
18
19
# File 'lib/sendgrid/helpers/mail/attachment.rb', line 17

def content
  @content
end

#content=(content) ⇒ Object



13
14
15
# File 'lib/sendgrid/helpers/mail/attachment.rb', line 13

def content=(content)
  @content = content
end

#content_idObject



49
50
51
# File 'lib/sendgrid/helpers/mail/attachment.rb', line 49

def content_id
  @content_id
end

#content_id=(content_id) ⇒ Object



45
46
47
# File 'lib/sendgrid/helpers/mail/attachment.rb', line 45

def content_id=(content_id)
  @content_id = content_id
end

#dispositionObject



41
42
43
# File 'lib/sendgrid/helpers/mail/attachment.rb', line 41

def disposition
  @disposition
end

#disposition=(disposition) ⇒ Object



37
38
39
# File 'lib/sendgrid/helpers/mail/attachment.rb', line 37

def disposition=(disposition)
  @disposition = disposition
end

#filenameObject



33
34
35
# File 'lib/sendgrid/helpers/mail/attachment.rb', line 33

def filename
  @filename
end

#filename=(filename) ⇒ Object



29
30
31
# File 'lib/sendgrid/helpers/mail/attachment.rb', line 29

def filename=(filename)
  @filename = filename
end

#to_jsonObject



53
54
55
56
57
58
59
60
61
# File 'lib/sendgrid/helpers/mail/attachment.rb', line 53

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

#typeObject



25
26
27
# File 'lib/sendgrid/helpers/mail/attachment.rb', line 25

def type
  @type
end

#type=(type) ⇒ Object



21
22
23
# File 'lib/sendgrid/helpers/mail/attachment.rb', line 21

def type=(type)
  @type = type
end