1231
1232
1233
1234
1235
1236
1237
1238
1239
1240
1241
1242
1243
1244
1245
1246
1247
1248
1249
1250
1251
1252
1253
1254
1255
1256
1257
1258
1259
1260
1261
1262
1263
1264
1265
1266
1267
1268
1269
1270
1271
1272
1273
1274
1275
1276
1277
1278
1279
1280
1281
1282
1283
1284
1285
1286
1287
1288
1289
1290
1291
1292
1293
1294
1295
1296
1297
1298
1299
1300
1301
1302
1303
1304
1305
1306
1307
1308
1309
1310
1311
1312
1313
1314
1315
1316
1317
1318
1319
1320
1321
1322
1323
1324
1325
1326
1327
1328
1329
1330
1331
1332
1333
1334
1335
1336
1337
1338
1339
1340
1341
1342
1343
1344
|
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1231
def to_hash(options = nil)
res = {}
options ||= {}
case_from_idl = options.nil? ? false : options[:case_from_idl]
ignore_nil_field = options.nil? ? false : options[:ignore_nil_field]
if case_from_idl
if !(ignore_nil_field && campaign_is_active.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:campaignIsActive) ? JSON_NAME_OVERRIDES[:campaignIsActive] : :campaignIsActive
res[_json_key_name] = campaign_is_active
end
if !(ignore_nil_field && campaign_name.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:campaignName) ? JSON_NAME_OVERRIDES[:campaignName] : :campaignName
res[_json_key_name] = campaign_name
end
if !(ignore_nil_field && campaign_terms_and_conditions_url.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:campaignTermsAndConditionsUrl) ? JSON_NAME_OVERRIDES[:campaignTermsAndConditionsUrl] : :campaignTermsAndConditionsUrl
res[_json_key_name] = campaign_terms_and_conditions_url
end
if !(ignore_nil_field && coupon_amount.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponAmount) ? JSON_NAME_OVERRIDES[:couponAmount] : :couponAmount
res[_json_key_name] = coupon_amount
end
if !(ignore_nil_field && coupon_max_savings.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponMaxSavings) ? JSON_NAME_OVERRIDES[:couponMaxSavings] : :couponMaxSavings
res[_json_key_name] = coupon_max_savings
end
if !(ignore_nil_field && coupon_min_cost.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponMinCost) ? JSON_NAME_OVERRIDES[:couponMinCost] : :couponMinCost
res[_json_key_name] = coupon_min_cost
end
if !(ignore_nil_field && coupon_percent.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponPercent) ? JSON_NAME_OVERRIDES[:couponPercent] : :couponPercent
res[_json_key_name] = coupon_percent
end
if !(ignore_nil_field && coupon_code_prefix.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponCodePrefix) ? JSON_NAME_OVERRIDES[:couponCodePrefix] : :couponCodePrefix
res[_json_key_name] = coupon_code_prefix
end
if !(ignore_nil_field && coupon_expires_after.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponExpiresAfter) ? JSON_NAME_OVERRIDES[:couponExpiresAfter] : :couponExpiresAfter
res[_json_key_name] = coupon_expires_after
end
if !(ignore_nil_field && coupon_max_start_date.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponMaxStartDate) ? JSON_NAME_OVERRIDES[:couponMaxStartDate] : :couponMaxStartDate
res[_json_key_name] = coupon_max_start_date
end
if !(ignore_nil_field && coupon_native_currency.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponNativeCurrency) ? JSON_NAME_OVERRIDES[:couponNativeCurrency] : :couponNativeCurrency
res[_json_key_name] = coupon_native_currency
end
if !(ignore_nil_field && coupon_series_label.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponSeriesLabel) ? JSON_NAME_OVERRIDES[:couponSeriesLabel] : :couponSeriesLabel
res[_json_key_name] = coupon_series_label
end
if !(ignore_nil_field && coupon_small_screen_claim_redis_key.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponSmallScreenClaimRedisKey) ? JSON_NAME_OVERRIDES[:couponSmallScreenClaimRedisKey] : :couponSmallScreenClaimRedisKey
res[_json_key_name] = coupon_small_screen_claim_redis_key
end
else if !(ignore_nil_field && campaign_is_active.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:campaignIsActive) ? JSON_NAME_OVERRIDES[:campaignIsActive] : :campaign_is_active
res[_json_key_name] = campaign_is_active
end
if !(ignore_nil_field && campaign_name.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:campaignName) ? JSON_NAME_OVERRIDES[:campaignName] : :campaign_name
res[_json_key_name] = campaign_name
end
if !(ignore_nil_field && campaign_terms_and_conditions_url.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:campaignTermsAndConditionsUrl) ? JSON_NAME_OVERRIDES[:campaignTermsAndConditionsUrl] : :campaign_terms_and_conditions_url
res[_json_key_name] = campaign_terms_and_conditions_url
end
if !(ignore_nil_field && coupon_amount.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponAmount) ? JSON_NAME_OVERRIDES[:couponAmount] : :coupon_amount
res[_json_key_name] = coupon_amount
end
if !(ignore_nil_field && coupon_max_savings.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponMaxSavings) ? JSON_NAME_OVERRIDES[:couponMaxSavings] : :coupon_max_savings
res[_json_key_name] = coupon_max_savings
end
if !(ignore_nil_field && coupon_min_cost.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponMinCost) ? JSON_NAME_OVERRIDES[:couponMinCost] : :coupon_min_cost
res[_json_key_name] = coupon_min_cost
end
if !(ignore_nil_field && coupon_percent.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponPercent) ? JSON_NAME_OVERRIDES[:couponPercent] : :coupon_percent
res[_json_key_name] = coupon_percent
end
if !(ignore_nil_field && coupon_code_prefix.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponCodePrefix) ? JSON_NAME_OVERRIDES[:couponCodePrefix] : :coupon_code_prefix
res[_json_key_name] = coupon_code_prefix
end
if !(ignore_nil_field && coupon_expires_after.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponExpiresAfter) ? JSON_NAME_OVERRIDES[:couponExpiresAfter] : :coupon_expires_after
res[_json_key_name] = coupon_expires_after
end
if !(ignore_nil_field && coupon_max_start_date.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponMaxStartDate) ? JSON_NAME_OVERRIDES[:couponMaxStartDate] : :coupon_max_start_date
res[_json_key_name] = coupon_max_start_date
end
if !(ignore_nil_field && coupon_native_currency.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponNativeCurrency) ? JSON_NAME_OVERRIDES[:couponNativeCurrency] : :coupon_native_currency
res[_json_key_name] = coupon_native_currency
end
if !(ignore_nil_field && coupon_series_label.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponSeriesLabel) ? JSON_NAME_OVERRIDES[:couponSeriesLabel] : :coupon_series_label
res[_json_key_name] = coupon_series_label
end
if !(ignore_nil_field && coupon_small_screen_claim_redis_key.nil?)
_json_key_name = JSON_NAME_OVERRIDES.key?(:couponSmallScreenClaimRedisKey) ? JSON_NAME_OVERRIDES[:couponSmallScreenClaimRedisKey] : :coupon_small_screen_claim_redis_key
res[_json_key_name] = coupon_small_screen_claim_redis_key
end
end
res
end
|