5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/wolf_core/application/barton/onboarding/file_operations.rb', line 5
def build_file_payload(
salesforce_max_file_size:, encoded_file:, url:,
parent_id:, file_id:, filename:
)
limit = salesforce_max_file_size.to_i
file_payload = {
parentId: parent_id,
appFileId: file_id,
fileTitle: filename,
versionData: encoded_file,
extension: filename.split('.').second
}
size = file_payload.to_json.size
exceed_limit = size >= limits
if exceed_limit
file_payload[:limit] = limit
file_payload[:payloadSize] = size
file_payload[:url] = url
file_payload.delete(:versionData)
end
file_payload
end
|