Module: Airbnb::Service::Hongbao::Api::CampaignDataSmartclientModule::GenerateClassMethods

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#non_null_checking_offObject

Returns the value of attribute non_null_checking_off.



1149
1150
1151
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1149

def non_null_checking_off
  @non_null_checking_off
end

#type_checking_offObject

Class level accessors to turn on/off specific checking



1148
1149
1150
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1148

def type_checking_off
  @type_checking_off
end

Instance Method Details

#build(params = {}) ⇒ Object

Raises:

  • (TypeError)


1151
1152
1153
1154
1155
1156
1157
1158
1159
1160
1161
1162
1163
1164
1165
1166
1167
1168
1169
1170
1171
1172
1173
1174
1175
1176
1177
1178
1179
1180
1181
1182
1183
1184
1185
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1151

def build(params = {})
  _internal_object = ::Airbnb::Service::Hongbao::Api::CampaignData.send(:new)
  return _internal_object if params.nil?
  raise TypeError.new("Expect a Hash for params in initialize, while it is #{params.class}") unless params.is_a?(Hash)
  return _internal_object if params.empty?

  campaign_is_active = get_field_data(params, :campaign_is_active, :campaignIsActive, _internal_object.campaignIsActive)
  _internal_object.campaignIsActive = campaign_is_active
  campaign_name = get_field_data(params, :campaign_name, :campaignName, _internal_object.campaignName)
  _internal_object.campaignName = campaign_name
  campaign_terms_and_conditions_url = get_field_data(params, :campaign_terms_and_conditions_url, :campaignTermsAndConditionsUrl, _internal_object.campaignTermsAndConditionsUrl)
  _internal_object.campaignTermsAndConditionsUrl = campaign_terms_and_conditions_url
  coupon_amount = get_field_data(params, :coupon_amount, :couponAmount, _internal_object.couponAmount)
  _internal_object.couponAmount = coupon_amount
  coupon_max_savings = get_field_data(params, :coupon_max_savings, :couponMaxSavings, _internal_object.couponMaxSavings)
  _internal_object.couponMaxSavings = coupon_max_savings
  coupon_min_cost = get_field_data(params, :coupon_min_cost, :couponMinCost, _internal_object.couponMinCost)
  _internal_object.couponMinCost = coupon_min_cost
  coupon_percent = get_field_data(params, :coupon_percent, :couponPercent, _internal_object.couponPercent)
  _internal_object.couponPercent = coupon_percent
  coupon_code_prefix = get_field_data(params, :coupon_code_prefix, :couponCodePrefix, _internal_object.couponCodePrefix)
  _internal_object.couponCodePrefix = coupon_code_prefix
  coupon_expires_after = get_field_data(params, :coupon_expires_after, :couponExpiresAfter, _internal_object.couponExpiresAfter)
  _internal_object.couponExpiresAfter = coupon_expires_after
  coupon_max_start_date = get_field_data(params, :coupon_max_start_date, :couponMaxStartDate, _internal_object.couponMaxStartDate)
  _internal_object.couponMaxStartDate = coupon_max_start_date
  coupon_native_currency = get_field_data(params, :coupon_native_currency, :couponNativeCurrency, _internal_object.couponNativeCurrency)
  _internal_object.couponNativeCurrency = coupon_native_currency
  coupon_series_label = get_field_data(params, :coupon_series_label, :couponSeriesLabel, _internal_object.couponSeriesLabel)
  _internal_object.couponSeriesLabel = coupon_series_label
  coupon_small_screen_claim_redis_key = get_field_data(params, :coupon_small_screen_claim_redis_key, :couponSmallScreenClaimRedisKey, _internal_object.couponSmallScreenClaimRedisKey)
  _internal_object.couponSmallScreenClaimRedisKey = coupon_small_screen_claim_redis_key
  _internal_object.validate(Sparsam::STRICT) unless ::Airbnb::Service::Hongbao::Api::CampaignData.type_checking_off
  return _internal_object
end