Class: App42::AppTab::DiscountResponseBuilder
Instance Method Summary
collapse
#buildObjectFromJSONTree, #getNames, #getServiceJSONObject, #getTotalRecords, #isResponseSuccess
Instance Method Details
#buildArrayObject(json) ⇒ Object
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
|
# File 'lib/appTab/DiscountResponseBuilder.rb', line 41
def buildArrayObject(json)
discountJSONObj = getServiceJSONObject("discounts", json);
discountList = Array.new
if discountJSONObj.fetch("discount").instance_of?(Array)
discountsJSONArray = discountJSONObj.fetch("discount");
discountsJSONArray.length.times do |i|
discountJSONObj1 = discountsJSONArray.fetch(i);
discountObj = App42::AppTab::Test.new()
discountObj = buildDiscountObject(discountJSONObj1);
discountObj.strResponse = json
discountObj.isResponseSuccess = isResponseSuccess(json)
discountList.push(discountObj);
end
else
jsonObjConfig = discountJSONObj.fetch("discount");
discountObj = App42::AppTab::Test.new()
discountObj = buildDiscountObject(jsonObjConfig);
discountObj.strResponse = json
discountObj.isResponseSuccess = isResponseSuccess(json)
discountList.push(discountObj);
end
return discountList;
end
|
#buildDiscountObject(discountJSONObj) ⇒ Object
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
|
# File 'lib/appTab/DiscountResponseBuilder.rb', line 19
def buildDiscountObject(discountJSONObj)
discount1 = App42::AppTab::Test.new()
buildObjectFromJSONTree(discount1, discountJSONObj);
if discountJSONObj.key?("discountDetails")
if discountJSONObj.fetch("discountDetails").instance_of?(Hash)
profileJSONObj = discountJSONObj.fetch("discountDetails");
discounDetails = App42::AppTab::Discount.new(discount1)
buildObjectFromJSONTree(discounDetails, profileJSONObj);
end
end
return discount1;
end
|
#buildResponse(json) ⇒ Object
9
10
11
12
13
14
15
16
17
|
# File 'lib/appTab/DiscountResponseBuilder.rb', line 9
def buildResponse(json)
discountsJSONObj = getServiceJSONObject("discounts", json);
discountJSONObj = discountsJSONObj.fetch("discount");
discountData = App42::AppTab::Test.new()
discountData = buildDiscountObject(discountJSONObj);
discountData.strResponse = json
discountData.isResponseSuccess = isResponseSuccess(json)
return discountData;
end
|