Class: App42::AppTab::LicenseResponseBuilder
- Inherits:
-
App42ResponseBuilder
- Object
- App42ResponseBuilder
- App42::AppTab::LicenseResponseBuilder
- Defined in:
- lib/appTab/LicenseResponseBuilder.rb
Overview
LicenseResponseBuilder class converts the JSON response retrieved from the server to the value object i.e License
Instance Method Summary collapse
-
#buildArrayResponse(json) ⇒ Object
Converts the response in JSON format to the list of value objects i.e License.
-
#buildLicenseObject(licenceJSONObj) ⇒ Object
Converts the License JSON object to the value object i.e License.
-
#buildResponse(json) ⇒ Object
Converts the response in JSON format to the value object i.e License.
Methods inherited from App42ResponseBuilder
#buildObjectFromJSONTree, #getNames, #getServiceJSONObject, #getTotalRecords, #isResponseSuccess
Instance Method Details
#buildArrayResponse(json) ⇒ Object
Converts the response in JSON format to the list of value objects i.e License
58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 |
# 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) ⇒ Object
Converts the License JSON object to the value object i.e License
42 43 44 45 46 |
# File 'lib/appTab/LicenseResponseBuilder.rb', line 42 def buildLicenseObject(licenceJSONObj) license = License.new buildObjectFromJSONTree(license, licenceJSONObj); return license end |
#buildResponse(json) ⇒ Object
Converts the response in JSON format to the value object i.e License
24 25 26 27 28 29 30 31 |
# 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 |