Sha256: 0858b0661b495877cce226ea4ebde5ddfc3e8443014d08b99433eebc803d50c2
Contents?: true
Size: 1.67 KB
Versions: 1
Compression:
Stored size: 1.67 KB
Contents
# ----------------------------------------------------------------------- # Copyright © 2012 ShepHertz Technologies Pvt Ltd. All rights reserved. # ----------------------------------------------------------------------- require 'json/pure' require 'App42ResponseBuilder.rb' require 'upload/Upload.rb' module App42 module Upload # # # UploadResponseBuilder class converts the JSON response retrieved from the # server to the value object i.e User # # class UploadResponseBuilder < App42ResponseBuilder # # Converts the response in JSON format to the value object i.e Upload # # @param json # - response in JSON format # # @return Upload object filled with json data # # def buildResponse(json) puts "testing #{json}" uploadObj = Upload.new() fileList = Array.new uploadObj.fileList=fileList uploadObj.strResponse=json uploadObj.isResponseSuccess = isResponseSuccess(json) jsonObjUpload = getServiceJSONObject("upload", json) jsonObjFiles = jsonObjUpload.fetch("files"); if jsonObjFiles.fetch("file").instance_of?(Hash) jsonObjFile = jsonObjFiles.fetch("file") fileObj = App42::Upload::File.new(uploadObj) buildObjectFromJSONTree(fileObj, jsonObjFile); else jsonObjFileArray = jsonObjFiles["file"] jsonObjFileArray.length.times do |i| fileObj = App42::Upload::File.new(uploadObj) jsonObjFile = jsonObjFileArray[i] buildObjectFromJSONTree(fileObj, jsonObjFile); end end return uploadObj end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
App42_RUBY_SDK-0.8.3 | lib/upload/UploadResponseBuilder.rb |