Class: Postmark::Mitt::Attachment
- Inherits:
-
Object
- Object
- Postmark::Mitt::Attachment
- Defined in:
- lib/postmark/mitt.rb
Instance Attribute Summary collapse
-
#source ⇒ Object
Returns the value of attribute source.
Instance Method Summary collapse
- #content_type ⇒ Object
- #file_name ⇒ Object
-
#initialize(attachment_source) ⇒ Attachment
constructor
A new instance of Attachment.
- #read ⇒ Object
- #size ⇒ Object
Constructor Details
#initialize(attachment_source) ⇒ Attachment
Returns a new instance of Attachment.
111 112 113 |
# File 'lib/postmark/mitt.rb', line 111 def initialize() @source = end |
Instance Attribute Details
#source ⇒ Object
Returns the value of attribute source.
114 115 116 |
# File 'lib/postmark/mitt.rb', line 114 def source @source end |
Instance Method Details
#content_type ⇒ Object
116 117 118 |
# File 'lib/postmark/mitt.rb', line 116 def content_type source["ContentType"] end |
#file_name ⇒ Object
120 121 122 |
# File 'lib/postmark/mitt.rb', line 120 def file_name source["Name"] end |
#read ⇒ Object
124 125 126 127 128 |
# File 'lib/postmark/mitt.rb', line 124 def read tempfile = MittTempfile.new(file_name, content_type) tempfile.write(Base64.decode64(source["Content"])) tempfile end |
#size ⇒ Object
130 131 132 |
# File 'lib/postmark/mitt.rb', line 130 def size source["ContentLength"] end |