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

#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.


2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 2006

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

#to_json(options = nil) ⇒ Object



1999
2000
2001
# File 'lib/airbnb/service/hongbao/api/hongbao_data_smartclient_modules.rb', line 1999

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

#user_agentObject



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

def user_agent; @userAgent; end