Module: Airbnb::Service::Hongbao::Api::HasChinaCouponRequestSmartclientModule::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.



421
422
423
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 421

def non_null_checking_off
  @non_null_checking_off
end

#type_checking_offObject

Class level accessors to turn on/off specific checking



420
421
422
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 420

def type_checking_off
  @type_checking_off
end

Instance Method Details

#build(params = {}) ⇒ Object

Raises:

  • (TypeError)


423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 423

def build(params = {})
  _internal_object = ::Airbnb::Service::Hongbao::Api::HasChinaCouponRequest.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?

  user_id = get_field_data(params, :user_id, :userId, _internal_object.userId)
  _internal_object.userId = user_id
  non_null_validator(:user_id, user_id) unless ::Airbnb::Service::Hongbao::Api::HasChinaCouponRequest.non_null_checking_off
  campaign_name = get_field_data(params, :campaign_name, :campaignName, _internal_object.campaignName)
  _internal_object.campaignName = campaign_name
  non_null_validator(:campaign_name, campaign_name) unless ::Airbnb::Service::Hongbao::Api::HasChinaCouponRequest.non_null_checking_off
  _internal_object.validate(Sparsam::STRICT) unless ::Airbnb::Service::Hongbao::Api::HasChinaCouponRequest.type_checking_off
  return _internal_object
end