Class: Restforce::Bulk::Builder::ZipXml

Inherits:
Xml
  • Object
show all
Defined in:
lib/restforce/bulk/builder/zip_xml.rb

Instance Attribute Summary

Attributes inherited from Xml

#operation

Instance Method Summary collapse

Methods inherited from Xml

#abort, #close, #generate, #initialize, #job, #query

Constructor Details

This class inherits a constructor from Restforce::Bulk::Builder::Xml

Instance Method Details

#create_request_txt(data) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/restforce/bulk/builder/zip_xml.rb', line 10

def create_request_txt(data)
  build_xml(:sObjects, "xmlns:xsi" => "http://www.w3.org/2001/XMLSchema-instance") do |xml|
    data.each do |item|
      xml.sObject do
        xml.Name item[:filename]
        xml.ParentId item[:parent_id]
        xml.Body "##{item[:filename]}"
      end
    end
  end
end

#transform(data, operation, content_type) ⇒ Object



5
6
7
8
# File 'lib/restforce/bulk/builder/zip_xml.rb', line 5

def transform(data, operation, content_type)
  zipper = Restforce::Bulk::Zipper.new(data, content_type)
  File.read(zipper.zip)
end