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

#has_china_couponObject



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

def has_china_coupon; @hasChinaCoupon; 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.


562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 562

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 && has_china_coupon.nil?)
      _json_key_name = JSON_NAME_OVERRIDES.key?(:hasChinaCoupon) ? JSON_NAME_OVERRIDES[:hasChinaCoupon] : :hasChinaCoupon
      res[_json_key_name] = has_china_coupon
    end
  else # enforcing to use snake case
    if !(ignore_nil_field && has_china_coupon.nil?)
      _json_key_name = JSON_NAME_OVERRIDES.key?(:hasChinaCoupon) ?  JSON_NAME_OVERRIDES[:hasChinaCoupon] : :has_china_coupon
      res[_json_key_name] = has_china_coupon
    end
  end
  res
end

#to_json(options = nil) ⇒ Object



555
556
557
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 555

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