Class: Taps::Multipart::Container
- Inherits:
-
Object
- Object
- Taps::Multipart::Container
- Defined in:
- lib/taps/multipart.rb
Instance Attribute Summary collapse
-
#attachments ⇒ Object
Returns the value of attribute attachments.
Instance Method Summary collapse
- #attach(opts) ⇒ Object
- #generate ⇒ Object
-
#initialize ⇒ Container
constructor
A new instance of Container.
Constructor Details
#initialize ⇒ Container
Returns a new instance of Container.
11 12 13 |
# File 'lib/taps/multipart.rb', line 11 def initialize @attachments = [] end |
Instance Attribute Details
#attachments ⇒ Object
Returns the value of attribute attachments.
9 10 11 |
# File 'lib/taps/multipart.rb', line 9 def @attachments end |
Instance Method Details
#attach(opts) ⇒ Object
15 16 17 18 |
# File 'lib/taps/multipart.rb', line 15 def attach(opts) mp = Taps::Multipart.new(opts) << mp end |
#generate ⇒ Object
20 21 22 23 24 25 26 27 |
# File 'lib/taps/multipart.rb', line 20 def generate hash = {} .each do |mp| hash[mp.name] = mp end m = RestClient::Payload::Multipart.new(hash) [m.to_s, m.headers['Content-Type']] end |