Module: Airbnb::Service::Hongbao::Api::CampaignDataSmartclientModule::GenerateInstanceMethods

Defined in:
lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb

Constant Summary collapse

JSON_NAME_OVERRIDES =
{
}.freeze

Instance Method Summary collapse

Instance Method Details

#campaign_is_activeObject



1210
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1210

def campaign_is_active; @campaignIsActive; end

#campaign_nameObject



1211
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1211

def campaign_name; @campaignName; end

#campaign_terms_and_conditions_urlObject



1212
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1212

def campaign_terms_and_conditions_url; @campaignTermsAndConditionsUrl; end

#coupon_amountObject



1213
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1213

def coupon_amount; @couponAmount; end

#coupon_code_prefixObject



1217
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1217

def coupon_code_prefix; @couponCodePrefix; end

#coupon_expires_afterObject



1218
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1218

def coupon_expires_after; @couponExpiresAfter; end

#coupon_max_savingsObject



1214
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1214

def coupon_max_savings; @couponMaxSavings; end

#coupon_max_start_dateObject



1219
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1219

def coupon_max_start_date; @couponMaxStartDate; end

#coupon_min_costObject



1215
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1215

def coupon_min_cost; @couponMinCost; end

#coupon_native_currencyObject



1220
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1220

def coupon_native_currency; @couponNativeCurrency; end

#coupon_percentObject



1216
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1216

def coupon_percent; @couponPercent; end

#coupon_series_labelObject



1221
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1221

def coupon_series_label; @couponSeriesLabel; end

#coupon_small_screen_claim_redis_keyObject



1222
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1222

def coupon_small_screen_claim_redis_key; @couponSmallScreenClaimRedisKey; end

#to_hash(options = nil) ⇒ Object Also known as: to_h

options:

case_from_idl: use the exact case from IDL file to when generating the hash key. Default is false.
ignore_nil_field: do not generate key in the hash, if the value is nil. Useful for inspect or data transport. Default is false.


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 # enforcing to use snake case
    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

#to_json(options = nil) ⇒ Object



1224
1225
1226
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1224

def to_json(options = nil)
  JSON.generate(to_hash(options))
end