File tree Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Expand file tree Collapse file tree 2 files changed +16
-9
lines changed Original file line number Diff line number Diff line change @@ -173,8 +173,8 @@ git checkout spec/models/unauthorized_client_error_spec.rb
173173cd ./lib/cybersource_rest_client/models
174174echo " starting of replacing the hash keyword in models"
175175for file in ./* .rb; do \
176- sed -i ' s/attr_accessor :hash_value /attr_accessor :hash \n \t alias :hash_value :hash \n \t alias :hash_value :hash/g' " $file "
177- sed -i " s/:'hash_value ' => :'hashValue '/:'hash_value ' => :'hash'/g" " $file "
178- sed -i " s/:'hash_value ' => :'hash_value '/:'hash_value ' => :'hash'/g" " $file "
176+ sed -i ' s/attr_accessor :sdk_hash_value /attr_accessor :hash \n \t alias :sdk_hash_value :hash/g' " $file "
177+ sed -i " s/:'sdk_hash_value ' => :'sdkHashValue '/:'sdk_hash_value ' => :'hash'/g" " $file "
178+ sed -i " s/:'sdk_hash_value ' => :'sdk_hash_value '/:'sdk_hash_value ' => :'hash'/g" " $file "
179179done
180180echo " completed the task of replacing the hash keyword in models"
Original file line number Diff line number Diff line change 77
88apis = spec_json ["paths" ].keys ()
99
10- fieldName = "hash"
11- replacedFieldName = "hashValue"
10+ # fieldNames in request and response body structure and change with the value of it.
11+ # eg: fieldNames ={
12+ # "fieldName" : "changed sdk field name to be used",
13+ # "fieldName1" :"changed field name to be used in sdk"
14+ # }
15+
16+ fieldNames = {
17+ "hash" : "sdkHashValue"
18+ }
1219
1320def replaceFieldNamefromJSONObject (jsonObject ):
1421 fields = jsonObject .keys ()
@@ -21,8 +28,8 @@ def replaceFieldNamefromJSONObject(jsonObject):
2128
2229 result_json = {}
2330 for field in fields :
24- if field == fieldName :
25- result_json [replacedFieldName ]= jsonObject [field ]
31+ if field in fieldNames . keys () :
32+ result_json [fieldNames [ field ] ]= jsonObject [field ]
2633 else :
2734 result_json [field ]= jsonObject [field ]
2835 return result_json
@@ -39,8 +46,8 @@ def replaceFieldNamefromJSONObjectForResponse(jsonObject):
3946
4047 result_json = {}
4148 for field in fields :
42- if field == fieldName :
43- result_json [replacedFieldName ]= jsonObject [field ]
49+ if field in fieldNames . keys () :
50+ result_json [fieldNames [ field ] ]= jsonObject [field ]
4451 else :
4552 result_json [field ]= jsonObject [field ]
4653 return result_json
You can’t perform that action at this time.
0 commit comments