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



928
929
930
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 928

def non_null_checking_off
  @non_null_checking_off
end

#type_checking_offObject

Class level accessors to turn on/off specific checking



927
928
929
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 927

def type_checking_off
  @type_checking_off
end

Instance Method Details

#build(params = {}) ⇒ Object

Raises:

  • (TypeError)


930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 930

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

  code = get_field_data(params, :code, :code, _internal_object.code)
  _internal_object.code = code
  currency = get_field_data(params, :currency, :currency, _internal_object.currency)
  _internal_object.currency = currency
  expires_after = get_field_data(params, :expires_after, :expiresAfter, _internal_object.expiresAfter)
  _internal_object.expiresAfter = expires_after
  formatted_localized_amount = get_field_data(params, :formatted_localized_amount, :formattedLocalizedAmount, _internal_object.formattedLocalizedAmount)
  _internal_object.formattedLocalizedAmount = formatted_localized_amount
  formatted_localized_min_trip_cost = get_field_data(params, :formatted_localized_min_trip_cost, :formattedLocalizedMinTripCost, _internal_object.formattedLocalizedMinTripCost)
  _internal_object.formattedLocalizedMinTripCost = formatted_localized_min_trip_cost
  max_savings_usd = get_field_data(params, :max_savings_usd, :maxSavingsUsd, _internal_object.maxSavingsUsd)
  _internal_object.maxSavingsUsd = max_savings_usd
  min_trip_cost = get_field_data(params, :min_trip_cost, :minTripCost, _internal_object.minTripCost)
  _internal_object.minTripCost = min_trip_cost
  savings_amount = get_field_data(params, :savings_amount, :savingsAmount, _internal_object.savingsAmount)
  _internal_object.savingsAmount = savings_amount
  savings_percent = get_field_data(params, :savings_percent, :savingsPercent, _internal_object.savingsPercent)
  _internal_object.savingsPercent = savings_percent
  is_active = get_field_data(params, :is_active, :isActive, _internal_object.isActive)
  _internal_object.isActive = is_active
  id = get_field_data(params, :id, :id, _internal_object.id)
  _internal_object.id = id
  _internal_object.validate(Sparsam::STRICT) unless ::Airbnb::Service::Hongbao::Api::HongbaoCouponDataResponse.type_checking_off
  return _internal_object
end