module Airbnb::Service::Hongbao::Api::HongbaoGetCouponMessagesResponseSmartclientModule::GenerateInstanceMethods

Constants

JSON_NAME_OVERRIDES

Public Instance Methods

state() click to toggle source
# File lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb, line 2274
def state; @state; end
to_h(options = nil)
Alias for: to_hash
to_hash(options = nil) click to toggle source

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.
# File lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb, line 2284
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 && state.nil?)
      _json_key_name = JSON_NAME_OVERRIDES.key?(:state) ? JSON_NAME_OVERRIDES[:state] : :state
      res[_json_key_name] = state
    end
    if !(ignore_nil_field && cta_link.nil?)
      _json_key_name = JSON_NAME_OVERRIDES.key?(:ctaLink) ? JSON_NAME_OVERRIDES[:ctaLink] : :ctaLink
      res[_json_key_name] = cta_link
    end
  else # enforcing to use snake case
    if !(ignore_nil_field && state.nil?)
      _json_key_name = JSON_NAME_OVERRIDES.key?(:state) ?  JSON_NAME_OVERRIDES[:state] : :state
      res[_json_key_name] = state
    end
    if !(ignore_nil_field && cta_link.nil?)
      _json_key_name = JSON_NAME_OVERRIDES.key?(:ctaLink) ?  JSON_NAME_OVERRIDES[:ctaLink] : :cta_link
      res[_json_key_name] = cta_link
    end
  end
  res
end
Also aliased as: to_h
to_json(options = nil) click to toggle source
# File lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb, line 2277
def to_json(options = nil)
  JSON.generate(to_hash(options))
end