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



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

def deeplink; @deeplink; end


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

def terms_link; @termsLink; 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.


2091
2092
2093
2094
2095
2096
2097
2098
2099
2100
2101
2102
2103
2104
2105
2106
2107
2108
2109
2110
2111
2112
2113
2114
2115
2116
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 2091

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

#to_json(options = nil) ⇒ Object



2084
2085
2086
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 2084

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