class App42::AppTab::LicenseResponseBuilder
LicenseResponseBuilder
class converts the JSON response retrieved from the server to the value object i.e License
Public Instance Methods
buildArrayResponse(json)
click to toggle source
Converts the response in JSON format to the list of value objects i.e License
@param json
- response in JSON format
@return List of License
object filled with json data
# File lib/appTab/LicenseResponseBuilder.rb, line 58 def buildArrayResponse(json) appTabJSONObj = getServiceJSONObject("appTab", json); license = License.new() licenseList = Array.new if appTabJSONObj.fetch("licenses").fetch("license").instance_of?(Array) licenseJSONArray = appTabJSONObj.fetch("licenses").fetch("license") licenseJSONArray.length.times do |i| licenseJSONObject = licenseJSONArray[i] license = buildLicenseObject(licenseJSONObject); license.strResponse=json license.isResponseSuccess = isResponseSuccess(json) licenseList.push(license) end else licenseJSONObject = appTabJSONObj["licenses"]["license"] license = buildLicenseObject(licenseJSONObject); license.strResponse=json license.isResponseSuccess = isResponseSuccess(json) licenseList.push(license) end return licenseList end
buildLicenseObject(licenceJSONObj)
click to toggle source
Converts the License
JSON object to the value object i.e License
@param licenceJSONObj
- License data as JSONObject
@return License
object filled with json data
# File lib/appTab/LicenseResponseBuilder.rb, line 42 def buildLicenseObject(licenceJSONObj) license = License.new buildObjectFromJSONTree(license, licenceJSONObj); return license end
buildResponse(json)
click to toggle source
Converts the response in JSON format to the value object i.e License
@param json
- response in JSON format
@return License
object filled with json data
@throws Exception
# File lib/appTab/LicenseResponseBuilder.rb, line 24 def buildResponse(json) appTabJSONObj = getServiceJSONObject("appTab", json); licenceJSONObj = appTabJSONObj.fetch("licenses").fetch("license"); license = buildLicenseObject(licenceJSONObj); license.strResponse=json license.isResponseSuccess = isResponseSuccess(json) return license end