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



227
228
229
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 227

def non_null_checking_off
  @non_null_checking_off
end

#type_checking_offObject

Class level accessors to turn on/off specific checking



226
227
228
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 226

def type_checking_off
  @type_checking_off
end

Instance Method Details

#build(params = {}) ⇒ Object

Raises:

  • (TypeError)


229
230
231
232
233
234
235
236
237
238
239
240
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 229

def build(params = {})
  _internal_object = ::Airbnb::Service::Hongbao::Api::UserRequest.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::UserRequest.non_null_checking_off
  _internal_object.validate(Sparsam::STRICT) unless ::Airbnb::Service::Hongbao::Api::UserRequest.type_checking_off
  return _internal_object
end