Class: Taps::Multipart::Container

Inherits:
Object
  • Object
show all
Defined in:
lib/taps/multipart.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeContainer

Returns a new instance of Container.



11
12
13
# File 'lib/taps/multipart.rb', line 11

def initialize
  @attachments = []
end

Instance Attribute Details

#attachmentsObject

Returns the value of attribute attachments.



9
10
11
# File 'lib/taps/multipart.rb', line 9

def attachments
  @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)
  attachments << mp
end

#generateObject



20
21
22
23
24
25
26
27
# File 'lib/taps/multipart.rb', line 20

def generate
  hash = {}
  attachments.each do |mp|
    hash[mp.name] = mp
  end
  m = RestClient::Payload::Multipart.new(hash)
  [m.to_s, m.headers['Content-Type']]
end